improved support for monophonic instruments

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@453 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2007-01-21 19:33:13 +00:00
parent 56eead9a65
commit c19f8df329
3 changed files with 35 additions and 14 deletions

View File

@@ -1,3 +1,11 @@
2007-01-21 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* src/core/note_play_handle.cpp:
removed obsolete support for monophonic instruments
* src/tracks/instrument_track.cpp:
added new code for better support of monophonic instrument
2007-01-20 Javier Serrano Polo <jasp00/at/terra/dot/es>
* plugins/singerbot/artwork.png:

View File

@@ -63,20 +63,6 @@ notePlayHandle::notePlayHandle( instrumentTrack * _it,
, m_patternIndex( 0 )
#endif
{
// if the instrument is monophonic we do not allow other note-play-
// handles to exist for this track and therefore remove them
if( m_instrumentTrack->getInstrument()->isMonophonic() )
{
constNotePlayHandleVector cphv = nphsOfInstrumentTrack(
m_instrumentTrack );
for( constNotePlayHandleVector::iterator it = cphv.begin();
it != cphv.end(); ++it )
{
m_instrumentTrack->eng()->getMixer()->
removePlayHandle( *it );
}
}
setDetuning( _n.detuning() );
if( detuning() )
{

View File

@@ -757,6 +757,33 @@ void instrumentTrack::playNote( notePlayHandle * _n, bool _try_parallelizing )
if( _n->arpBaseNote() == FALSE && m_instrument != NULL )
{
if( m_instrument->isMonophonic() )
{
constNotePlayHandleVector v =
notePlayHandle::nphsOfInstrumentTrack( this,
TRUE );
if( v.size() > 1 )
{
constNotePlayHandleVector::iterator
youngest_note = v.begin();
for( constNotePlayHandleVector::iterator it =
v.begin(); it != v.end(); ++it )
{
if( !( *it )->arpBaseNote() && ( *it )->totalFramesPlayed() <=
( *youngest_note )->
totalFramesPlayed() )
{
youngest_note = it;
}
}
if( *youngest_note != _n && !( *youngest_note )->arpBaseNote() )
{
processInEvent( midiEvent( NOTE_OFF, 0,
_n->key(), 0 ), midiTime() );
return;
}
}
}
// all is done, so now lets play the note!
m_instrument->playNote( _n, _try_parallelizing );
}