- better looping sound

This commit is contained in:
Simon Morris
2014-03-17 13:56:46 +00:00
parent 1e77247b38
commit 80c8bf76df

View File

@@ -1009,13 +1009,13 @@ namespace lime
if (active && !playing()) if (active && !playing())
alSourcePlay(source); alSourcePlay(source);
if (!active && mLoops > 0) /*if (!active && mLoops > 0)
{ {
mLoops --; mLoops --;
double seek = mStartTime * 0.001; double seek = mStartTime * 0.001;
ov_time_seek(oggStream, seek); ov_time_seek(oggStream, seek);
return update(); return update();
} }*/
return active; return active;
@@ -1037,7 +1037,13 @@ namespace lime
size += result; size += result;
else else
if(result < 0) { if(result < 0) {
if ( mLoops > 0 ) {
mLoops --;
ov_time_seek(oggStream, 0);
}else{
break; break;
}
//LOG_SOUND ("Result is less than 0"); //LOG_SOUND ("Result is less than 0");
//throw errorString(result); //throw errorString(result);
} }
@@ -1045,10 +1051,18 @@ namespace lime
break; break;
} }
if(size <= 0) { if(size <= 0) {
if ( mLoops > 0 ) {
mLoops --;
ov_time_seek(oggStream, 0);
return stream( buffer );
}else{
alSourceStop(source); alSourceStop(source);
return false; return false;
} }
}
alBufferData(buffer, format, pcm, size, vorbisInfo->rate); alBufferData(buffer, format, pcm, size, vorbisInfo->rate);
check(); check();
return true; return true;