12 #ifndef hifi_AudioConstants_h
13 #define hifi_AudioConstants_h
19 namespace AudioConstants {
20 const int SAMPLE_RATE = 24000;
23 const int AMBISONIC = 4;
25 using AudioSample = int16_t;
26 const int SAMPLE_SIZE =
sizeof(AudioSample);
28 inline const char* getAudioFrameName() {
return "com.highfidelity.recording.Audio"; }
30 const int MAX_CODEC_NAME_LENGTH = 30;
31 const int MAX_CODEC_NAME_LENGTH_ON_WIRE = MAX_CODEC_NAME_LENGTH +
sizeof(uint32_t);
32 const int NETWORK_FRAME_BYTES_STEREO = 960;
33 const int NETWORK_FRAME_SAMPLES_STEREO = NETWORK_FRAME_BYTES_STEREO / SAMPLE_SIZE;
34 const int NETWORK_FRAME_BYTES_PER_CHANNEL = NETWORK_FRAME_BYTES_STEREO / 2;
35 const int NETWORK_FRAME_SAMPLES_PER_CHANNEL = NETWORK_FRAME_BYTES_PER_CHANNEL / SAMPLE_SIZE;
36 const int NETWORK_FRAME_SAMPLES_AMBISONIC = NETWORK_FRAME_SAMPLES_PER_CHANNEL * AMBISONIC;
37 const float NETWORK_FRAME_SECS = (AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL / float(AudioConstants::SAMPLE_RATE));
38 const float NETWORK_FRAME_MSECS = NETWORK_FRAME_SECS * 1000.0f;
39 const float NETWORK_FRAMES_PER_SEC = 1.0f / NETWORK_FRAME_SECS;
42 const int NETWORK_FRAME_USECS =
static_cast<int>(NETWORK_FRAME_MSECS * 1000.0f);
44 const int MIN_SAMPLE_VALUE = std::numeric_limits<AudioSample>::min();
45 const int MAX_SAMPLE_VALUE = std::numeric_limits<AudioSample>::max();