From 09955287c7d444e00b9aa0948abee58560b3d1a6 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Mon, 13 Aug 2007 15:37:23 +0000 Subject: added stop function blocking while connecting git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@85 90c681e8-e032-0410-971d-27865f9a5e38 --- lib/soundcore.cpp | 7 +++++++ lib/soundcore.h | 1 + 2 files changed, 8 insertions(+) (limited to 'lib') diff --git a/lib/soundcore.cpp b/lib/soundcore.cpp index 69424bb70..2ccef2ed7 100644 --- a/lib/soundcore.cpp +++ b/lib/soundcore.cpp @@ -37,6 +37,7 @@ SoundCore::SoundCore(QObject *parent) m_paused = FALSE; m_useEQ = FALSE; m_update = FALSE; + m_block = FALSE; m_preamp = 0; m_vis = 0; for (int i = 1; i < 10; ++i) @@ -104,12 +105,14 @@ bool SoundCore::play(const QString &source) if (! m_decoder) { + m_block = TRUE; qDebug ("SoundCore: creating decoder"); m_decoder = Decoder::create(this, source, m_input, m_output); if (! m_decoder) { qWarning("SoundCore: unsupported fileformat"); + m_block = FALSE; stop(); emit decoderStateChanged(DecoderState(DecoderState::Error)); return FALSE; @@ -128,9 +131,11 @@ bool SoundCore::play(const QString &source) m_output->start(); m_decoder->start(); m_error = NoError; + m_block = FALSE; return TRUE; } stop(); + m_block = FALSE; return FALSE; } @@ -141,6 +146,8 @@ uint SoundCore::error() void SoundCore::stop() { + if(m_block) + return; m_paused = FALSE; if (m_decoder && m_decoder->isRunning()) { diff --git a/lib/soundcore.h b/lib/soundcore.h index 1f88fe691..7e9d7369f 100644 --- a/lib/soundcore.h +++ b/lib/soundcore.h @@ -158,6 +158,7 @@ private: bool m_paused; bool m_useEQ; bool m_update; + bool m_block; int m_preamp; int m_bands[10]; Visualization *m_vis; -- cgit v1.2.3-13-gbd6f