summaryrefslogtreecommitdiffstats
path: root/src/sound/oalsound/channel.cpp
diff options
context:
space:
mode:
authorerihel <erihel@gmail.com>2013-01-16 01:45:38 +0100
committererihel <erihel@gmail.com>2013-01-16 01:45:38 +0100
commit9f75a29e88da36edc301fc35f70d260a7b4e660d (patch)
treebd0875815df502462b8bef2ba42344632e251af6 /src/sound/oalsound/channel.cpp
parent01c39c88f67a924e6f067efdb16a750f8e19ea92 (diff)
downloadcolobot-9f75a29e88da36edc301fc35f70d260a7b4e660d.tar.gz
colobot-9f75a29e88da36edc301fc35f70d260a7b4e660d.tar.bz2
colobot-9f75a29e88da36edc301fc35f70d260a7b4e660d.zip
* Fixed sound pitch causing segfault
* Sound support should now compile fine with MXE * Added cache for 3 music files to speedup loading * Updated howto
Diffstat (limited to 'src/sound/oalsound/channel.cpp')
-rw-r--r--src/sound/oalsound/channel.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sound/oalsound/channel.cpp b/src/sound/oalsound/channel.cpp
index 83420ea..2b9af9b 100644
--- a/src/sound/oalsound/channel.cpp
+++ b/src/sound/oalsound/channel.cpp
@@ -54,7 +54,7 @@ Channel::~Channel() {
bool Channel::Play() {
if (!mReady || mBuffer == nullptr)
return false;
-
+
alSourcei(mSource, AL_LOOPING, static_cast<ALint>(mLoop));
alSourcePlay(mSource);
if (alCheck())
@@ -223,7 +223,8 @@ Sound Channel::GetSoundType() {
bool Channel::SetBuffer(Buffer *buffer) {
if (!mReady)
return false;
-
+
+ Stop();
mBuffer = buffer;
if (buffer == nullptr) {
alSourcei(mSource, AL_BUFFER, 0);
@@ -276,7 +277,7 @@ bool Channel::IsReady() {
}
bool Channel::IsLoaded() {
- return mBuffer == nullptr;
+ return mBuffer != nullptr;
}