Fix for FileWvIn and FileLoop classes so that files are closed unless chunking.

This commit is contained in:
Gary Scavone
2016-02-03 16:37:51 -05:00
parent f0f6668f25
commit 83b75ed339
4 changed files with 33 additions and 28 deletions

View File

@@ -95,7 +95,7 @@ class FileLoop : protected FileWvIn
corresponds to file cycles per second. The frequency can be
negative, in which case the loop is read in reverse order.
*/
void setFrequency( StkFloat frequency ) { this->setRate( file_.fileSize() * frequency / Stk::sampleRate() ); };
void setFrequency( StkFloat frequency ) { this->setRate( fileSize_ * frequency / Stk::sampleRate() ); };
//! Increment the read pointer by \e time samples, modulo file size.
void addTime( StkFloat time );

View File

@@ -89,7 +89,7 @@ public:
virtual void normalize( StkFloat peak );
//! Return the file size in sample frames.
virtual unsigned long getSize( void ) const { return file_.fileSize(); };
virtual unsigned long getSize( void ) const { return fileSize_; };
//! Return the input file sample rate in Hz (not the data read rate).
/*!
@@ -171,6 +171,7 @@ protected:
bool chunking_;
StkFloat time_;
StkFloat rate_;
unsigned long fileSize_;
unsigned long chunkThreshold_;
unsigned long chunkSize_;
long chunkPointer_;