Skip to content

Commit

Permalink
Enable the Opus music encoder
Browse files Browse the repository at this point in the history
This commit adds the ability to use the AUDIO encoder
instead of the VOIP encoder, that can be used for
bots or broadcaster, who wants to stream in a higher quality.

To enable this feature add a new section [codec] and use
“opus/encoder/music=true” in your Mumble client config file.

Fixes #1630
  • Loading branch information
Natenom authored and SuperNascher committed Sep 4, 2016
1 parent 96d87db commit c8beeb3
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 c8beeb3

Please sign in to comment.