Skip to content

Commit

Permalink
Merge PR #2542: Enable the Opus music encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrautz committed Sep 4, 2016
2 parents 96d87db + 498e558 commit 2eaed7e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/mumble/AudioInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ AudioInput::AudioInput() : opusBuffer(g.s.iFramesPerPacket * (SAMPLE_RATE / 100)
iFrameSize = SAMPLE_RATE / 100;

#ifdef USE_OPUS
opusState = opus_encoder_create(SAMPLE_RATE, 1, OPUS_APPLICATION_VOIP, NULL);
if (!g.s.bUseOpusMusicEncoding) {
opusState = opus_encoder_create(SAMPLE_RATE, 1, OPUS_APPLICATION_VOIP, NULL);
qWarning("AudioInput: Opus encoder set for VOIP");
} else {
opusState = opus_encoder_create(SAMPLE_RATE, 1, OPUS_APPLICATION_AUDIO, NULL);
qWarning("AudioInput: Opus encoder set for Music");
}

opus_encoder_ctl(opusState, OPUS_SET_VBR(0)); // CBR
#endif

Expand Down
6 changes: 6 additions & 0 deletions src/mumble/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ Settings::Settings() {
fVADmin = 0.80f;
fVADmax = 0.98f;

bUseOpusMusicEncoding = false;

bTxAudioCue = false;
qsTxAudioCueOn = cqsDefaultPushClickOn;
qsTxAudioCueOff = cqsDefaultPushClickOff;
Expand Down Expand Up @@ -590,6 +592,8 @@ void Settings::load(QSettings* settings_ptr) {
SAVELOAD(bWhisperFriends, "audio/whisperfriends");
SAVELOAD(bTransmitPosition, "audio/postransmit");

SAVELOAD(bUseOpusMusicEncoding, "codec/opus/encoder/music");

SAVELOAD(iJitterBufferSize, "net/jitterbuffer");
SAVELOAD(iFramesPerPacket, "net/framesperpacket");

Expand Down Expand Up @@ -901,6 +905,8 @@ void Settings::save() {
SAVELOAD(bWhisperFriends, "audio/whisperfriends");
SAVELOAD(bTransmitPosition, "audio/postransmit");

SAVELOAD(bUseOpusMusicEncoding, "codec/opus/encoder/music");

SAVELOAD(iJitterBufferSize, "net/jitterbuffer");
SAVELOAD(iFramesPerPacket, "net/framesperpacket");

Expand Down
1 change: 1 addition & 0 deletions src/mumble/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ struct Settings {
bool bOnlyAttenuateSameOutput;
bool bAttenuateLoopbacks;
int iOutputDelay;
bool bUseOpusMusicEncoding;

QString qsALSAInput, qsALSAOutput;
QString qsPulseAudioInput, qsPulseAudioOutput;
Expand Down

0 comments on commit 2eaed7e

Please sign in to comment.