Fixed a Windows bug where there was no way to get back to the default audio device.
This commit is contained in:
		
							parent
							
								
									4ee565591f
								
							
						
					
					
						commit
						91ad46eea0
					
				@ -265,7 +265,7 @@ private:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const int CCCC_RELEASE = 1;
 | 
					  const int CCCC_RELEASE = 1;
 | 
				
			||||||
  const int CCCC_MAJOR_VERSION = 3;
 | 
					  const int CCCC_MAJOR_VERSION = 3;
 | 
				
			||||||
  const int CCCC_MINOR_VERSION = 0;
 | 
					  const int CCCC_MINOR_VERSION = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  QString current_theme = "default";
 | 
					  QString current_theme = "default";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -29,7 +29,8 @@ void AOBlipPlayer::blip_tick()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  HSTREAM f_stream = m_stream_list[f_cycle];
 | 
					  HSTREAM f_stream = m_stream_list[f_cycle];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  BASS_ChannelSetDevice(f_stream, BASS_GetDevice());
 | 
					  if (ao_app->get_audio_output_device() != "Default")
 | 
				
			||||||
 | 
					    BASS_ChannelSetDevice(f_stream, BASS_GetDevice());
 | 
				
			||||||
  BASS_ChannelPlay(f_stream, false);
 | 
					  BASS_ChannelPlay(f_stream, false);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -21,7 +21,8 @@ void AOMusicPlayer::play(QString p_song)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  this->set_volume(m_volume);
 | 
					  this->set_volume(m_volume);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
 | 
					  if (ao_app->get_audio_output_device() != "Default")
 | 
				
			||||||
 | 
					    BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
 | 
				
			||||||
  BASS_ChannelPlay(m_stream, false);
 | 
					  BASS_ChannelPlay(m_stream, false);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -211,6 +211,11 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
 | 
				
			|||||||
    int a = 0;
 | 
					    int a = 0;
 | 
				
			||||||
    BASS_DEVICEINFO info;
 | 
					    BASS_DEVICEINFO info;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (needs_default_audiodev())
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        AudioDeviceCombobox->addItem("Default");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
 | 
					    for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        AudioDeviceCombobox->addItem(info.name);
 | 
					        AudioDeviceCombobox->addItem(info.name);
 | 
				
			||||||
@ -339,3 +344,17 @@ void AOOptionsDialog::discard_pressed()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    done(0);
 | 
					    done(0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if (defined (_WIN32) || defined (_WIN64))
 | 
				
			||||||
 | 
					bool AOOptionsDialog::needs_default_audiodev()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#elif (defined (LINUX) || defined (__linux__))
 | 
				
			||||||
 | 
					bool AOOptionsDialog::needs_default_audiodev()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					#error This operating system is not supported.
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -79,6 +79,8 @@ private:
 | 
				
			|||||||
    QLabel *BlankBlipsLabel;
 | 
					    QLabel *BlankBlipsLabel;
 | 
				
			||||||
    QDialogButtonBox *SettingsButtons;
 | 
					    QDialogButtonBox *SettingsButtons;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool needs_default_audiodev();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
signals:
 | 
					signals:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public slots:
 | 
					public slots:
 | 
				
			||||||
 | 
				
			|||||||
@ -23,7 +23,8 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  set_volume(m_volume);
 | 
					  set_volume(m_volume);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
 | 
					  if (ao_app->get_audio_output_device() != "Default")
 | 
				
			||||||
 | 
					    BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
 | 
				
			||||||
  BASS_ChannelPlay(m_stream, false);
 | 
					  BASS_ChannelPlay(m_stream, false);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -19,15 +19,23 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
				
			|||||||
  int a = 0;
 | 
					  int a = 0;
 | 
				
			||||||
  BASS_DEVICEINFO info;
 | 
					  BASS_DEVICEINFO info;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
 | 
					  if (ao_app->get_audio_output_device() == "Default")
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
      if (ao_app->get_audio_output_device() == info.name)
 | 
					      BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, 0, NULL);
 | 
				
			||||||
 | 
					      BASS_PluginLoad("bassopus.dll", BASS_UNICODE);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					      for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
          BASS_SetDevice(a);
 | 
					          if (ao_app->get_audio_output_device() == info.name)
 | 
				
			||||||
          BASS_Init(a, 48000, BASS_DEVICE_LATENCY, 0, NULL);
 | 
					          {
 | 
				
			||||||
          BASS_PluginLoad("bassopus.dll", BASS_UNICODE);
 | 
					              BASS_SetDevice(a);
 | 
				
			||||||
          qDebug() << info.name << "was set as the default audio output device.";
 | 
					              BASS_Init(a, 48000, BASS_DEVICE_LATENCY, 0, NULL);
 | 
				
			||||||
          break;
 | 
					              BASS_PluginLoad("bassopus.dll", BASS_UNICODE);
 | 
				
			||||||
 | 
					              qDebug() << info.name << "was set as the default audio output device.";
 | 
				
			||||||
 | 
					              break;
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user