Added looping in love.audio (though needs implementation in love.sound).

This commit is contained in:
rude
2009-08-01 22:11:48 +02:00
parent c1ed4372d9
commit 524ef5e118
14 changed files with 87 additions and 20 deletions
+7 -3
View File
@@ -55,7 +55,7 @@ namespace openal
{
for(int i = 0; i < NUM_BUFFERS; i++)
{
if(!stream(buffers[i]))
if(!stream(s, buffers[i]))
{
std::cout << "Could not stream music." << std::endl;
return;
@@ -82,7 +82,7 @@ namespace openal
// Get a free buffer.
alSourceUnqueueBuffers(source, 1, &buffer);
if(stream(buffer))
if(stream(s, buffer))
alSourceQueueBuffers(source, 1, &buffer);
}
}
@@ -111,8 +111,11 @@ namespace openal
play(s);
}
bool Music::stream(ALuint buffer)
bool Music::stream(love::audio::Source * source, ALuint buffer)
{
if(source->isLooping() && decoder->isFinished())
decoder->rewind();
// Get more sound data.
int decoded = decoder->decode();
@@ -131,6 +134,7 @@ namespace openal
return false;
}
} // openal
} // audio
} // love