Fixed an issue with the audio output change not registering.
This commit is contained in:
		
							parent
							
								
									aee3099d9b
								
							
						
					
					
						commit
						eee682bf0d
					
				@ -48,21 +48,6 @@ void AOApplication::construct_lobby()
 | 
			
		||||
  discord->state_lobby();
 | 
			
		||||
 | 
			
		||||
  w_lobby->show();
 | 
			
		||||
 | 
			
		||||
  // Change the default audio output device to be the one the user has given
 | 
			
		||||
  // in his config.ini file for now.
 | 
			
		||||
  int a = 0;
 | 
			
		||||
  BASS_DEVICEINFO info;
 | 
			
		||||
 | 
			
		||||
  for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
 | 
			
		||||
  {
 | 
			
		||||
      if (get_audio_output_device() == info.name)
 | 
			
		||||
      {
 | 
			
		||||
          BASS_SetDevice(a);
 | 
			
		||||
          qDebug() << info.name << "was set as the default audio output device.";
 | 
			
		||||
          break;
 | 
			
		||||
      }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOApplication::destruct_lobby()
 | 
			
		||||
@ -125,20 +110,6 @@ QString AOApplication::get_cccc_version_string()
 | 
			
		||||
void AOApplication::reload_theme()
 | 
			
		||||
{
 | 
			
		||||
  current_theme = read_theme();
 | 
			
		||||
 | 
			
		||||
  // This may not be the best place for it, but let's read the audio output device just in case.
 | 
			
		||||
  int a = 0;
 | 
			
		||||
  BASS_DEVICEINFO info;
 | 
			
		||||
 | 
			
		||||
  for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
 | 
			
		||||
  {
 | 
			
		||||
      if (get_audio_output_device() == info.name)
 | 
			
		||||
      {
 | 
			
		||||
          BASS_SetDevice(a);
 | 
			
		||||
          qDebug() << info.name << "was set as the default audio output device.";
 | 
			
		||||
          break;
 | 
			
		||||
      }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOApplication::set_favorite_list()
 | 
			
		||||
 | 
			
		||||
@ -33,6 +33,7 @@ void AOBlipPlayer::blip_tick()
 | 
			
		||||
 | 
			
		||||
  HSTREAM f_stream = m_stream_list[f_cycle];
 | 
			
		||||
 | 
			
		||||
  BASS_ChannelSetDevice(f_stream, BASS_GetDevice());
 | 
			
		||||
  BASS_ChannelPlay(f_stream, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -25,6 +25,7 @@ void AOMusicPlayer::play(QString p_song)
 | 
			
		||||
 | 
			
		||||
  this->set_volume(m_volume);
 | 
			
		||||
 | 
			
		||||
  BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
 | 
			
		||||
  BASS_ChannelPlay(m_stream, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -27,6 +27,7 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char)
 | 
			
		||||
 | 
			
		||||
  set_volume(m_volume);
 | 
			
		||||
 | 
			
		||||
  BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
 | 
			
		||||
  BASS_ChannelPlay(m_stream, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -20,8 +20,24 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
 | 
			
		||||
  //initializing sound device
 | 
			
		||||
  BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, 0, NULL);
 | 
			
		||||
  BASS_PluginLoad("bassopus.dll", BASS_UNICODE);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // Change the default audio output device to be the one the user has given
 | 
			
		||||
  // in his config.ini file for now.
 | 
			
		||||
  int a = 0;
 | 
			
		||||
  BASS_DEVICEINFO info;
 | 
			
		||||
 | 
			
		||||
  for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
 | 
			
		||||
  {
 | 
			
		||||
      if (ao_app->get_audio_output_device() == info.name)
 | 
			
		||||
      {
 | 
			
		||||
          BASS_SetDevice(a);
 | 
			
		||||
          BASS_Init(a, 48000, BASS_DEVICE_LATENCY, 0, NULL);
 | 
			
		||||
          BASS_PluginLoad("bassopus.dll", BASS_UNICODE);
 | 
			
		||||
          qDebug() << info.name << "was set as the default audio output device.";
 | 
			
		||||
          break;
 | 
			
		||||
      }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  keepalive_timer = new QTimer(this);
 | 
			
		||||
  keepalive_timer->start(60000);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user