diff --git a/aegisub/src/audio_player_alsa.cpp b/aegisub/src/audio_player_alsa.cpp index 7474424c1..7fe1cd9c0 100644 --- a/aegisub/src/audio_player_alsa.cpp +++ b/aegisub/src/audio_player_alsa.cpp @@ -370,7 +370,7 @@ void AlsaPlayer::OpenStream() CloseStream(); ps->Reset(); - ps->provider = GetProvider(); + ps->provider = provider; wxString device_name = lagi_wxString(OPT_GET("Player/Audio/ALSA/Device")->GetString()); ps->device_name = std::string(device_name.utf8_str()); diff --git a/aegisub/src/audio_player_dsound.cpp b/aegisub/src/audio_player_dsound.cpp index f5e464de0..1c70645b5 100644 --- a/aegisub/src/audio_player_dsound.cpp +++ b/aegisub/src/audio_player_dsound.cpp @@ -70,9 +70,6 @@ DirectSoundPlayer::~DirectSoundPlayer() { /// @brief Open stream /// void DirectSoundPlayer::OpenStream() { - // Get provider - AudioProvider *provider = GetProvider(); - // Initialize the DirectSound object HRESULT res; res = DirectSoundCreate8(&DSDEVID_DefaultPlayback,&directSound,NULL); // TODO: support selecting audio device @@ -147,7 +144,6 @@ bool DirectSoundPlayer::FillBuffer(bool fill) { HRESULT res; void *ptr1, *ptr2; unsigned long int size1, size2; - AudioProvider *provider = GetProvider(); int bytesps = provider->GetBytesPerSample(); // To write length diff --git a/aegisub/src/audio_player_dsound2.cpp b/aegisub/src/audio_player_dsound2.cpp index 1e09f53c1..ba3e7a97b 100644 --- a/aegisub/src/audio_player_dsound2.cpp +++ b/aegisub/src/audio_player_dsound2.cpp @@ -834,7 +834,7 @@ void DirectSoundPlayer2::OpenStream() try { - thread.reset(new DirectSoundPlayer2Thread(GetProvider(), WantedLatency, BufferLength)); + thread.reset(new DirectSoundPlayer2Thread(provider, WantedLatency, BufferLength)); } catch (const char *msg) { @@ -847,16 +847,16 @@ void DirectSoundPlayer2::CloseStream() thread.reset(); } -void DirectSoundPlayer2::SetProvider(AudioProvider *provider) +void DirectSoundPlayer2::SetProvider(AudioProvider *new_provider) { try { - if (IsThreadAlive() && provider != GetProvider()) + if (IsThreadAlive() && new_provider != provider) { - thread.reset(new DirectSoundPlayer2Thread(provider, WantedLatency, BufferLength)); + thread.reset(new DirectSoundPlayer2Thread(new_provider, WantedLatency, BufferLength)); } - AudioPlayer::SetProvider(provider); + AudioPlayer::SetProvider(new_provider); } catch (const char *msg) { diff --git a/aegisub/src/audio_player_portaudio.cpp b/aegisub/src/audio_player_portaudio.cpp index 1db7ea6b2..9d7c393f7 100644 --- a/aegisub/src/audio_player_portaudio.cpp +++ b/aegisub/src/audio_player_portaudio.cpp @@ -241,7 +241,7 @@ int PortAudioPlayer::paCallback(const void *inputBuffer, void *outputBuffer, // Play something if (lenAvailable > 0) { - player->GetProvider()->GetAudioWithVolume(outputBuffer, player->current, lenAvailable, player->GetVolume()); + player->provider->GetAudioWithVolume(outputBuffer, player->current, lenAvailable, player->GetVolume()); // Set play position player->current += lenAvailable; diff --git a/aegisub/src/include/aegisub/audio_player.h b/aegisub/src/include/aegisub/audio_player.h index 7f17e3014..c9b802a08 100644 --- a/aegisub/src/include/aegisub/audio_player.h +++ b/aegisub/src/include/aegisub/audio_player.h @@ -79,7 +79,6 @@ public: virtual void SetCurrentPosition(int64_t pos)=0; virtual void SetProvider(AudioProvider *new_provider) { provider = new_provider; } - AudioProvider *GetProvider() const { return provider; } }; class AudioPlayerFactory : public Factory0 {