fixed several bugs responsible for clicks and pops

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@488 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2007-07-16 19:33:25 +00:00
parent 2fbc06338c
commit b6b10ddc36
5 changed files with 71 additions and 10 deletions

View File

@@ -33,6 +33,7 @@
#include "note.h"
#include "instrument.h"
#include "instrument_track.h"
#include "engine.h"
class notePlayHandle;
@@ -70,6 +71,55 @@ public:
m_releaseFramesDone >= m_releaseFramesToDo ) );
}
bool willFinishThisPeriod( void ) const
{
f_cnt_t rftd = m_releaseFramesToDo;
f_cnt_t fbr = m_framesBeforeRelease;
f_cnt_t rfd = m_releaseFramesDone;
if( m_released == TRUE )
{
f_cnt_t todo = engine::getMixer()->framesPerAudioBuffer();
if( arpBaseNote() == TRUE )
{
rftd = rfd + 2 *
engine::getMixer()->framesPerAudioBuffer();
}
if( fbr )
{
if( fbr <=
engine::getMixer()->framesPerAudioBuffer() )
{
todo -= fbr;
fbr = 0;
}
else
{
todo = 0;
fbr -=
engine::getMixer()->framesPerAudioBuffer();
}
}
if( todo && rfd < rftd )
{
if( rftd - rfd >= todo )
{
rfd += todo;
}
else
{
rfd = rftd;
}
}
}
if( arpBaseNote() == TRUE && m_subNotes.size() == 0 )
{
rfd = rftd;
}
return( ( m_released && fbr == 0 && rfd >= rftd ) );
}
virtual bool isFromTrack( const track * _track ) const;
@@ -87,6 +137,7 @@ public:
f_cnt_t actualReleaseFramesToDo( void ) const;
// returns how many samples this note is aligned ahead, i.e.
// at which position it is inserted in the according buffer
inline f_cnt_t framesAhead( void ) const