Byte program_byte = 0;
bool found = false;
- /*
- UGH. don't use eval.
- */
SCM proc = ly_lily_module_constant ("midi-program");
SCM program = scm_call_1 (proc, ly_symbol2scm (audio_->str_.c_str ()));
found = (program != SCM_BOOL_F);
int
Midi_note::get_fine_tuning () const
{
- int ft = audio_->pitch_.quartertone_pitch ();
- ft -= 2 * audio_->pitch_.semitone_pitch ();
- ft *= 50; // 1 quarter tone = 50 cents
- return ft;
+ Rational tune = (audio_->pitch_.tone_pitch ()
+ + audio_->transposing_.tone_pitch ()) * Rational (2);
+ tune -= Rational (get_semitone_pitch ());
+
+ tune *= 100;
+ return (int) double (tune);
}
int
-Midi_note::get_pitch () const
+Midi_note::get_semitone_pitch () const
{
- int p = audio_->pitch_.semitone_pitch () + audio_->transposing_;
- if (p == INT_MAX)
- {
- warning (_ ("silly pitch"));
- p = 0;
- }
- return p;
+ return int (double ((audio_->pitch_.tone_pitch ()
+ + audio_->transposing_.tone_pitch ()) * Rational (2)));
}
string
}
str += ::to_string ((char)status_byte);
- str += ::to_string ((char) (get_pitch () + c0_pitch_));
+ str += ::to_string ((char) (get_semitone_pitch () + c0_pitch_));
str += ::to_string ((char)dynamic_byte_);
return str;
Byte status_byte = (char) (0x80 + channel_);
string str = ::to_string ((char)status_byte);
- str += ::to_string ((char) (get_pitch () + Midi_note::c0_pitch_));
+ str += ::to_string ((char) (get_semitone_pitch () + Midi_note::c0_pitch_));
str += ::to_string ((char)aftertouch_byte_);
if (get_fine_tuning () != 0)