InstrumentTrack, NotePlayHandle: ignore volume of InstrumentTrack for MIDI events

The volume of an InstrumentTrack is applied separately when post-processing
the audio buffer and is not related to MIDI processing. It therefore should
not be included into MIDI velocity calculation.

Closes #301.
This commit is contained in:
Tobias Doerffel
2014-02-13 01:35:49 +01:00
parent a87c206e31
commit 7e680abf13
3 changed files with 5 additions and 21 deletions

View File

@@ -68,7 +68,11 @@ public:
virtual void setVolume( const volume_t volume = DefaultVolume );
virtual void setPanning( const panning_t panning = DefaultPanning );
int midiVelocity() const;
int midiVelocity() const
{
return volumeToMidi( getVolume() );
}
int midiKey() const;
int midiChannel() const
{

View File

@@ -179,19 +179,6 @@ void NotePlayHandle::setPanning( const panning_t panning )
int NotePlayHandle::midiVelocity() const
{
int vel = getVolume();
if( m_instrumentTrack->getVolume() < DefaultVolume )
{
vel = ( vel * m_instrumentTrack->getVolume() ) / DefaultVolume;
}
return qMin( MidiMaxVelocity, vel * MidiMaxVelocity / DefaultVolume );
}
int NotePlayHandle::midiKey() const
{
return key() - m_origBaseNote + instrumentTrack()->baseNoteModel()->value();

View File

@@ -193,13 +193,6 @@ void InstrumentTrack::processAudioBuffer( sampleFrame* buf, const fpp_t frames,
m_soundShaping.processAudioBuffer( buf, frames, n );
v_scale *= ( (float) n->getVolume() / DefaultVolume );
}
else
{
if( getVolume() < DefaultVolume && m_instrument->isMidiBased() )
{
v_scale = 1;
}
}
m_audioPort.setNextFxChannel( m_effectChannelModel.value() );