Remove AudioPlayer::GetProvider()
There's really no reason why anything should ever be getting the audio provider from an audio player. Originally committed to SVN as r6603.
This commit is contained in:
parent
e120bec4f0
commit
55f9ccc18d
5 changed files with 7 additions and 12 deletions
|
@ -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());
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<AudioPlayer> {
|
||||
|
|
Loading…
Reference in a new issue