mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
ADSR fix for decay/release time calculations; FileRead variable size fixes and argument check.
This commit is contained in:
@@ -149,8 +149,8 @@ void ADSR :: setReleaseTime( StkFloat time )
|
||||
void ADSR :: setAllTimes( StkFloat aTime, StkFloat dTime, StkFloat sLevel, StkFloat rTime )
|
||||
{
|
||||
this->setAttackTime( aTime );
|
||||
this->setDecayTime( dTime );
|
||||
this->setSustainLevel( sLevel );
|
||||
this->setDecayTime( dTime );
|
||||
this->setReleaseTime( rTime );
|
||||
}
|
||||
|
||||
|
||||
@@ -571,7 +571,7 @@ bool FileRead :: getMatInfo( const char *fileName )
|
||||
|
||||
bool doneParsing, haveData, haveSampleRate;
|
||||
SINT32 chunkSize, rows, columns, nametype;
|
||||
int dataoffset;
|
||||
long dataoffset;
|
||||
doneParsing = false;
|
||||
haveData = false;
|
||||
haveSampleRate = false;
|
||||
@@ -734,7 +734,7 @@ void FileRead :: read( StkFrames& buffer, unsigned long startFrame, bool doNorma
|
||||
}
|
||||
|
||||
// Check the buffer size.
|
||||
unsigned int nFrames = buffer.frames();
|
||||
unsigned long nFrames = buffer.frames();
|
||||
if ( nFrames == 0 ) {
|
||||
oStream_ << "FileRead::read: StkFrames buffer size is zero ... no data read!";
|
||||
Stk::handleError( StkError::WARNING ); return;
|
||||
@@ -745,8 +745,13 @@ void FileRead :: read( StkFrames& buffer, unsigned long startFrame, bool doNorma
|
||||
Stk::handleError( StkError::FUNCTION_ARGUMENT );
|
||||
}
|
||||
|
||||
if ( startFrame >= fileSize_ ) {
|
||||
oStream_ << "FileRead::read: startFrame argument is greater than or equal to the file size!";
|
||||
Stk::handleError( StkError::FUNCTION_ARGUMENT );
|
||||
}
|
||||
|
||||
// Check for file end.
|
||||
if ( startFrame + nFrames >= fileSize_ )
|
||||
if ( startFrame + nFrames > fileSize_ )
|
||||
nFrames = fileSize_ - startFrame;
|
||||
|
||||
long i, nSamples = (long) ( nFrames * channels_ );
|
||||
|
||||
Reference in New Issue
Block a user