|
@@ -1,21 +1,21 @@
|
|
-/**
|
|
|
|
-* Copyright (c) 2006-2009 LOVE Development Team
|
|
|
|
-*
|
|
|
|
-* This software is provided 'as-is', without any express or implied
|
|
|
|
-* warranty. In no event will the authors be held liable for any damages
|
|
|
|
-* arising from the use of this software.
|
|
|
|
-*
|
|
|
|
-* Permission is granted to anyone to use this software for any purpose,
|
|
|
|
-* including commercial applications, and to alter it and redistribute it
|
|
|
|
-* freely, subject to the following restrictions:
|
|
|
|
-*
|
|
|
|
-* 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
-* claim that you wrote the original software. If you use this software
|
|
|
|
-* in a product, an acknowledgment in the product documentation would be
|
|
|
|
-* appreciated but is not required.
|
|
|
|
-* 2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
-* misrepresented as being the original software.
|
|
|
|
-* 3. This notice may not be removed or altered from any source distribution.
|
|
|
|
|
|
+/**
|
|
|
|
+* Copyright (c) 2006-2009 LOVE Development Team
|
|
|
|
+*
|
|
|
|
+* This software is provided 'as-is', without any express or implied
|
|
|
|
+* warranty. In no event will the authors be held liable for any damages
|
|
|
|
+* arising from the use of this software.
|
|
|
|
+*
|
|
|
|
+* Permission is granted to anyone to use this software for any purpose,
|
|
|
|
+* including commercial applications, and to alter it and redistribute it
|
|
|
|
+* freely, subject to the following restrictions:
|
|
|
|
+*
|
|
|
|
+* 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
+* claim that you wrote the original software. If you use this software
|
|
|
|
+* in a product, an acknowledgment in the product documentation would be
|
|
|
|
+* appreciated but is not required.
|
|
|
|
+* 2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
+* misrepresented as being the original software.
|
|
|
|
+* 3. This notice may not be removed or altered from any source distribution.
|
|
**/
|
|
**/
|
|
|
|
|
|
#include "Audio.h"
|
|
#include "Audio.h"
|
|
@@ -52,14 +52,14 @@ namespace openal
|
|
|
|
|
|
Audio::~Audio()
|
|
Audio::~Audio()
|
|
{
|
|
{
|
|
- SDL_KillThread(thread);
|
|
|
|
|
|
+ //SDL_KillThread(thread);
|
|
|
|
|
|
pool->stop();
|
|
pool->stop();
|
|
|
|
|
|
delete pool;
|
|
delete pool;
|
|
|
|
|
|
- alcMakeContextCurrent(0);
|
|
|
|
- alcDestroyContext(context);
|
|
|
|
|
|
+ alcMakeContextCurrent(0);
|
|
|
|
+ alcDestroyContext(context);
|
|
alcCloseDevice(device);
|
|
alcCloseDevice(device);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -85,17 +85,17 @@ namespace openal
|
|
{
|
|
{
|
|
return new Sound(pool, data);
|
|
return new Sound(pool, data);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
love::audio::Music * Audio::newMusic(love::sound::Decoder * decoder)
|
|
love::audio::Music * Audio::newMusic(love::sound::Decoder * decoder)
|
|
{
|
|
{
|
|
return new Music(pool, decoder);
|
|
return new Music(pool, decoder);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
love::audio::Source * Audio::newSource(Audible * audible)
|
|
love::audio::Source * Audio::newSource(Audible * audible)
|
|
{
|
|
{
|
|
return new Source(pool, audible);
|
|
return new Source(pool, audible);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
int Audio::getNumSources() const
|
|
int Audio::getNumSources() const
|
|
{
|
|
{
|
|
return pool->getNumSources();
|
|
return pool->getNumSources();
|
|
@@ -105,19 +105,19 @@ namespace openal
|
|
{
|
|
{
|
|
return pool->getMaxSources();
|
|
return pool->getMaxSources();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
void Audio::play(love::audio::Source * source)
|
|
void Audio::play(love::audio::Source * source)
|
|
{
|
|
{
|
|
source->play();
|
|
source->play();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
void Audio::play(love::audio::Sound * sound)
|
|
void Audio::play(love::audio::Sound * sound)
|
|
{
|
|
{
|
|
Source * source = new Source(pool, sound);
|
|
Source * source = new Source(pool, sound);
|
|
play(source);
|
|
play(source);
|
|
source->release();
|
|
source->release();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
void Audio::play(love::audio::Music * music)
|
|
void Audio::play(love::audio::Music * music)
|
|
{
|
|
{
|
|
Source * source = new Source(pool, music->clone());
|
|
Source * source = new Source(pool, music->clone());
|
|
@@ -129,17 +129,17 @@ namespace openal
|
|
{
|
|
{
|
|
source->stop();
|
|
source->stop();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
void Audio::stop()
|
|
void Audio::stop()
|
|
{
|
|
{
|
|
pool->stop();
|
|
pool->stop();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
void Audio::pause(love::audio::Source * source)
|
|
void Audio::pause(love::audio::Source * source)
|
|
{
|
|
{
|
|
source->pause();
|
|
source->pause();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
void Audio::pause()
|
|
void Audio::pause()
|
|
{
|
|
{
|
|
pool->pause();
|
|
pool->pause();
|
|
@@ -154,26 +154,26 @@ namespace openal
|
|
{
|
|
{
|
|
pool->resume();
|
|
pool->resume();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
void Audio::rewind(love::audio::Source * source)
|
|
void Audio::rewind(love::audio::Source * source)
|
|
{
|
|
{
|
|
source->rewind();
|
|
source->rewind();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
void Audio::rewind()
|
|
void Audio::rewind()
|
|
{
|
|
{
|
|
pool->rewind();
|
|
pool->rewind();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
void Audio::setVolume(float volume)
|
|
void Audio::setVolume(float volume)
|
|
{
|
|
{
|
|
alListenerf(AL_GAIN, volume);
|
|
alListenerf(AL_GAIN, volume);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
float Audio::getVolume() const
|
|
float Audio::getVolume() const
|
|
{
|
|
{
|
|
- ALfloat volume;
|
|
|
|
- alGetListenerf(AL_GAIN, &volume);
|
|
|
|
|
|
+ ALfloat volume;
|
|
|
|
+ alGetListenerf(AL_GAIN, &volume);
|
|
return volume;
|
|
return volume;
|
|
}
|
|
}
|
|
|
|
|