* replaced instrument::notePlayHandleBased() with instrument::isMidiBased()

* renamed bendable() to isBendable()
* if the instrument is MIDI based and instrument-track's volume is below 100, adjust velocity of MIDI events and scaling factor when mixing sound



git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1715 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-09-29 19:29:04 +00:00
parent 8a3d31464c
commit 880c322cf6
7 changed files with 37 additions and 23 deletions

View File

@@ -163,10 +163,12 @@ void notePlayHandle::setVolume( const volume _volume )
int notePlayHandle::getMidiVelocity( void ) const
{
return tLimit<Uint16>( (Uint16) ( ( getVolume() / 100.0f ) *
( m_instrumentTrack->getVolume() / 100.0f ) *
MidiMaxVelocity ),
0, MidiMaxVelocity );
int vel = getVolume();
if( m_instrumentTrack->getVolume() < DefaultVolume )
{
vel = ( vel * m_instrumentTrack->getVolume() ) / DefaultVolume;
}
return( qMin( MidiMaxVelocity, vel * MidiMaxVelocity / DefaultVolume ) );
}

View File

@@ -151,12 +151,13 @@ void instrumentTrack::processAudioBuffer( sampleFrame * _buf,
{
return;
}
float v_scale = (float) getVolume() / DefaultVolume;
// if effects "went to sleep" because there was no input, wake them up
// now
m_audioPort.getEffects()->startRunning();
float v_scale = (float) getVolume() / DefaultVolume;
// instruments using instrument-play-handles will call this method
// without any knowledge about notes, so they pass NULL for _n, which
// is no problem for us since we just bypass the envelopes+LFOs
@@ -165,6 +166,13 @@ void instrumentTrack::processAudioBuffer( sampleFrame * _buf,
m_soundShaping.processAudioBuffer( _buf, _frames, _n );
v_scale *= ( (float) _n->getVolume() / DefaultVolume );
}
else
{
if( getVolume() < DefaultVolume )
{
v_scale = 1;
}
}
m_audioPort.setNextFxChannel( m_effectChannelModel.value() );
engine::getMixer()->bufferToPort( _buf,
@@ -1262,7 +1270,7 @@ void instrumentTrackWindow::modelChanged( void )
m_effectChannelNumber->setModel( &m_track->m_effectChannelModel );
m_pianoView->setModel( &m_track->m_piano );
if( m_track->getInstrument() && m_track->getInstrument()->bendable() )
if( m_track->getInstrument() && m_track->getInstrument()->isBendable() )
{
m_pitchKnob->setModel( &m_track->m_pitchModel );
m_pitchKnob->show();