Line_spacer 0
Melodic_req 0
Midi_def 0
-Midistrings 1
+Midistrings 0
Mixed_qp 0
Music 0
Music_iterator 0
Score = \translator {
\type "Score_performer";
-% instrument = piano;
+ instrument = piano;
\accepts Staff;
\accepts Grandstaff;
\accepts Lyrics;
return str;
}
-#if 0
-int
-Duration_convert::dur2_i (Duration dur, int division_1_i)
-{
- return dur2_mom (dur) * Moment (division_1_i);
-}
-#endif
-
int
Duration_convert::dur2ticks_i (Duration dur)
{
return mom * plet_factor_mom (dur);
}
-#if 0
-Moment
-Duration_convert::i2_mom (int time_i, int division_1_i)
-{
- if (!time_i)
- return Moment (0);
-
- if (division_1_i > 0)
- return Moment (time_i, division_1_i);
- else
- return Moment (-division_1_i, time_i);
-}
-#endif
-
Duration
Duration_convert::mom2_dur (Moment mom)
{
Duration
Duration_convert::ticks2_dur (int ticks_i)
{
- // Duration dur (4, 0);
- // dur.set_plet (ticks_i, Duration::division_1_i_s / 4);
-
Moment mom (ticks_i, Duration::division_1_i_s);
if (midi_as_plet_b_s)
return mom2_dur (mom);
Duration dur = mom2standardised_dur (mom);
- // if (dur.mom () == mom)
if (dur.length () == mom)
return dur;
-// huh?
-#if 0
- dur.durlog_i_ = -100;
- dur.dots_i_ = 0;
- dur.set_ticks (ticks_i);
- return dur;
-#else
return mom2_dur (mom);
-#endif
}
Duration
cursor_dur_.durlog_i_ = 7;
if (Duration_convert::no_smaller_than_i_s)
cursor_dur_.durlog_i_ = Duration_convert::no_smaller_than_i_s;
- // cursor_dur_.set_plet (1, 1);
}
Duration
static int no_smaller_than_i_s;
static Array<Duration> dur_array_s;
-// /// Most used division in MIDI, all fine with me.
-// static int const division_1_c_i = 384;
-
-// /// Return (integer, division) representation.
-// static int dur2_i (Duration dur, int division_1_i = division_1_c_i );
-
/// Return number of ticks in (ticks, division_1) representation
static int dur2ticks_i (Duration dur );
/// Return Mudela string representation.
static String dur2_str (Duration dur );
-// /// Return Moment from (integer, division) representation.
-// static Moment i2_mom (int i, int division_1_i = division_1_c_i );
-
-// /// Return Moment (fraction of whole) representation, best guess.
-// static Duration mom2_dur (Moment mom );
-
/// Return duration from Moment (fraction of whole) representation.
static Duration mom2_dur (Moment mom );
(dur)
*/
struct Duration {
- /**
- Ctor of Duration.
- */
Duration ();
/// is the "plet factor" of this note != 1 ?
bool plet_b ();
void process();
private:
- void do_start_note (Midi_note* note_l);
+ void do_start_note (Midi_note* note_p);
void do_stop_notes (Moment now_mom);
void output_event (Moment now_mom, Midi_item* l);
TRANSLATOR_CLONE(Staff_performer);
DECLARE_MY_RUNTIME_TYPEINFO;
- Staff_performer();
- ~Staff_performer();
+ Staff_performer ();
+ ~Staff_performer ();
- String instrument_str();
+ String new_instrument_str ();
+ String instrument_str_;
protected:
virtual void play (Audio_element* p);
- virtual void do_removal_processing();
- virtual void do_creation_processing();
+ virtual void do_removal_processing ();
+ virtual void do_creation_processing ();
+ virtual void do_process_requests ();
private:
Audio_staff* audio_staff_p_;
/** A symbol which sits along a staff.
*/
-class Staff_side : virtual Score_elem {
- Link_array<Score_elem> support_l_arr_;
-
- Interval support_height() const;
- Real get_position_f() const;
-
+class Staff_side : virtual Score_elem
+{
public:
/**
void set_staffsym (Staff_symbol * );
-
- Staff_side();
+ Staff_side ();
void add_support (Score_elem*);
DECLARE_MY_RUNTIME_TYPEINFO;
protected:
- virtual Interval symbol_height() const;
+ virtual Interval symbol_height () const;
+ virtual Real get_position_f () const;
virtual void do_substitute_dependency (Score_elem *, Score_elem*);
- virtual void do_post_processing();
+ virtual void do_post_processing ();
+ Interval support_height () const;
+
+private:
+ Link_array<Score_elem> support_l_arr_;
+// Interval support_height () const;
};
#endif // STAFF_SIDE_HH
#include "lily-proto.hh"
#include "input.hh"
-class Text_def : public General_script_def {
-protected:
-// huh? move to public
-// virtual Atom get_atom (Paper_def* p, Direction dir_) const;
+class Text_def : public General_script_def
+{
+public:
DECLARE_MY_RUNTIME_TYPEINFO;
VIRTUAL_COPY_CONS(Text_def,General_script_def);
-public:
+
/**
centered , or aligned?
/**
print a fixed width text above or below the staff.
*/
-class Text_item : public Item ,public Staff_side{
- void init (Text_def* tdef_l);
-
+class Text_item : public Item ,public Staff_side
+{
+public:
public:
/// do I have width?
/* ***************/
- Text_item (General_script_def*,Direction dir=0);
- virtual ~Text_item();
+ Text_item (General_script_def* ,Direction dir=0);
+ virtual ~Text_item ();
DECLARE_MY_RUNTIME_TYPEINFO;
protected:
- General_script_def * tdef_p_;
+ // ugh: so, are we a text-def, or can this vary?
+ General_script_def* tdef_p_;
+
+ virtual Interval symbol_height () const;
- virtual Interval symbol_height() const;
+ virtual Molecule* brew_molecule_p () const;
+ virtual void do_pre_processing ();
+ virtual Real get_position_f () const;
- virtual Molecule* brew_molecule_p() const;
- virtual void do_pre_processing();
+private:
+// void init (Text_def* tdef_l);
};
{
filename_str_ = filename_str;
os_p_ = 0;
- open();
+ open ();
}
-Midi_stream::~Midi_stream()
+Midi_stream::~Midi_stream ()
{
*os_p_ << flush; // ugh. Share with tex_stream.
if (!*os_p_)
{
- warning(_("error syncing file (disk full?)"));
+ warning (_ ("error syncing file (disk full?)"));
exit_status_i_ = 1;
}
delete os_p_;
}
Midi_stream&
-Midi_stream::operator <<(String str)
+Midi_stream::operator << (String str)
{
- if (check_debug && !monitor->silent_b("Midistrings"))
- str = String_convert::bin2hex_str (str);
-
*os_p_ << str;
-
- if (check_debug && !monitor->silent_b ("Midistrings"))
- *os_p_ << "\n";
-
return *this;
}
Midi_stream&
-Midi_stream::operator <<(Midi_item const& mitem_c_r)
+Midi_stream::operator << (Midi_item const& mitem_c_r)
{
- // *this << mitem_c_r.str();
- mitem_c_r.output (this);
- if (check_debug && !monitor->silent_b("Midistrings"))
- *os_p_ << "\n";
+// *this <<mitem_c_r.str ();
+ String str = mitem_c_r.str ();
+ if (check_debug && !monitor->silent_b ("Midistrings"))
+ {
+ str = String_convert::bin2hex_str (str) + "\n";
+ // ugh, should have separate debugging output with Midi*::print routines
+ int i = str.index_i ("0a");
+ while (i >= 0)
+ {
+ str[i] = '\n';
+ str[i + 1] = '\t';
+ i = str.index_i ("0a");
+ }
+ }
+
+ *os_p_ << str;
return *this;
}
Midi_stream&
-Midi_stream::operator <<(int i)
+Midi_stream::operator << (int i)
{
// output binary string ourselves
*this << Midi_item::i2varint_str (i);
}
void
-Midi_stream::open()
+Midi_stream::open ()
{
os_p_ = new ofstream (filename_str_.ch_C ());
if (!*os_p_)
- error (_("can't open `") + filename_str_ + "\'");
+ error (_ ("can't open `") + filename_str_ + "\'");
}
Find out if start_note event is needed, and do it if needed.
*/
void
-Midi_walker::do_start_note (Midi_note* note_l)
+Midi_walker::do_start_note (Midi_note* note_p)
{
- Moment stop_mom = note_l->duration() + ptr ()->audio_column_l_->at_mom ();
+ Moment stop_mom = note_p->duration() + ptr ()->audio_column_l_->at_mom ();
for (int i=0; i < stop_note_queue.size(); i++)
{
- if (stop_note_queue[ i ].val->pitch_i() == note_l->pitch_i ())
+ if (stop_note_queue[ i ].val->pitch_i() == note_p->pitch_i ())
{
if (stop_note_queue[ i ].key < stop_mom)
stop_note_queue[ i ].ignore_b_ = true;
}
Midi_note_event e;
- e.val = new Midi_note_off (note_l);
+ e.val = new Midi_note_off (note_p);
e.key = stop_mom;
stop_note_queue.insert (e);
- output_event (ptr()->audio_column_l_->at_mom (), note_l);
+ output_event (ptr()->audio_column_l_->at_mom (), note_p);
}
/**
continue;
Moment stop_mom = e.key;
- Midi_note_off* note_l = e.val;
+ Midi_note_off* note_p = e.val;
- output_event (stop_mom, note_l);
+ output_event (stop_mom, note_p);
}
}
output_event (ptr()->audio_column_l_->at_mom (), p);
else
do_start_note ((Midi_note*)p);
-
- delete p;
}
Spring_spacer::make_constraints (Mixed_qp& lp) const
{
int dim=cols.size();
- Real nw_f = paper_l ()->note_width ();
for (int j=0; j < dim; j++)
{
Colinfo c=cols[j];
dist = dist >? minimum;
}
+ // ugh: never let columns touch... try to set over here...
+ // ugh: use j iso i triggers ice in gcc-2.7.2.3
+ cols[i].width_[LEFT] -= nw_f / 4;
ideal_arr_[i] = dist;
}
}
#include "audio-item.hh"
#include "audio-staff.hh"
-IMPLEMENT_IS_TYPE_B1(Staff_performer,Performer_group_performer);
-ADD_THIS_TRANSLATOR(Staff_performer);
+IMPLEMENT_IS_TYPE_B1 (Staff_performer,Performer_group_performer);
+ADD_THIS_TRANSLATOR (Staff_performer);
-Staff_performer::Staff_performer()
+Staff_performer::Staff_performer ()
{
audio_staff_p_ = 0;
}
-Staff_performer::~Staff_performer()
+Staff_performer::~Staff_performer ()
{
delete audio_staff_p_;
}
void
-Staff_performer::do_creation_processing()
+Staff_performer::do_creation_processing ()
{
audio_staff_p_ = new Audio_staff;
- if (instrument_str().length_i())
- {
- // staff name
- play (new Audio_text (Audio_text::TRACK_NAME, id_str_));
- // instrument description
- play (new Audio_text (Audio_text::INSTRUMENT_NAME, instrument_str ()));
- }
+ play (new Audio_text (Audio_text::TRACK_NAME, id_str_));
+
+#if 1
+ String str = new_instrument_str ();
+ if (str.length_i ())
+ // instrument description
+ play (new Audio_text (Audio_text::INSTRUMENT_NAME, str));
+#endif
// tempo
play (new Audio_tempo (get_tempo_i ()));
- if (instrument_str ().length_i ())
+#if 1
+ if (str.length_i ())
// instrument
- play (new Audio_instrument (instrument_str ()));
+ play (new Audio_instrument (str));
+#endif
+
Performer_group_performer::do_creation_processing ();
}
void
-Staff_performer::do_removal_processing()
+Staff_performer::do_process_requests ()
+{
+ String str = new_instrument_str ();
+ if (str.length_i ())
+ {
+ play (new Audio_text (Audio_text::INSTRUMENT_NAME, str));
+ play (new Audio_instrument (str));
+ }
+ Performer_group_performer::do_process_requests ();
+}
+
+
+void
+Staff_performer::do_removal_processing ()
{
Performer_group_performer::do_removal_processing ();
Performer::play (audio_staff_p_);
}
String
-Staff_performer::instrument_str()
+Staff_performer::new_instrument_str ()
{
// mustn't ask Score for instrument: it will return piano!
- return get_property ("instrument");
+ String str = get_property ("instrument");
+ if (str == instrument_str_)
+ return "";
+
+ instrument_str_ = str;
+
+ return instrument_str_;
/* ugh, but can't
if (properties_dict_.elt_b ("instrument"))
void
Staff_performer::play (Audio_element* p)
{
- if (p->is_type_b (Audio_item::static_name()))
+ if (p->is_type_b (Audio_item::static_name ()))
{
- audio_staff_p_->add ((Audio_item*)p);
+ audio_staff_p_->add ( (Audio_item*)p);
}
Performer::play (p);
}
}
Real
-Staff_side::get_position_f() const
+Staff_side::get_position_f () const
{
if (!dir_)
{
- warning (_("Staff_side::get_position_i(): "
+ warning (_("Staff_side::get_position_f(): "
"somebody forgot to set my vertical direction, returning -20"));
return -20;
}
Real inter_f = paper()-> internote_f ();
Interval v= support_height();
-// y = v[dir_] + 2*dir_*inter_f; // ugh
- y = v[dir_]; // ugh
+ y = v[dir_] + 2 * dir_ * inter_f; // ugh
return y;
}
#include "audio-column.hh"
#include "audio-item.hh"
#include "audio-staff.hh"
+#include "midi-item.hh"
#include "pcursor.tcc"
#include "plist.tcc"
template POINTERLIST_INSTANTIATE(Audio_element);
template POINTERLIST_INSTANTIATE(Audio_column);
-
+template POINTERLIST_INSTANTIATE(Midi_event);
#include "stem.hh"
#include "molecule.hh"
#include "lookup.hh"
+#include "debug.hh"
-Text_item::Text_item (General_script_def*tdef_l, Direction d)
+Text_item::Text_item (General_script_def* tdef_l, Direction d)
{
dir_ = d;
fat_b_ = false;
- tdef_p_ = tdef_l->clone();
+ tdef_p_ = tdef_l->clone ();
}
-Text_item::~Text_item()
+Text_item::~Text_item ()
{
delete tdef_p_;
}
void
-Text_item::do_pre_processing()
+Text_item::do_pre_processing ()
{
if (!dir_)
dir_ = DOWN;
}
+Real
+Text_item::get_position_f () const
+{
+ // uhuh, tdef/gdef?
+ if ( (tdef_p_->name () != Text_def::static_name ())
+ || ( ( (Text_def*)tdef_p_)->style_str_ != "finger"))
+ return Staff_side::get_position_f ();
+
+ if (!dir_)
+ {
+ warning (_ ("Text_item::get_position_f(): "
+ "somebody forgot to set my vertical direction, returning -20"));
+ return -20;
+ }
+
+ Interval v = support_height ();
+ // add no extra: fingers should be just above note, no?
+ return v[dir_];
+}
+
Interval
-Text_item::symbol_height() const
+Text_item::symbol_height () const
{
- return tdef_p_->get_atom (paper(), dir_).dim_.y ();
+ return tdef_p_->get_atom (paper (), dir_).dim_.y ();
}
Molecule*
-Text_item::brew_molecule_p() const
+Text_item::brew_molecule_p () const
{
- Atom a (tdef_p_->get_atom (paper(), dir_));
+ Atom a (tdef_p_->get_atom (paper (), dir_));
/*
if (fat_b_)
- a.sym.dim.x = tdef_p_->width (paper());
+ a.sym.dim.x = tdef_p_->width (paper ());
*/
Molecule* mol_p = new Molecule (a);
if (dir_<0) // should do something better anyway.
- mol_p->translate_axis (-mol_p->extent().y ().left , Y_AXIS);
+ mol_p->translate_axis (-mol_p->extent ().y ().left , Y_AXIS);
mol_p->translate_axis (y_, Y_AXIS);
return mol_p;
}
-IMPLEMENT_IS_TYPE_B1(Text_item,Item);
+IMPLEMENT_IS_TYPE_B1 (Text_item,Item);
\header{
-filename = "standchen.ly";
-title = "St\"andchen (Serenade) \"Leise flehen meine Lieder\"";
-opus = "D. 957 No. 4";
-composer = "Franz Schubert (1797-1828)"
- "Text by Ludwig Rellstab (1799-1860)";
-enteredby = "JCN";
-copyright = "public domain";
+filename = "standchen.ly";
+title = "St\"andchen (Serenade)\\\``Leise flehen meine Lieder''";
+opus = "D. 957 No. 4";
+composer = "Franz Schubert (1797-1828)\\\ \hfill Text by Ludwig Rellstab (1799-1860)";
+enteredby = "JCN";
+copyright = "public domain";
}
%{