eliminated a whole bunch of gcc warnings

This commit is contained in:
Bill Meltsner
2010-02-09 13:21:25 -05:00
parent 3ebcee1e17
commit 73aba4bdd4
11 changed files with 242 additions and 230 deletions
+72 -72
View File
@@ -1,21 +1,21 @@
/**
* Copyright (c) 2006-2010 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-2010 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 "Source.h"
@@ -33,8 +33,8 @@ namespace openal
{
Source::Source(Pool * pool, love::sound::SoundData * soundData)
: love::audio::Source(Source::TYPE_STATIC), pool(pool), pitch(1.0f),
volume(1.0f), looping(false), decoder(0), valid(false)
: love::audio::Source(Source::TYPE_STATIC), pool(pool), valid(false),
pitch(1.0f), volume(1.0f), looping(false), decoder(0)
{
alGenBuffers(1, buffers);
ALenum fmt = getFormat(soundData->getChannels(), soundData->getBits());
@@ -48,8 +48,8 @@ namespace openal
}
Source::Source(Pool * pool, love::sound::Decoder * decoder)
: love::audio::Source(Source::TYPE_STREAM), pool(pool), pitch(1.0f),
volume(1.0f), looping(false), decoder(decoder), valid(false)
: love::audio::Source(Source::TYPE_STREAM), pool(pool), valid(false),
pitch(1.0f), volume(1.0f), looping(false), decoder(decoder)
{
decoder->retain();
alGenBuffers(MAX_BUFFERS, buffers);
@@ -65,13 +65,13 @@ namespace openal
{
stop();
alDeleteBuffers((type == TYPE_STATIC) ? 1 : MAX_BUFFERS, buffers);
}
love::audio::Source * Source::copy()
{
return 0;
}
}
love::audio::Source * Source::copy()
{
return 0;
}
void Source::play()
{
valid = pool->play(this, source);
@@ -84,7 +84,7 @@ namespace openal
{
pool->stop(this);
}
void Source::pause()
{
pool->pause();
@@ -99,13 +99,13 @@ namespace openal
{
pool->rewind();
}
bool Source::isStopped() const
{
if(valid)
{
ALenum state;
alGetSourcei(source, AL_SOURCE_STATE, &state);
ALenum state;
alGetSourcei(source, AL_SOURCE_STATE, &state);
return (state == AL_STOPPED);
}
@@ -143,7 +143,7 @@ namespace openal
}
}
}
void Source::setPitch(float pitch)
{
if(valid)
@@ -151,7 +151,7 @@ namespace openal
this->pitch = pitch;
}
float Source::getPitch() const
{
if(valid)
@@ -164,7 +164,7 @@ namespace openal
// In case the Source isn't playing.
return pitch;
}
void Source::setVolume(float volume)
{
if(valid)
@@ -174,7 +174,7 @@ namespace openal
this->volume = volume;
}
float Source::getVolume() const
{
if(valid)
@@ -194,40 +194,40 @@ namespace openal
alSourcefv(source, AL_POSITION, v);
setFloatv(position, v);
}
}
void Source::getPosition(float * v) const
{
if(valid)
alGetSourcefv(source, AL_POSITION, v);
else
setFloatv(v, position);
}
}
void Source::setVelocity(float * v)
{
if(valid)
alSourcefv(source, AL_VELOCITY, v);
setFloatv(velocity, v);
}
}
void Source::getVelocity(float * v) const
{
if(valid)
alGetSourcefv(source, AL_VELOCITY, v);
else
setFloatv(v, velocity);
}
}
void Source::setDirection(float * v)
{
if(valid)
alSourcefv(source, AL_DIRECTION, v);
else
setFloatv(direction, v);
}
}
void Source::getDirection(float * v) const
{
if(valid)
@@ -236,17 +236,17 @@ namespace openal
setFloatv(v, direction);
}
void Source::setLooping(bool looping)
{
if(valid && type == TYPE_STATIC)
alSourcei(source, AL_LOOPING, looping ? AL_TRUE : AL_FALSE);
this->looping = looping;
}
bool Source::isLooping() const
{
return looping;
void Source::setLooping(bool looping)
{
if(valid && type == TYPE_STATIC)
alSourcei(source, AL_LOOPING, looping ? AL_TRUE : AL_FALSE);
this->looping = looping;
}
bool Source::isLooping() const
{
return looping;
}
void Source::playAtomic()
@@ -259,15 +259,15 @@ namespace openal
{
int usedBuffers = 0;
for(int i = 0; i < MAX_BUFFERS; i++)
{
int decoded = streamAtomic(buffers[i], decoder);
++usedBuffers;
if(decoded < decoder->getSize())
break;
}
if(usedBuffers > 0)
for(unsigned int i = 0; i < MAX_BUFFERS; i++)
{
int decoded = streamAtomic(buffers[i], decoder);
++usedBuffers;
if(decoded < decoder->getSize())
break;
}
if(usedBuffers > 0)
alSourceQueueBuffers(source, usedBuffers, buffers);
}
@@ -294,10 +294,10 @@ namespace openal
int queued = 0;
alGetSourcei(source, AL_BUFFERS_QUEUED, &queued);
while(queued--)
{
ALuint buffer;
alSourceUnqueueBuffers(source, 1, &buffer);
while(queued--)
{
ALuint buffer;
alSourceUnqueueBuffers(source, 1, &buffer);
}
}
@@ -306,7 +306,7 @@ namespace openal
rewindAtomic();
valid = false;
}
void Source::pauseAtomic()
{
if(valid)