* 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:
@@ -87,19 +87,21 @@ public:
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
// instrument-play-handle-based instruments should return FALSE
|
||||
inline virtual bool notePlayHandleBased( void ) const
|
||||
// return false if instrument is not bendable
|
||||
inline virtual bool isBendable( void ) const
|
||||
{
|
||||
return( true );
|
||||
}
|
||||
|
||||
inline virtual bool bendable( void ) const
|
||||
// return true if instruments reacts to MIDI events passed to
|
||||
// handleMidiEvent() rather than playNote() & Co
|
||||
inline virtual bool isMidiBased( void ) const
|
||||
{
|
||||
return( true );
|
||||
return( false );
|
||||
}
|
||||
|
||||
// sub-classes can re-implement this for receiving all incoming
|
||||
// MIDI-events except NoteOn and NoteOff
|
||||
// MIDI-events
|
||||
inline virtual bool handleMidiEvent( const midiEvent & _me,
|
||||
const midiTime & _time )
|
||||
{
|
||||
|
||||
@@ -245,11 +245,12 @@ public:
|
||||
&&
|
||||
// we must not parallelize note-play-handles, which
|
||||
// belong to instruments that are instrument-play-
|
||||
// handle-driven, because then waitForWorkerThread()
|
||||
// handle-driven (i.e. react to MIDI events),
|
||||
// because then waitForWorkerThread()
|
||||
// would be additionally called for each
|
||||
// note-play-handle which results in hangups
|
||||
m_instrumentTrack->getInstrument()->
|
||||
notePlayHandleBased() );
|
||||
isMidiBased() );
|
||||
}
|
||||
|
||||
virtual void waitForWorkerThread( void )
|
||||
|
||||
@@ -76,9 +76,9 @@ public:
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
virtual bool notePlayHandleBased( void ) const
|
||||
virtual bool isMidiBased( void ) const
|
||||
{
|
||||
return( FALSE );
|
||||
return( true );
|
||||
}
|
||||
|
||||
virtual pluginView * instantiateView( QWidget * _parent );
|
||||
|
||||
@@ -67,9 +67,9 @@ public:
|
||||
|
||||
virtual void waitForWorkerThread( void );
|
||||
|
||||
virtual bool notePlayHandleBased( void ) const
|
||||
virtual bool isMidiBased( void ) const
|
||||
{
|
||||
return( FALSE );
|
||||
return( true );
|
||||
}
|
||||
|
||||
virtual bool handleMidiEvent( const midiEvent & _me,
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
#ifndef _VIBED_STRINGS_H
|
||||
#define _VIBED_STRINGS_H
|
||||
#ifndef _VIBED_H
|
||||
#define _VIBED_H
|
||||
|
||||
#include "instrument.h"
|
||||
#include "instrument_view.h"
|
||||
@@ -53,13 +53,14 @@ public:
|
||||
|
||||
virtual QString nodeName( void ) const;
|
||||
|
||||
inline virtual bool bendable( void ) const
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
inline virtual bool isBendable( void ) const
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
|
||||
virtual pluginView * instantiateView( QWidget * _parent );
|
||||
|
||||
|
||||
private:
|
||||
QList<knobModel*> m_pickKnobs;
|
||||
QList<knobModel*> m_pickupKnobs;
|
||||
|
||||
@@ -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 ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user