diff options
Diffstat (limited to 'src/mumble/AudioOutputSpeech.cpp')
-rw-r--r-- | src/mumble/AudioOutputSpeech.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/mumble/AudioOutputSpeech.cpp b/src/mumble/AudioOutputSpeech.cpp index bc48ed858..ee7426a1e 100644 --- a/src/mumble/AudioOutputSpeech.cpp +++ b/src/mumble/AudioOutputSpeech.cpp @@ -3,16 +3,6 @@ // that can be found in the LICENSE file at the root of the // Mumble source tree or at <https://www.mumble.info/LICENSE>. -// We want to include <math.h> with _USE_MATH_DEFINES defined. -// To make sure we do so before anything else includes the header without it -// (triggering the guard and effectively preventing a "fix include") -// we define and include before anything else. -#ifdef _MSC_VER -# define _USE_MATH_DEFINES -#endif - -#include <cmath> - #include "AudioOutputSpeech.h" #include "Audio.h" @@ -26,6 +16,8 @@ #include "Utils.h" #include "Global.h" +#include <cmath> + AudioOutputSpeech::AudioOutputSpeech(ClientUser *user, unsigned int freq, MessageHandler::UDPMessageType type, unsigned int systemMaxBufferSize) : AudioOutputUser(user->qsName) { @@ -47,9 +39,9 @@ AudioOutputSpeech::AudioOutputSpeech(ClientUser *user, unsigned int freq, Messag // opus's "frame" means different from normal audio term "frame" // normally, a frame means a bundle of only one sample from each channel, - // e.g. for a stereo stream, ...[LR]LRLRLR.... where the bracket indicates a frame + // e.Global::get(). for a stereo stream, ...[LR]LRLRLR.... where the bracket indicates a frame // in opus term, a frame means samples that span a period of time, which can be either stereo or mono - // e.g. ...[LRLR....LRLR].... or ...[MMMM....MMMM].... for mono stream + // e.Global::get(). ...[LRLR....LRLR].... or ...[MMMM....MMMM].... for mono stream // opus supports frames with: 2.5, 5, 10, 20, 40 or 60 ms of audio data. // sample rate / 100 means 10ms mono audio data per frame. iFrameSizePerChannel = iFrameSize = iSampleRate / 100; // for mono stream @@ -59,7 +51,7 @@ AudioOutputSpeech::AudioOutputSpeech(ClientUser *user, unsigned int freq, Messag // Always pretend Stereo mode is true by default. since opus will convert mono stream to stereo stream. // https://tools.ietf.org/html/rfc6716#section-2.1.2 bStereo = true; - oCodec = g.oCodec; + oCodec = Global::get().oCodec; if (oCodec) { opusState = oCodec->opus_decoder_create(iSampleRate, bStereo ? 2 : 1, nullptr); oCodec->opus_decoder_ctl( @@ -123,7 +115,7 @@ AudioOutputSpeech::AudioOutputSpeech(ClientUser *user, unsigned int freq, Messag ucFlags = SpeechFlags::Invalid; jbJitter = jitter_buffer_init(iFrameSize); - int margin = g.s.iJitterBufferSize * iFrameSize; + int margin = Global::get().s.iJitterBufferSize * iFrameSize; jitter_buffer_ctl(jbJitter, JITTER_BUFFER_SET_MARGIN, &margin); fFadeIn = new float[iFrameSizePerChannel]; @@ -343,9 +335,9 @@ bool AudioOutputSpeech::prepareSampleBuffer(unsigned int frameCount) { QByteArray qba = qlFrames.takeFirst(); if (umtType == MessageHandler::UDPVoiceCELTAlpha || umtType == MessageHandler::UDPVoiceCELTBeta) { - int wantversion = (umtType == MessageHandler::UDPVoiceCELTAlpha) ? g.iCodecAlpha : g.iCodecBeta; - if ((p == &LoopUser::lpLoopy) && (!g.qmCodecs.isEmpty())) { - QMap< int, CELTCodec * >::const_iterator i = g.qmCodecs.constEnd(); + int wantversion = (umtType == MessageHandler::UDPVoiceCELTAlpha) ? Global::get().iCodecAlpha : Global::get().iCodecBeta; + if ((p == &LoopUser::lpLoopy) && (!Global::get().qmCodecs.isEmpty())) { + QMap< int, CELTCodec * >::const_iterator i = Global::get().qmCodecs.constEnd(); --i; wantversion = i.key(); } @@ -354,7 +346,7 @@ bool AudioOutputSpeech::prepareSampleBuffer(unsigned int frameCount) { cdDecoder = nullptr; } if (!cCodec) { - cCodec = g.qmCodecs.value(wantversion); + cCodec = Global::get().qmCodecs.value(wantversion); if (cCodec) { cdDecoder = cCodec->decoderCreate(); } |