From 4990d8255c24ded6502924a2251f73a4d9e0daf1 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 8 Jan 2012 01:04:44 +0000 Subject: [PATCH] Don't bother refcounting portaudio initializations as portaudio does that internally Originally committed to SVN as r6206. --- aegisub/src/audio_player_portaudio.cpp | 16 ++++------------ aegisub/src/audio_player_portaudio.h | 3 --- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/aegisub/src/audio_player_portaudio.cpp b/aegisub/src/audio_player_portaudio.cpp index ed4cb6de5..4ce66e736 100644 --- a/aegisub/src/audio_player_portaudio.cpp +++ b/aegisub/src/audio_player_portaudio.cpp @@ -50,26 +50,18 @@ // Uncomment to enable extremely spammy debug logging //#define PORTAUDIO_DEBUG -// Init reference counter -int PortAudioPlayer::pa_refcount = 0; - PortAudioPlayer::PortAudioPlayer() { - // Initialize portaudio - if (!pa_refcount) { - PaError err = Pa_Initialize(); + PaError err = Pa_Initialize(); - if (err != paNoError) - throw PortAudioError(std::string("Failed opening PortAudio:") + Pa_GetErrorText(err)); - } - pa_refcount++; + if (err != paNoError) + throw PortAudioError(std::string("Failed opening PortAudio:") + Pa_GetErrorText(err)); volume = 1.0f; pa_start = 0.0; } PortAudioPlayer::~PortAudioPlayer() { - // Deinit portaudio - if (!--pa_refcount) Pa_Terminate(); + Pa_Terminate(); } void PortAudioPlayer::OpenStream() { diff --git a/aegisub/src/audio_player_portaudio.h b/aegisub/src/audio_player_portaudio.h index 4a63fc30c..7bac865ec 100644 --- a/aegisub/src/audio_player_portaudio.h +++ b/aegisub/src/audio_player_portaudio.h @@ -51,9 +51,6 @@ DEFINE_SIMPLE_EXCEPTION_NOINNER(PortAudioError, agi::Exception, "audio/player/po /// @brief PortAudio Player /// class PortAudioPlayer : public AudioPlayer { - /// PortAudio initilisation reference counter - static int pa_refcount; - float volume; ///< Current volume level int64_t current; ///< Current position int64_t start; ///< Start position