eDSP  0.0.1
A cross-platform DSP library written in C++.
library_info.hpp
Go to the documentation of this file.
1 /*
2 * eDSP, A cross-platform Digital Signal Processing library written in modern C++.
3 * Copyright (C) 2018 Mohammed Boujemaoui Boulaghmoudi, All rights reserved.
4 *
5 * This program is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation, either version 3 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along width
16 * this program. If not, see <http://www.gnu.org/licenses/>
17 *
18 * Filename: library_info.hpp
19 * Author: Mohammed Boujemaoui
20 * Date: 09/10/18
21 */
22 
23 #ifndef EDSP_LIBRARY_INFO_HPP
24 #define EDSP_LIBRARY_INFO_HPP
25 
26 #include <edsp/core/internal/config.hpp>
27 #include <edsp/core/logger.hpp>
28 #include <cstdint>
29 
30 namespace edsp { inline namespace core {
31 
32  enum class fft_lib { fftw, pffft, accelerate, unknown };
33 
34  enum class codec_lib { audiofile, sndfile, unknown };
35 
36  enum class resample_lib { samplerate, resample, unknown };
37 
38  inline logger& operator<<(logger& stream, fft_lib lib) {
39  switch (lib) {
40  case fft_lib::fftw:
41  return stream << "FFTW";
42  case fft_lib::pffft:
43  return stream << "PFFFT";
45  return stream << "Apple Accelerate Framework";
46  default:
47  return stream << edsp::red << "not found" << edsp::endc;
48  }
49  }
50 
51  inline logger& operator<<(logger& stream, codec_lib lib) {
52  switch (lib) {
54  return stream << "Audio File Library";
55  case codec_lib::sndfile:
56  return stream << "Lib SndFile";
57  default:
58  return stream << edsp::red << "not found" << edsp::endc;
59  }
60  }
61 
62  inline logger& operator<<(logger& stream, resample_lib lib) {
63  switch (lib) {
65  return stream << "libsamplerate";
67  return stream << "libresample";
68  default:
69  return stream << edsp::red << "not found" << edsp::endc;
70  }
71  }
72 
73  struct library_info {
74  static constexpr std::int32_t minor_version() noexcept {
75  return E_VERSION_MINOR;
76  }
77 
78  static constexpr std::int32_t major_version() noexcept {
79  return E_VERSION_MINOR;
80  }
81 
82  static constexpr std::int32_t patch_version() noexcept {
83  return E_VERSION_MINOR;
84  }
85 
86  static constexpr const char* version() noexcept {
87  return E_VERSION_STR;
88  }
89 
90  static constexpr const char* build_date() noexcept {
91  return E_BUILD_DATE;
92  }
93 
94  static constexpr const char* build_time() noexcept {
95  return E_BUILD_TIME;
96  }
97 
98  static constexpr fft_lib fft_library() noexcept {
99 #if defined(USE_LIBFFTW)
100  return fft_lib::fftw;
101 #elif defined(USE_LIBPFFFT)
102  return fft_lib::fftw;
103 #elif defined(USE_LIBACCELERATE)
104  return fft_lib::fftw;
105 #else
106  return fft_lib::unknown;
107 #endif
108  }
109 
110  static constexpr codec_lib codec_library() noexcept {
111 #if defined(USE_LIBAUDIOFILE)
112  return codec_lib::audiofile;
113 #elif defined(USE_LIBSNDFILE)
114  return codec_lib::sndfile;
115 #else
116  return codec_lib::unknown;
117 #endif
118  }
119 
120  static constexpr resample_lib resample_library() noexcept {
121 #if defined(USE_LIBSAMPLERATE)
123 #elif defined(USE_LIBRESAMPLE)
124  return resample_lib::resample;
125 #else
126  return resample_lib::unknown;
127 #endif
128  }
129  };
130 }} // namespace edsp::core
131 
132 #endif //EDSP_LIBRARY_INFO_HPP
static constexpr const char * build_time() noexcept
Definition: library_info.hpp:94
static constexpr resample_lib resample_library() noexcept
Definition: library_info.hpp:120
static constexpr std::int32_t minor_version() noexcept
Definition: library_info.hpp:74
resample_lib
Definition: library_info.hpp:36
fft_lib
Definition: library_info.hpp:32
static constexpr fft_lib fft_library() noexcept
Definition: library_info.hpp:98
Definition: library_info.hpp:73
static constexpr codec_lib codec_library() noexcept
Definition: library_info.hpp:110
logger & red(logger &stream)
Updates the logger output color to red.
Definition: logger.hpp:325
static constexpr const char * version() noexcept
Definition: library_info.hpp:86
Definition: logger.hpp:40
static constexpr const char * build_date() noexcept
Definition: library_info.hpp:90
codec_lib
Definition: library_info.hpp:34
logger & endc(logger &stream)
End of color, styled streaming.
Definition: logger.hpp:407
Definition: amplifier.hpp:29
static constexpr std::int32_t major_version() noexcept
Definition: library_info.hpp:78
logger & operator<<(logger &stream, fft_lib lib)
Definition: library_info.hpp:38
static constexpr std::int32_t patch_version() noexcept
Definition: library_info.hpp:82