Add small fix to allow audio files that are shorter then 1 second to be played.
This commit is contained in:
parent
9cac8153da
commit
deeecd0624
|
@ -257,25 +257,32 @@ namespace cAudio
|
|||
void cAudio::play()
|
||||
{
|
||||
playaudio = true;
|
||||
|
||||
if(!paused()){
|
||||
|
||||
if (!stream(buffers[0]))
|
||||
return;
|
||||
|
||||
if (!stream(buffers[1]))
|
||||
return;
|
||||
|
||||
if (!stream(buffers[2]))
|
||||
return;
|
||||
//Stores the sources 3 buffers to be used in the queue
|
||||
alSourceQueueBuffers(source, 3, buffers);
|
||||
}
|
||||
|
||||
alSourcePlay(source);
|
||||
|
||||
if (!this->isPaused())
|
||||
{
|
||||
int queueSize = 0;
|
||||
|
||||
for(int u = 0; u < 3; u++)
|
||||
{
|
||||
int val = this->stream(buffers[u]);
|
||||
|
||||
if(val < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(val > 0)
|
||||
++queueSize;
|
||||
}
|
||||
|
||||
//Stores the sources 3 buffers to be used in the queue
|
||||
alSourceQueueBuffers(source, queueSize, buffers);
|
||||
}
|
||||
|
||||
alSourcePlay(source);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//!Used to stop the audio source
|
||||
void cAudio::stop()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue