Remove some unused AudioPlayer methods

This commit is contained in:
Thomas Goyne 2013-09-26 20:25:10 -07:00
parent 703b1fc3a7
commit 04435a13a3
16 changed files with 0 additions and 182 deletions

View File

@ -319,15 +319,6 @@ int AudioController::GetDuration() const
return (provider->GetNumSamples() * 1000 + provider->GetSampleRate() - 1) / provider->GetSampleRate(); return (provider->GetNumSamples() * 1000 + provider->GetSampleRate() - 1) / provider->GetSampleRate();
} }
void AudioController::ResyncPlaybackPosition(int new_position)
{
if (!IsPlaying()) return;
player->SetCurrentPosition(SamplesFromMilliseconds(new_position));
}
TimeRange AudioController::GetPrimaryPlaybackRange() const TimeRange AudioController::GetPrimaryPlaybackRange() const
{ {
if (timing_controller) if (timing_controller)
@ -340,12 +331,6 @@ TimeRange AudioController::GetPrimaryPlaybackRange() const
} }
} }
double AudioController::GetVolume() const
{
if (!IsAudioOpen()) return 1.0;
return player->GetVolume();
}
void AudioController::SetVolume(double volume) void AudioController::SetVolume(double volume)
{ {
if (!IsAudioOpen()) return; if (!IsAudioOpen()) return;

View File

@ -218,25 +218,10 @@ public:
/// @return Duration in milliseconds /// @return Duration in milliseconds
int GetDuration() const; int GetDuration() const;
/// @brief If playing, restart playback from the specified position
/// @param new_position Time to restart playback from
///
/// This function can be used to re-synchronise audio playback to another
/// source that might not be able to keep up with the full speed, such as
/// video playback in high resolution or with complex subtitles.
///
/// This function only does something if audio is already playing.
void ResyncPlaybackPosition(int new_position);
/// @brief Get the primary playback range /// @brief Get the primary playback range
/// @return An immutable TimeRange object /// @return An immutable TimeRange object
TimeRange GetPrimaryPlaybackRange() const; TimeRange GetPrimaryPlaybackRange() const;
/// @brief Get the playback audio volume
/// @return The amplification factor for the audio
double GetVolume() const;
/// @brief Set the playback audio volume /// @brief Set the playback audio volume
/// @param volume The new amplification factor for the audio /// @param volume The new amplification factor for the audio
void SetVolume(double volume); void SetVolume(double volume);

View File

@ -422,26 +422,6 @@ void AlsaPlayer::SetEndPosition(int64_t pos)
ps->end_position = pos; ps->end_position = pos;
} }
void AlsaPlayer::SetCurrentPosition(int64_t pos)
{
PthreadMutexLocker ml(ps->mutex);
if (!ps->playing) return;
ps->start_position = pos;
ps->signal_start = true;
ps->signal_stop = true;
LOG_D("audio/player/alsa") << "set position, stop+start signal";
pthread_cond_signal(&ps->cond);
}
int64_t AlsaPlayer::GetStartPosition()
{
PthreadMutexLocker ml(ps->mutex);
return ps->start_position;
}
int64_t AlsaPlayer::GetEndPosition() int64_t AlsaPlayer::GetEndPosition()
{ {
PthreadMutexLocker ml(ps->mutex); PthreadMutexLocker ml(ps->mutex);
@ -485,11 +465,4 @@ void AlsaPlayer::SetVolume(double vol)
pthread_cond_signal(&ps->cond); pthread_cond_signal(&ps->cond);
} }
double AlsaPlayer::GetVolume()
{
PthreadMutexLocker ml(ps->mutex);
return ps->volume;
}
#endif // WITH_ALSA #endif // WITH_ALSA

View File

@ -59,7 +59,6 @@ public:
void SetCurrentPosition(int64_t pos); void SetCurrentPosition(int64_t pos);
void SetVolume(double vol); void SetVolume(double vol);
double GetVolume();
}; };
#endif #endif

View File

@ -277,14 +277,6 @@ void DirectSoundPlayer::SetEndPosition(int64_t pos) {
if (playing) endPos = pos; if (playing) endPos = pos;
} }
/// @brief Set current position
/// @param pos
///
void DirectSoundPlayer::SetCurrentPosition(int64_t pos) {
startPos = playPos = pos;
startTime = GetTickCount();
}
/// @brief Get current position /// @brief Get current position
/// @return /// @return
/// ///

View File

@ -83,13 +83,10 @@ public:
bool IsPlaying() { return playing; } bool IsPlaying() { return playing; }
int64_t GetStartPosition() { return startPos; }
int64_t GetEndPosition() { return endPos; } int64_t GetEndPosition() { return endPos; }
int64_t GetCurrentPosition(); int64_t GetCurrentPosition();
void SetEndPosition(int64_t pos); void SetEndPosition(int64_t pos);
void SetCurrentPosition(int64_t pos);
void SetVolume(double vol) { volume = vol; } void SetVolume(double vol) { volume = vol; }
double GetVolume() { return volume; }
}; };
#endif #endif

View File

@ -242,10 +242,6 @@ public:
/// @return True if audio is being played back, false if it is not /// @return True if audio is being played back, false if it is not
bool IsPlaying(); bool IsPlaying();
/// @brief Get first audio frame in current playback range
/// @return Audio frame index
int64_t GetStartFrame();
/// @brief Get approximate current audio frame being heard by the user /// @brief Get approximate current audio frame being heard by the user
/// @return Audio frame index /// @return Audio frame index
/// ///
@ -256,10 +252,6 @@ public:
/// @return Audio frame index /// @return Audio frame index
int64_t GetEndFrame(); int64_t GetEndFrame();
/// @brief Get current playback volume
/// @return Audio amplification factor
double GetVolume();
/// @brief Tell whether playback thread has died /// @brief Tell whether playback thread has died
/// @return True if thread is no longer running /// @return True if thread is no longer running
bool IsDead(); bool IsDead();
@ -755,13 +747,6 @@ bool DirectSoundPlayer2Thread::IsPlaying()
} }
} }
int64_t DirectSoundPlayer2Thread::GetStartFrame()
{
CheckError();
return start_frame;
}
int64_t DirectSoundPlayer2Thread::GetCurrentFrame() int64_t DirectSoundPlayer2Thread::GetCurrentFrame()
{ {
CheckError(); CheckError();
@ -780,13 +765,6 @@ int64_t DirectSoundPlayer2Thread::GetEndFrame()
return end_frame; return end_frame;
} }
double DirectSoundPlayer2Thread::GetVolume()
{
CheckError();
return volume;
}
bool DirectSoundPlayer2Thread::IsDead() bool DirectSoundPlayer2Thread::IsDead()
{ {
switch (WaitForSingleObject(thread_running, 0)) switch (WaitForSingleObject(thread_running, 0))
@ -875,20 +853,6 @@ bool DirectSoundPlayer2::IsPlaying()
} }
} }
int64_t DirectSoundPlayer2::GetStartPosition()
{
try
{
if (!IsThreadAlive()) return 0;
return thread->GetStartFrame();
}
catch (const char *msg)
{
LOG_E("audio/player/dsound") << msg;
return 0;
}
}
int64_t DirectSoundPlayer2::GetEndPosition() int64_t DirectSoundPlayer2::GetEndPosition()
{ {
try try
@ -929,18 +893,6 @@ void DirectSoundPlayer2::SetEndPosition(int64_t pos)
} }
} }
void DirectSoundPlayer2::SetCurrentPosition(int64_t pos)
{
try
{
if (IsThreadAlive()) thread->Play(pos, thread->GetEndFrame()-pos);
}
catch (const char *msg)
{
LOG_E("audio/player/dsound") << msg;
}
}
void DirectSoundPlayer2::SetVolume(double vol) void DirectSoundPlayer2::SetVolume(double vol)
{ {
try try
@ -953,17 +905,4 @@ void DirectSoundPlayer2::SetVolume(double vol)
} }
} }
double DirectSoundPlayer2::GetVolume()
{
try
{
if (!IsThreadAlive()) return 0;
return thread->GetVolume();
}
catch (const char *msg)
{
LOG_E("audio/player/dsound") << msg;
return 0;
}
}
#endif // WITH_DIRECTSOUND #endif // WITH_DIRECTSOUND

View File

@ -77,12 +77,6 @@ public:
/// @return True if audio is playing back /// @return True if audio is playing back
bool IsPlaying(); bool IsPlaying();
/// @brief Get first audio frame in playback range
/// @return Audio frame index
///
/// Returns 0 if playback is stopped or there is no playback thread
int64_t GetStartPosition();
/// @brief Get playback end position /// @brief Get playback end position
/// @return Audio frame index /// @return Audio frame index
/// ///
@ -98,18 +92,8 @@ public:
/// @param pos New end position /// @param pos New end position
void SetEndPosition(int64_t pos); void SetEndPosition(int64_t pos);
/// @brief Seek playback to new position
/// @param pos New position to seek to
///
/// This is done by simply restarting playback
void SetCurrentPosition(int64_t pos);
/// @brief Change playback volume /// @brief Change playback volume
/// @param vol Amplification factor /// @param vol Amplification factor
void SetVolume(double vol); void SetVolume(double vol);
/// @brief Get playback volume
/// @return Amplification factor
double GetVolume();
}; };
#endif #endif

View File

@ -214,11 +214,6 @@ void OpenALPlayer::SetEndPosition(int64_t pos)
end_frame = pos; end_frame = pos;
} }
void OpenALPlayer::SetCurrentPosition(int64_t pos)
{
cur_frame = pos;
}
int64_t OpenALPlayer::GetCurrentPosition() int64_t OpenALPlayer::GetCurrentPosition()
{ {
// FIXME: this should be based on not duration played but actual sample being heard // FIXME: this should be based on not duration played but actual sample being heard

View File

@ -102,13 +102,10 @@ public:
void Stop(); void Stop();
bool IsPlaying() { return playing; } bool IsPlaying() { return playing; }
int64_t GetStartPosition() { return start_frame; }
int64_t GetEndPosition() { return end_frame; } int64_t GetEndPosition() { return end_frame; }
int64_t GetCurrentPosition(); int64_t GetCurrentPosition();
void SetEndPosition(int64_t pos); void SetEndPosition(int64_t pos);
void SetCurrentPosition(int64_t pos);
void SetVolume(double vol) { volume = vol; } void SetVolume(double vol) { volume = vol; }
double GetVolume() { return volume; }
}; };
#endif #endif

View File

@ -164,11 +164,6 @@ void OSSPlayer::SetEndPosition(int64_t pos)
} }
} }
void OSSPlayer::SetCurrentPosition(int64_t pos)
{
cur_frame = start_frame = pos;
}
int64_t OSSPlayer::GetCurrentPosition() int64_t OSSPlayer::GetCurrentPosition()
{ {
if (!playing) if (!playing)

View File

@ -105,15 +105,11 @@ public:
void Stop(); void Stop();
bool IsPlaying() { return playing; } bool IsPlaying() { return playing; }
int64_t GetStartPosition() { return start_frame; }
int64_t GetEndPosition() { return end_frame; } int64_t GetEndPosition() { return end_frame; }
void SetEndPosition(int64_t pos); void SetEndPosition(int64_t pos);
int64_t GetCurrentPosition(); int64_t GetCurrentPosition();
void SetCurrentPosition(int64_t pos);
void SetVolume(double vol) { volume = vol; } void SetVolume(double vol) { volume = vol; }
double GetVolume() { return volume; }
}; };
#endif #endif

View File

@ -112,10 +112,6 @@ public:
/// @return Status /// @return Status
bool IsPlaying(); bool IsPlaying();
/// @brief Position audio will be played from.
/// @return Start position.
int64_t GetStartPosition() { return start; }
/// @brief End position playback will stop at. /// @brief End position playback will stop at.
/// @return End position. /// @return End position.
int64_t GetEndPosition() { return end; } int64_t GetEndPosition() { return end; }
@ -127,10 +123,6 @@ public:
/// @param pos End position /// @param pos End position
void SetEndPosition(int64_t position) { end = position; } void SetEndPosition(int64_t position) { end = position; }
/// @brief Set current position of playback.
/// @param pos Current position
void SetCurrentPosition(int64_t position) { current = position; }
/// @brief Set volume level /// @brief Set volume level
/// @param vol Volume /// @param vol Volume

View File

@ -218,11 +218,6 @@ void PulseAudioPlayer::SetEndPosition(int64_t pos)
end_frame = pos; end_frame = pos;
} }
void PulseAudioPlayer::SetCurrentPosition(int64_t pos)
{
cur_frame = pos;
}
int64_t PulseAudioPlayer::GetCurrentPosition() int64_t PulseAudioPlayer::GetCurrentPosition()
{ {
if (!is_playing) return 0; if (!is_playing) return 0;

View File

@ -88,14 +88,11 @@ public:
void Stop(); void Stop();
bool IsPlaying() { return is_playing; } bool IsPlaying() { return is_playing; }
int64_t GetStartPosition() { return start_frame; }
int64_t GetEndPosition() { return end_frame; } int64_t GetEndPosition() { return end_frame; }
int64_t GetCurrentPosition(); int64_t GetCurrentPosition();
void SetEndPosition(int64_t pos); void SetEndPosition(int64_t pos);
void SetCurrentPosition(int64_t pos);
void SetVolume(double vol) { volume = vol; } void SetVolume(double vol) { volume = vol; }
double GetVolume() { return volume; }
}; };
#endif #endif

View File

@ -51,13 +51,10 @@ public:
virtual bool IsPlaying()=0; virtual bool IsPlaying()=0;
virtual void SetVolume(double volume)=0; virtual void SetVolume(double volume)=0;
virtual double GetVolume()=0;
virtual int64_t GetStartPosition()=0;
virtual int64_t GetEndPosition()=0; virtual int64_t GetEndPosition()=0;
virtual int64_t GetCurrentPosition()=0; virtual int64_t GetCurrentPosition()=0;
virtual void SetEndPosition(int64_t pos)=0; virtual void SetEndPosition(int64_t pos)=0;
virtual void SetCurrentPosition(int64_t pos)=0;
}; };
class AudioPlayerFactory : public Factory1<AudioPlayer, AudioProvider*> { class AudioPlayerFactory : public Factory1<AudioPlayer, AudioProvider*> {