(c) 1997--2000 Jan Nieuwenhuizen <janneke@gnu.org>
*/
-#include "proto.hh"
#include "debug.hh"
#include "misc.hh"
#include "string.hh"
return new Midi_note (i);
else if (Audio_dynamic* i = dynamic_cast<Audio_dynamic*> (a))
return new Midi_dynamic (i);
+ else if (Audio_piano_pedal* i = dynamic_cast<Audio_piano_pedal*> (a))
+ return new Midi_piano_pedal (i);
else if (Audio_tempo* i = dynamic_cast<Audio_tempo*> (a))
return new Midi_tempo (i);
else if (Audio_time_signature* i = dynamic_cast<Audio_time_signature*> (a))
return new Midi_time_signature (i);
else if (Audio_text* i = dynamic_cast<Audio_text*> (a))
- return i->text_str_.length_i () ? new Midi_text (i) : 0;
+ //return i->text_str_.length_i () ? new Midi_text (i) : 0;
+ return new Midi_text (i);
else
assert (0);
String
Midi_key::str () const
{
- int sharps_i = audio_l_->key_.sharps_i ();
- int flats_i = audio_l_->key_.flats_i ();
+ // fxime.
+ int sharps_i = 0; //audio_l_->key_.sharps_i ();
+ int flats_i = 0; //audio_l_->key_.flats_i ();
// midi cannot handle non-conventional keys
if (flats_i && sharps_i)
String str = "ff5902";
str += String_convert::i2hex_str (accidentals_i, 2, '0');
- str += String_convert::i2hex_str ((int)audio_l_->key_.minor_b (), 2, '0');
+
+ // (int)audio_l_->key_.minor_b ()
+ str += String_convert::i2hex_str (0, 2, '0');
return String_convert::hex2bin_str (str);
}
return str;
}
+Midi_piano_pedal::Midi_piano_pedal (Audio_piano_pedal* a)
+{
+ audio_l_ = a;
+}
+
+String
+Midi_piano_pedal::str () const
+{
+ Byte status_byte = (char) (0xB0 + channel_i_);
+ String str = to_str ((char)status_byte);
+
+ if (audio_l_->type_str_ == "Sostenuto")
+ str += to_str ((char)0x42);
+ else if (audio_l_->type_str_ == "Sustain")
+ str += to_str ((char)0x40);
+ else if (audio_l_->type_str_ == "UnaChorda")
+ str += to_str ((char)0x43);
+
+ int pedal = ((1 - audio_l_->dir_) / 2 ) * 0x7f;
+ str += to_str ((char)pedal);
+ return str;
+}
+
Midi_tempo::Midi_tempo (Audio_tempo* a)
{
audio_l_ = a;
audio_l_ = a;
}
-#if 0
-Midi_text::Midi_text (Midi_text::Type type, String text_str)
- : Audio_text ()
-{
- text_str_ = text_str;
- type_ = type;
-}
-#endif
-
String
Midi_text::str () const
{