* additionally provide frequency without pitch-wheel

* added instrumentTrack::midiPitch()



git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1292 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-07-07 08:34:02 +00:00
parent 1458cb3e2c
commit 98a984b94d
4 changed files with 23 additions and 10 deletions

View File

@@ -94,8 +94,15 @@ public:
// name-stuff
virtual void setName( const QString & _new_name );
// translate key of given notePlayHandle to absolute key (i.e.
// add global master-pitch and base-note in piano)
int masterKey( notePlayHandle * _n ) const;
// translate pitch to midi-pitch [0,16383]
inline int midiPitch( void ) const
{
return( (int)( ( m_pitchModel.value()+100 ) * 81.92 ) );
}
// play everything in given frame-range - creates note-play-handles
virtual bool play( const midiTime & _start, const fpp_t _frames,

View File

@@ -63,6 +63,12 @@ public:
void updateFrequency( void );
// returns frequency without pitch-wheel influence
float unpitchedFrequency( void ) const
{
return( m_unpitchedFrequency );
}
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer );
@@ -318,6 +324,7 @@ private:
f_cnt_t m_orig_frames; // original m_frames
float m_frequency;
float m_unpitchedFrequency;
baseDetuning * m_baseDetuning;

View File

@@ -434,12 +434,13 @@ void notePlayHandle::updateFrequency( void )
KeysPerOctave;
const int base_octave = m_instrumentTrack->baseNoteModel()->value() /
KeysPerOctave;
const float pitch = (float)( key() % KeysPerOctave - base_tone +
const float pitch = ( key() % KeysPerOctave - base_tone +
engine::getSong()->masterPitch() ) / 12.0f +
(float)( key() / KeysPerOctave - base_octave ) +
m_baseDetuning->value() / 12.0f +
m_instrumentTrack->m_pitchModel.value() / ( 100 * 12.0 );
m_frequency = BaseFreq * powf( 2.0f, pitch );
( key() / KeysPerOctave - base_octave ) +
m_baseDetuning->value() / 12.0f;
m_frequency = BaseFreq * powf( 2.0f, pitch +
m_instrumentTrack->m_pitchModel.value() / ( 100 * 12.0 ) );
m_unpitchedFrequency = BaseFreq * powf( 2.0f, pitch );
for( notePlayHandleVector::iterator it = m_subNotes.begin();
it != m_subNotes.end(); ++it )

View File

@@ -279,12 +279,10 @@ void instrumentTrack::processInEvent( const midiEvent & _me,
break;
case MidiPitchBend:
if( !m_instrument->handleMidiEvent( _me, _time ) )
{
m_pitchModel.setValue( m_pitchModel.minValue() +
m_instrument->handleMidiEvent( _me, _time );
m_pitchModel.setValue( m_pitchModel.minValue() +
_me.m_data.m_param[0] *
m_pitchModel.range() / 16384 );
}
break;
case MidiControlChange:
@@ -367,7 +365,7 @@ QString instrumentTrack::instrumentName( void ) const
{
return( m_instrument->publicName() );
}
return( "" );
return( QString::null );
}