Update of /cvsroot/alpp/openalpp/src
In directory sc8-pr-cvs1:/tmp/cvs-serv27441
Modified Files:
filestream.cpp filestreamupdater.cpp
Log Message:
Added support for looping file streams.
Index: filestream.cpp
===================================================================
RCS file: /cvsroot/alpp/openalpp/src/filestream.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** filestream.cpp 16 Apr 2003 11:15:04 -0000 1.4
--- filestream.cpp 23 May 2003 14:47:10 -0000 1.5
***************
*** 82,84 ****
--- 82,88 ----
}
+ void FileStream::SetLooping(bool loop) {
+ ((FileStreamUpdater *)updater_)->SetLooping(loop);
+ }
+
}
Index: filestreamupdater.cpp
===================================================================
RCS file: /cvsroot/alpp/openalpp/src/filestreamupdater.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** filestreamupdater.cpp 15 Feb 2003 02:32:31 -0000 1.1
--- filestreamupdater.cpp 23 May 2003 14:47:10 -0000 1.2
***************
*** 51,57 ****
int stream;
while(count<buffersize_) {
! unsigned int amt=ov_read(oggfile_,&((char *)buffer)[count],
! buffersize_-count,
! 0,2,1,&stream);
if(amt<=0)
break;
--- 51,70 ----
int stream;
while(count<buffersize_) {
! unsigned int amt;
! do {
! amt=ov_read(oggfile_,&((char *)buffer)[count],
! buffersize_-count,
! 0,2,1,&stream);
! if(looping_ && amt==0) {
! if(!ov_seekable(oggfile_))
! break;
! if(!ov_time_seek(oggfile_,0.0))
! break;
! }
! } while(looping_ && amt==0);
! // We must break if:
! // * An error occurred
! // * We hit EOF and the file was not looping
! // * We hit EOF and the file was looping, but we couldn't loop...
if(amt<=0)
break;
***************
*** 67,70 ****
--- 80,87 ----
runmutex_.leaveMutex();
delete []buffer;
+ }
+
+ void FileStreamUpdater::SetLooping(bool loop) {
+ looping_=loop;
}
|