[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdegames
From: Stefan Majewsky <majewsky () gmx ! net>
Date: 2012-02-15 18:49:56
Message-ID: 20120215184956.31198AC894 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1280235 by majewsky:
TagaroAudio bugfix for mute sound after playing 256 times the same sound source
Original patch by Mathias Kraus (SVN revision 1237315).
M +1 -1 CMakeLists.txt
M +1 -0 libkdegames/audio/kgopenalruntime_p.h
M +29 -5 libkdegames/audio/kgsound-openal.cpp
--- trunk/KDE/kdegames/CMakeLists.txt #1280234:1280235
@@ -32,7 +32,7 @@
add_definitions (-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
include_directories ( ${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} \
${KDE4_INCLUDES}) # add the includes for libkdegames and the fwd headers, available \
for all the applications
-include_directories(${CMAKE_SOURCE_DIR}/libkdegames \
${CMAKE_SOURCE_DIR}/libkdegames/includes) \
+include_directories(${CMAKE_SOURCE_DIR}/libkdegames \
${CMAKE_SOURCE_DIR}/libkdegames/audio ${CMAKE_SOURCE_DIR}/libkdegames/includes) \
set(HIGHSCORE_DIRECTORY "" CACHE STRING "Where to install system-wide highscores e.g. \
/var/games")
if(WIN32)
--- trunk/KDE/kdegames/libkdegames/audio/kgopenalruntime_p.h #1280234:1280235
@@ -38,6 +38,7 @@
//Is playback still running?
bool isRunning() const;
+ bool replay(const QPointF& pos) const;
private:
ALuint m_source;
bool m_valid;
--- trunk/KDE/kdegames/libkdegames/audio/kgsound-openal.cpp #1280234:1280235
@@ -143,19 +143,27 @@
void KgSound::start()
{
- if (d->m_valid)
- {
- new KgPlaybackEvent(this, d->m_pos);
+ start(d->m_pos);
}
-}
void KgSound::start(const QPointF& pos)
{
if (d->m_valid)
{
+ KgOpenALRuntime* runtime = KgOpenALRuntime::instance();
+ if(runtime->instance()->m_soundsEvents[this].count() > 0)
+ {
+ if(runtime->instance()->m_soundsEvents[this].last()->replay(pos) == false)
+ {
new KgPlaybackEvent(this, pos);
}
}
+ else
+ {
+ new KgPlaybackEvent(this, pos);
+ }
+ }
+}
void KgSound::stop()
{
@@ -201,7 +209,7 @@
KgPlaybackEvent::~KgPlaybackEvent()
{
- if (m_valid)
+ if(alIsSource(m_source) == AL_TRUE)
{
alSourceStop(m_source);
alDeleteSources(1, &m_source);
@@ -215,6 +223,22 @@
return state == AL_PLAYING;
}
+bool KgPlaybackEvent::replay(const QPointF& pos) const
+{
+ if(alIsSource(m_source) == AL_TRUE)
+ {
+ //FIXME: pos is not respected
+ alSourceStop(m_source);
+ alSourcePlay(m_source);
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}
+
//END KgPlaybackEvent
#include "kgsound.moc"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic