Browse Source

fix opus

pull/85/head
HappyDOGE 2 years ago
parent
commit
de84690884
  1. 2
      engine/audio/private/voice.cpp
  2. 5
      engine/voice_codecs/opus/voiceencoder_opus.cpp
  3. 2
      lib
  4. 4
      wscript

2
engine/audio/private/voice.cpp

@ -671,7 +671,7 @@ bool Voice_Init( const char *pCodecName, int nSampleRate )
// //
// Changing the quality level we use here will require either extending SVC_VoiceInit to pass down which quality is // Changing the quality level we use here will require either extending SVC_VoiceInit to pass down which quality is
// in use or using a different codec name (vaudio_celtHD!) for backwards compatibility // in use or using a different codec name (vaudio_celtHD!) for backwards compatibility
int quality = bCelt ? 3 : 4; int quality = ( bCelt || bOpus ) ? 3 : 4;
// Get the codec. // Get the codec.
CreateInterfaceFn createCodecFn = NULL; CreateInterfaceFn createCodecFn = NULL;

5
engine/voice_codecs/opus/voiceencoder_opus.cpp

@ -97,6 +97,11 @@ bool VoiceEncoder_Opus::Init( int quality, int &rawFrameSize, int &encodedFrameS
m_Mode = opus_custom_mode_create( g_OpusOpts[m_iVersion].iSampleRate, g_OpusOpts[m_iVersion].iRawFrameSize, &iError ); m_Mode = opus_custom_mode_create( g_OpusOpts[m_iVersion].iSampleRate, g_OpusOpts[m_iVersion].iRawFrameSize, &iError );
if ( iError != 0 ) {
Msg( "Opus init failed with error %d", iError );
return false;
}
m_EncoderState = opus_custom_encoder_create( m_Mode, CHANNELS, NULL); m_EncoderState = opus_custom_encoder_create( m_Mode, CHANNELS, NULL);
m_DecoderState = opus_custom_decoder_create( m_Mode, CHANNELS, NULL); m_DecoderState = opus_custom_decoder_create( m_Mode, CHANNELS, NULL);

2
lib

@ -1 +1 @@
Subproject commit 7ec9e1386e7c14539ce09cf27bf8903368afaaed Subproject commit b3fe8769dbcb1b6cf991b2612c23f55b68c7ac4e

4
wscript

@ -138,6 +138,7 @@ def define_platform(conf):
conf.env.DEDICATED = conf.options.DEDICATED conf.env.DEDICATED = conf.options.DEDICATED
conf.env.TOGLES = conf.options.TOGLES conf.env.TOGLES = conf.options.TOGLES
conf.env.GL = conf.options.GL conf.env.GL = conf.options.GL
conf.env.OPUS = conf.options.OPUS
if conf.options.DEDICATED: if conf.options.DEDICATED:
conf.options.SDL = False conf.options.SDL = False
@ -507,6 +508,9 @@ def build(bld):
projects['game'] += ['utils/bzip2'] projects['game'] += ['utils/bzip2']
projects['dedicated'] += ['utils/bzip2'] projects['dedicated'] += ['utils/bzip2']
if bld.env.OPUS or bld.env.DEST_OS == 'android':
projects['game'] += ['engine/voice_codecs/opus']
if bld.env.DEDICATED: if bld.env.DEDICATED:
bld.add_subproject(projects['dedicated']) bld.add_subproject(projects['dedicated'])
else: else:

Loading…
Cancel
Save