mirror of https://github.com/odrling/Aegisub
Remove some unused AudioPlayer methods
This commit is contained in:
parent
703b1fc3a7
commit
04435a13a3
|
@ -319,15 +319,6 @@ int AudioController::GetDuration() const
|
|||
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
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (!IsAudioOpen()) return;
|
||||
|
|
|
@ -218,25 +218,10 @@ public:
|
|||
/// @return Duration in milliseconds
|
||||
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
|
||||
/// @return An immutable TimeRange object
|
||||
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
|
||||
/// @param volume The new amplification factor for the audio
|
||||
void SetVolume(double volume);
|
||||
|
|
|
@ -422,26 +422,6 @@ void AlsaPlayer::SetEndPosition(int64_t 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()
|
||||
{
|
||||
PthreadMutexLocker ml(ps->mutex);
|
||||
|
@ -485,11 +465,4 @@ void AlsaPlayer::SetVolume(double vol)
|
|||
pthread_cond_signal(&ps->cond);
|
||||
}
|
||||
|
||||
|
||||
double AlsaPlayer::GetVolume()
|
||||
{
|
||||
PthreadMutexLocker ml(ps->mutex);
|
||||
return ps->volume;
|
||||
}
|
||||
|
||||
#endif // WITH_ALSA
|
||||
|
|
|
@ -59,7 +59,6 @@ public:
|
|||
void SetCurrentPosition(int64_t pos);
|
||||
|
||||
void SetVolume(double vol);
|
||||
double GetVolume();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -277,14 +277,6 @@ void DirectSoundPlayer::SetEndPosition(int64_t 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
|
||||
/// @return
|
||||
///
|
||||
|
|
|
@ -83,13 +83,10 @@ public:
|
|||
|
||||
bool IsPlaying() { return playing; }
|
||||
|
||||
int64_t GetStartPosition() { return startPos; }
|
||||
int64_t GetEndPosition() { return endPos; }
|
||||
int64_t GetCurrentPosition();
|
||||
void SetEndPosition(int64_t pos);
|
||||
void SetCurrentPosition(int64_t pos);
|
||||
|
||||
void SetVolume(double vol) { volume = vol; }
|
||||
double GetVolume() { return volume; }
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -242,10 +242,6 @@ public:
|
|||
/// @return True if audio is being played back, false if it is not
|
||||
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
|
||||
/// @return Audio frame index
|
||||
///
|
||||
|
@ -256,10 +252,6 @@ public:
|
|||
/// @return Audio frame index
|
||||
int64_t GetEndFrame();
|
||||
|
||||
/// @brief Get current playback volume
|
||||
/// @return Audio amplification factor
|
||||
double GetVolume();
|
||||
|
||||
/// @brief Tell whether playback thread has died
|
||||
/// @return True if thread is no longer running
|
||||
bool IsDead();
|
||||
|
@ -755,13 +747,6 @@ bool DirectSoundPlayer2Thread::IsPlaying()
|
|||
}
|
||||
}
|
||||
|
||||
int64_t DirectSoundPlayer2Thread::GetStartFrame()
|
||||
{
|
||||
CheckError();
|
||||
|
||||
return start_frame;
|
||||
}
|
||||
|
||||
int64_t DirectSoundPlayer2Thread::GetCurrentFrame()
|
||||
{
|
||||
CheckError();
|
||||
|
@ -780,13 +765,6 @@ int64_t DirectSoundPlayer2Thread::GetEndFrame()
|
|||
return end_frame;
|
||||
}
|
||||
|
||||
double DirectSoundPlayer2Thread::GetVolume()
|
||||
{
|
||||
CheckError();
|
||||
|
||||
return volume;
|
||||
}
|
||||
|
||||
bool DirectSoundPlayer2Thread::IsDead()
|
||||
{
|
||||
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()
|
||||
{
|
||||
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)
|
||||
{
|
||||
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
|
||||
|
|
|
@ -77,12 +77,6 @@ public:
|
|||
/// @return True if audio is playing back
|
||||
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
|
||||
/// @return Audio frame index
|
||||
///
|
||||
|
@ -98,18 +92,8 @@ public:
|
|||
/// @param pos New end position
|
||||
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
|
||||
/// @param vol Amplification factor
|
||||
void SetVolume(double vol);
|
||||
|
||||
/// @brief Get playback volume
|
||||
/// @return Amplification factor
|
||||
double GetVolume();
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -214,11 +214,6 @@ void OpenALPlayer::SetEndPosition(int64_t pos)
|
|||
end_frame = pos;
|
||||
}
|
||||
|
||||
void OpenALPlayer::SetCurrentPosition(int64_t pos)
|
||||
{
|
||||
cur_frame = pos;
|
||||
}
|
||||
|
||||
int64_t OpenALPlayer::GetCurrentPosition()
|
||||
{
|
||||
// FIXME: this should be based on not duration played but actual sample being heard
|
||||
|
|
|
@ -102,13 +102,10 @@ public:
|
|||
void Stop();
|
||||
bool IsPlaying() { return playing; }
|
||||
|
||||
int64_t GetStartPosition() { return start_frame; }
|
||||
int64_t GetEndPosition() { return end_frame; }
|
||||
int64_t GetCurrentPosition();
|
||||
void SetEndPosition(int64_t pos);
|
||||
void SetCurrentPosition(int64_t pos);
|
||||
|
||||
void SetVolume(double vol) { volume = vol; }
|
||||
double GetVolume() { return volume; }
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
if (!playing)
|
||||
|
|
|
@ -105,15 +105,11 @@ public:
|
|||
void Stop();
|
||||
bool IsPlaying() { return playing; }
|
||||
|
||||
int64_t GetStartPosition() { return start_frame; }
|
||||
|
||||
int64_t GetEndPosition() { return end_frame; }
|
||||
void SetEndPosition(int64_t pos);
|
||||
|
||||
int64_t GetCurrentPosition();
|
||||
void SetCurrentPosition(int64_t pos);
|
||||
|
||||
void SetVolume(double vol) { volume = vol; }
|
||||
double GetVolume() { return volume; }
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -112,10 +112,6 @@ public:
|
|||
/// @return Status
|
||||
bool IsPlaying();
|
||||
|
||||
/// @brief Position audio will be played from.
|
||||
/// @return Start position.
|
||||
int64_t GetStartPosition() { return start; }
|
||||
|
||||
/// @brief End position playback will stop at.
|
||||
/// @return End position.
|
||||
int64_t GetEndPosition() { return end; }
|
||||
|
@ -127,10 +123,6 @@ public:
|
|||
/// @param pos 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
|
||||
/// @param vol Volume
|
||||
|
|
|
@ -218,11 +218,6 @@ void PulseAudioPlayer::SetEndPosition(int64_t pos)
|
|||
end_frame = pos;
|
||||
}
|
||||
|
||||
void PulseAudioPlayer::SetCurrentPosition(int64_t pos)
|
||||
{
|
||||
cur_frame = pos;
|
||||
}
|
||||
|
||||
int64_t PulseAudioPlayer::GetCurrentPosition()
|
||||
{
|
||||
if (!is_playing) return 0;
|
||||
|
|
|
@ -88,14 +88,11 @@ public:
|
|||
void Stop();
|
||||
bool IsPlaying() { return is_playing; }
|
||||
|
||||
int64_t GetStartPosition() { return start_frame; }
|
||||
int64_t GetEndPosition() { return end_frame; }
|
||||
int64_t GetCurrentPosition();
|
||||
void SetEndPosition(int64_t pos);
|
||||
void SetCurrentPosition(int64_t pos);
|
||||
|
||||
void SetVolume(double vol) { volume = vol; }
|
||||
double GetVolume() { return volume; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -51,13 +51,10 @@ public:
|
|||
virtual bool IsPlaying()=0;
|
||||
|
||||
virtual void SetVolume(double volume)=0;
|
||||
virtual double GetVolume()=0;
|
||||
|
||||
virtual int64_t GetStartPosition()=0;
|
||||
virtual int64_t GetEndPosition()=0;
|
||||
virtual int64_t GetCurrentPosition()=0;
|
||||
virtual void SetEndPosition(int64_t pos)=0;
|
||||
virtual void SetCurrentPosition(int64_t pos)=0;
|
||||
};
|
||||
|
||||
class AudioPlayerFactory : public Factory1<AudioPlayer, AudioProvider*> {
|
||||
|
|
Loading…
Reference in New Issue