Remove pointless duplicated member variable in OSSPlayer and document a few of the members

Originally committed to SVN as r6225.
This commit is contained in:
Thomas Goyne 2012-01-08 01:33:55 +00:00
parent 02fa5bee3e
commit 81a99ae27b
2 changed files with 29 additions and 98 deletions

View File

@ -52,9 +52,6 @@
DEFINE_SIMPLE_EXCEPTION(OSSError, agi::AudioPlayerOpenError, "audio/player/open/oss")
/// @brief Constructor
///
OSSPlayer::OSSPlayer()
{
volume = 1.0f;
@ -65,21 +62,15 @@ OSSPlayer::OSSPlayer()
thread = 0;
}
/// @brief Destructor
///
OSSPlayer::~OSSPlayer()
{
CloseStream();
}
/// @brief Open stream
///
void OSSPlayer::OpenStream()
{
CloseStream();
// Get provider
provider = GetProvider();
bpf = provider->GetChannels() * provider->GetBytesPerSample();
// Open device
@ -128,9 +119,6 @@ void OSSPlayer::OpenStream()
open = true;
}
/// @brief Close stream
/// @return
///
void OSSPlayer::CloseStream()
{
if (!open) return;
@ -142,10 +130,6 @@ void OSSPlayer::CloseStream()
open = false;
}
/// @brief Play
/// @param start
/// @param count
///
void OSSPlayer::Play(int64_t start, int64_t count)
{
Stop();
@ -162,10 +146,6 @@ void OSSPlayer::Play(int64_t start, int64_t count)
playing = true;
}
/// @brief Stop
/// @param timerToo
/// @return
///
void OSSPlayer::Stop(bool timerToo)
{
if (!open) return;
@ -195,17 +175,6 @@ void OSSPlayer::Stop(bool timerToo)
}
}
/// @brief DOCME
/// @return
///
bool OSSPlayer::IsPlaying()
{
return playing;
}
/// @brief Set end
/// @param pos
///
void OSSPlayer::SetEndPosition(int64_t pos)
{
end_frame = pos;
@ -215,36 +184,13 @@ void OSSPlayer::SetEndPosition(int64_t pos)
if (thread && thread->IsAlive())
thread->Delete();
}
}
/// @brief Set current position
/// @param pos
///
void OSSPlayer::SetCurrentPosition(int64_t pos)
{
cur_frame = start_frame = pos;
}
/// @brief DOCME
/// @return
///
int64_t OSSPlayer::GetStartPosition()
{
return start_frame;
}
/// @brief DOCME
/// @return
///
int64_t OSSPlayer::GetEndPosition()
{
return end_frame;
}
/// @brief Get current position
/// @return
///
int64_t OSSPlayer::GetCurrentPosition()
{
if (!playing)
@ -290,17 +236,12 @@ int64_t OSSPlayer::GetCurrentPosition()
return cur_frame;
}
/// @brief Thread constructor
/// @param par
///
OSSPlayerThread::OSSPlayerThread(OSSPlayer *par) : wxThread(wxTHREAD_JOINABLE)
OSSPlayerThread::OSSPlayerThread(OSSPlayer *par)
: wxThread(wxTHREAD_JOINABLE)
, parent(par)
{
parent = par;
}
/// @brief Thread entry point
/// @return
///
wxThread::ExitCode OSSPlayerThread::Entry() {
// Use small enough writes for good timing accuracy with all
// timing methods.
@ -317,7 +258,7 @@ wxThread::ExitCode OSSPlayerThread::Entry() {
free(buf);
parent->cur_frame = parent->end_frame;
LOG_D("player/audio/oss") << "Thread dead";
LOG_D("player/audio/oss") << "Thread dead";
return 0;
}

View File

@ -55,18 +55,17 @@ class OSSPlayer;
/// DOCME
/// @class OSSPlayerThread
/// @brief DOCME
///
/// DOCME
/// @brief Worker thread to asynchronously write audio data to the output device
class OSSPlayerThread : public wxThread {
private:
/// DOCME
/// Parent player
OSSPlayer *parent;
public:
/// Constructor
/// @param parent Player to get audio data and playback state from
OSSPlayerThread(OSSPlayer *parent);
/// Main thread entry point
wxThread::ExitCode Entry();
};
@ -76,37 +75,34 @@ public:
///
/// DOCME
class OSSPlayer : public AudioPlayer {
private:
friend class OSSPlayerThread;
/// DOCME
/// Is the output file handle initialized and ready to be written to?
bool open;
/// DOCME
unsigned int rate; // sample rate of audio
/// sample rate of audio
unsigned int rate;
/// Worker thread that does the actual writing
OSSPlayerThread *thread;
/// DOCME
AudioProvider *provider;
/// DOCME
/// Is the player currently playing?
volatile bool playing;
/// DOCME
/// Current volume level
volatile float volume;
/// DOCME
volatile unsigned long start_frame; // first frame of playback
/// first frame of playback
volatile unsigned long start_frame;
/// DOCME
volatile unsigned long cur_frame; // last written frame + 1
/// last written frame + 1
volatile unsigned long cur_frame;
/// DOCME
volatile unsigned long end_frame; // last frame to play
/// last frame to play
volatile unsigned long end_frame;
/// DOCME
unsigned long bpf; // bytes per frame
/// bytes per frame
unsigned long bpf;
// OSS audio device handle
volatile int dspdev;
@ -120,23 +116,17 @@ public:
void Play(int64_t start, int64_t count);
void Stop(bool timerToo=true);
bool IsPlaying();
bool IsPlaying() { return playing; }
int64_t GetStartPosition();
int64_t GetEndPosition();
int64_t GetCurrentPosition();
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);
/// @brief DOCME
/// @param vol
/// @return
///
void SetVolume(double vol) { volume = vol; }
/// @brief DOCME
/// @return
///
double GetVolume() { return volume; }
};
#endif