diff --git a/aegisub/src/audio_player_portaudio.cpp b/aegisub/src/audio_player_portaudio.cpp index 17c9b0fad..352c7d145 100644 --- a/aegisub/src/audio_player_portaudio.cpp +++ b/aegisub/src/audio_player_portaudio.cpp @@ -40,7 +40,6 @@ #ifdef WITH_PORTAUDIO -/////////// // Headers #include "audio_player_portaudio.h" #include "audio_provider_manager.h" @@ -51,11 +50,6 @@ //#define PORTAUDIO_DEBUG -/// Reference counter -int PortAudioPlayer::pa_refcount = 0; - - - /// @brief Constructor PortAudioPlayer::PortAudioPlayer() { // Initialize portaudio @@ -67,17 +61,14 @@ PortAudioPlayer::PortAudioPlayer() { swprintf(errormsg, 2048, L"Failed opening PortAudio: %s", Pa_GetErrorText(err)); throw (const wchar_t *)errormsg; } - pa_refcount++; } - // Variables volume = 1.0f; pos.pa_start = 0.0; } - /// @brief Destructor PortAudioPlayer::~PortAudioPlayer() { // Deinit portaudio @@ -85,7 +76,6 @@ PortAudioPlayer::~PortAudioPlayer() { } - /// @brief Open stream void PortAudioPlayer::OpenStream() { // Open stream @@ -124,7 +114,6 @@ void PortAudioPlayer::OpenStream() { } - /// @brief Close stream void PortAudioPlayer::CloseStream() { Stop(false); @@ -145,7 +134,6 @@ void PortAudioPlayer::paStreamFinishedCallback(void *userData) { } - /// @brief Play audio. /// @param start Start position. /// @param count Frame count @@ -163,13 +151,14 @@ void PortAudioPlayer::Play(int64_t start,int64_t count) { err = Pa_SetStreamFinishedCallback(stream, paStreamFinishedCallback); if (err != paNoError) { - wxLogDebug(_T("PortAudioPlayer::Play Could not set FinishedCallback\n")); + wxLogDebug(_T("PortAudioPlayer::Play Could not set FinishedCallback.\n")); return; } err = Pa_StartStream(stream); if (err != paNoError) { + wxLogDebug(_T("PortAudioPlayer::Play Error playing stream.\n")); return; } } @@ -180,7 +169,6 @@ void PortAudioPlayer::Play(int64_t start,int64_t count) { } - /// @brief Stop Playback /// @param timerToo Stop display timer? /// @@ -195,8 +183,7 @@ void PortAudioPlayer::Stop(bool timerToo) { } - -/// @brief PortAudio callback +/// @brief PortAudio callback, used to fill buffer for playback, and prime the playback buffer. /// @param inputBuffer Input buffer. /// @param outputBuffer Output buffer. /// @param framesPerBuffer Frames per buffer. @@ -226,7 +213,6 @@ int PortAudioPlayer::paCallback( // Calculate how much left int64_t lenAvailable = (player->pos.end - player->pos.current) > 0 ? framesPerBuffer : 0; - // Play something if (lenAvailable > 0) { provider->GetAudioWithVolume(outputBuffer, player->pos.current, lenAvailable, player->GetVolume()); @@ -267,7 +253,6 @@ int64_t PortAudioPlayer::GetCurrentPosition() } - /// @brief Get list of available output devices /// @param favorite Favorite output device /// @return List of available output devices with the 'favorite' being first in the list. diff --git a/aegisub/src/audio_player_portaudio.h b/aegisub/src/audio_player_portaudio.h index 78ee6824a..247558787 100644 --- a/aegisub/src/audio_player_portaudio.h +++ b/aegisub/src/audio_player_portaudio.h @@ -68,6 +68,7 @@ private: }; PositionInfo pos; + /// PortAudio stream. void *stream; static int paCallback( @@ -82,6 +83,9 @@ private: static void paStreamFinishedCallback(void *userData); + /// Reference counter + int PortAudioPlayer::pa_refcount = 0; + public: PortAudioPlayer(); ~PortAudioPlayer();