Set BASS_CONFIG_DEV_DEFAULT to 1 to enable automatic reinitialization of the default device when it is lost (#564)
fixes #561
This commit is contained in:
		
							parent
							
								
									65f812cf73
								
							
						
					
					
						commit
						5190490a07
					
				@ -194,6 +194,7 @@ void AOApplication::call_announce_menu(Courtroom *court)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Callback for when BASS device is lost
 | 
			
		||||
// Only actually used for music syncs
 | 
			
		||||
void CALLBACK AOApplication::BASSreset(HSTREAM handle, DWORD channel,
 | 
			
		||||
                                       DWORD data, void *user)
 | 
			
		||||
{
 | 
			
		||||
@ -213,6 +214,7 @@ void AOApplication::doBASSreset()
 | 
			
		||||
 | 
			
		||||
void AOApplication::initBASS()
 | 
			
		||||
{
 | 
			
		||||
  BASS_SetConfig(BASS_CONFIG_DEV_DEFAULT, 1);
 | 
			
		||||
  BASS_Free();
 | 
			
		||||
  // Change the default audio output device to be the one the user has given
 | 
			
		||||
  // in his config.ini file for now.
 | 
			
		||||
 | 
			
		||||
@ -34,12 +34,6 @@ void AOBlipPlayer::blip_tick()
 | 
			
		||||
  HSTREAM f_stream = m_stream_list[f_cycle];
 | 
			
		||||
 | 
			
		||||
  BASS_ChannelSetDevice(f_stream, BASS_GetDevice());
 | 
			
		||||
  int f_bass_error = BASS_ErrorGetCode();
 | 
			
		||||
  if (f_bass_error == BASS_ERROR_DEVICE) {
 | 
			
		||||
    ao_app->doBASSreset();
 | 
			
		||||
    BASS_ChannelSetDevice(f_stream, BASS_GetDevice());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  BASS_ChannelPlay(f_stream, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -47,12 +47,6 @@ void AOSfxPlayer::play(QString p_sfx, QString p_character, QString p_misc)
 | 
			
		||||
  set_volume_internal(m_volume);
 | 
			
		||||
 | 
			
		||||
  BASS_ChannelSetDevice(m_stream_list[m_channel], BASS_GetDevice());
 | 
			
		||||
  int f_bass_error = BASS_ErrorGetCode();
 | 
			
		||||
  if (f_bass_error == BASS_ERROR_DEVICE) {
 | 
			
		||||
    ao_app->doBASSreset();
 | 
			
		||||
    BASS_ChannelSetDevice(m_stream_list[m_channel], BASS_GetDevice());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  BASS_ChannelPlay(m_stream_list[m_channel], false);
 | 
			
		||||
  BASS_ChannelSetSync(m_stream_list[m_channel], BASS_SYNC_DEV_FAIL, 0,
 | 
			
		||||
                      ao_app->BASSreset, 0);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user