7#if !defined(HEPH_ENV_64_BIT)
8#error 32-bit is not supported!
15#define HEPHAUDIO_VERSION_MAJOR 3
21#define HEPHAUDIO_VERSION_MINOR 0
27#define HEPHAUDIO_VERSION_PATCH 6
33#define HEPHAUDIO_VERSION "v" \
34 HEPH_TOSTRING(HEPHAUDIO_VERSION_MAJOR) "." \
35 HEPH_TOSTRING(HEPHAUDIO_VERSION_MINOR) "." \
36 HEPH_TOSTRING(HEPHAUDIO_VERSION_PATCH)
38#define HEPHAUDIO_FORMAT_TAG_PCM (0x0001)
39#define HEPHAUDIO_FORMAT_TAG_IEEE_FLOAT (0x0003)
40#define HEPHAUDIO_FORMAT_TAG_ALAW (0x0006)
41#define HEPHAUDIO_FORMAT_TAG_MULAW (0x0007)
42#define HEPHAUDIO_FORMAT_TAG_WMA (0x0161)
43#define HEPHAUDIO_FORMAT_TAG_WMAUDIO_LOSSLESS (0x0163)
44#define HEPHAUDIO_FORMAT_TAG_WMAVOICE (0x000A)
45#define HEPHAUDIO_FORMAT_TAG_MPEG (0x0050)
46#define HEPHAUDIO_FORMAT_TAG_MP3 (0x0055)
47#define HEPHAUDIO_FORMAT_TAG_AAC (0xA106)
48#define HEPHAUDIO_FORMAT_TAG_ALAC (0x6C61)
49#define HEPHAUDIO_FORMAT_TAG_FLAC (0xF1AC)
50#define HEPHAUDIO_FORMAT_TAG_OPUS (0x704F)
51#define HEPHAUDIO_FORMAT_TAG_VORBIS (0x674F)
52#define HEPHAUDIO_FORMAT_TAG_EXTENSIBLE (0xFFFE)
59#if defined(HEPHAUDIO_INFO_LOGGING)
60#define HEPHAUDIO_LOG(logMessage, logType) Heph::ConsoleLogger::Log(logMessage, logType, "HephAudio")
62#define HEPHAUDIO_LOG(logMessage, logType)
69#define HEPHAUDIO_SPEED_OF_SOUND 343.0
71#define UINT24_MAX 16777215
72#define INT24_MIN (-8388608)
73#define INT24_MAX 8388607
107#if defined(HEPH_AUDIO_SAMPLE_TYPE_DBL)
109#define HEPH_AUDIO_SAMPLE_MIN (-1.0)
110#define HEPH_AUDIO_SAMPLE_MAX (1.0)
111#define HEPHAUDIO_FORMAT_TAG_HEPHAUDIO_INTERNAL HEPHAUDIO_FORMAT_TAG_IEEE_FLOAT
112#elif defined(HEPH_AUDIO_SAMPLE_TYPE_FLT)
114#define HEPH_AUDIO_SAMPLE_MIN (-1.0f)
115#define HEPH_AUDIO_SAMPLE_MAX (1.0f)
116#define HEPHAUDIO_FORMAT_TAG_HEPHAUDIO_INTERNAL HEPHAUDIO_FORMAT_TAG_IEEE_FLOAT
117#elif defined(HEPH_AUDIO_SAMPLE_TYPE_S64)
119#define HEPH_AUDIO_SAMPLE_MIN (INT64_MIN)
120#define HEPH_AUDIO_SAMPLE_MAX (INT64_MAX)
121#define HEPHAUDIO_FORMAT_TAG_HEPHAUDIO_INTERNAL HEPHAUDIO_FORMAT_TAG_PCM
122#elif defined(HEPH_AUDIO_SAMPLE_TYPE_S32)
124#define HEPH_AUDIO_SAMPLE_MIN (INT32_MIN)
125#define HEPH_AUDIO_SAMPLE_MAX (INT32_MAX)
126#define HEPHAUDIO_FORMAT_TAG_HEPHAUDIO_INTERNAL HEPHAUDIO_FORMAT_TAG_PCM
127#elif defined(HEPH_AUDIO_SAMPLE_TYPE_S16)
129#define HEPH_AUDIO_SAMPLE_MIN (INT16_MIN)
130#define HEPH_AUDIO_SAMPLE_MAX (INT16_MAX)
131#define HEPHAUDIO_FORMAT_TAG_HEPHAUDIO_INTERNAL HEPHAUDIO_FORMAT_TAG_PCM
134#define HEPH_AUDIO_SAMPLE_MIN (-1.0f)
135#define HEPH_AUDIO_SAMPLE_MAX (1.0f)
136#define HEPHAUDIO_FORMAT_TAG_HEPHAUDIO_INTERNAL HEPHAUDIO_FORMAT_TAG_IEEE_FLOAT
139#if HEPHAUDIO_FORMAT_TAG_HEPHAUDIO_INTERNAL == HEPHAUDIO_FORMAT_TAG_PCM
141#define HEPH_AUDIO_SAMPLE_TO_IEEE_FLT(sample) (((double)sample) / (-((double)HEPH_AUDIO_SAMPLE_MIN)))
142#define HEPH_AUDIO_SAMPLE_FROM_IEEE_FLT(fltSample) ((heph_audio_sample_t)((fltSample) * (-((double)HEPH_AUDIO_SAMPLE_MIN))))
144#elif HEPHAUDIO_FORMAT_TAG_HEPHAUDIO_INTERNAL == HEPHAUDIO_FORMAT_TAG_IEEE_FLOAT
146#define HEPH_AUDIO_SAMPLE_TO_IEEE_FLT(sample) (sample)
147#define HEPH_AUDIO_SAMPLE_FROM_IEEE_FLT(fltSample) (fltSample)
150#error heph_audio_sample_t/ieee_float conversions are not implemented for this internal format yet.
157#define HEPHAUDIO_ANDROID_OPENSL_MIN_API_LEVEL (21)
163#define HEPHAUDIO_ANDROID_AAUDIO_MIN_API_LEVEL (26)
168 HEPH_API unsigned int GetVersionMajor();
169 HEPH_API unsigned int GetVersionMinor();
170 HEPH_API unsigned int GetVersionPatch();
178 return pow(10.0, decibel * 0.05);
187 return gain == 0 ? -120.0 : 20.0 * log10(abs(gain));
196 return semitone * 100.0;
205 return semitone / 12.0;
223 return cent / 1200.0;
232 return octave * 12.0;
241 return octave * 1200.0;
constexpr double SemitoneToOctave(double semitone)
Definition HephAudioShared.h:203
double GainToDecibel(double gain)
Definition HephAudioShared.h:185
constexpr double CentToSemitone(double cent)
Definition HephAudioShared.h:212
float heph_audio_sample_t
Definition HephAudioShared.h:133
constexpr double OctaveToCent(double octave)
Definition HephAudioShared.h:239
double DecibelToGain(double decibel)
Definition HephAudioShared.h:176
constexpr double CentToOctave(double cent)
Definition HephAudioShared.h:221
constexpr double SemitoneToCent(double semitone)
Definition HephAudioShared.h:194
constexpr double OctaveToSemitone(double octave)
Definition HephAudioShared.h:230
#define HEPH_API
Definition HephShared.h:132