2003-09-28 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ * lily/midi-stream.cc (operator <<): rewrite.
+
+ * lily/note-head.cc (internal_brew_molecule):
+ only make ledgers when the Staff symbol has lines.
+
* ly/property-init.ly (arpeggioBracket): simplify
* lily/translator-group.cc (execute_pushpop_property): use
}
@end lilypond
-The separator causes @internalsref{Voice} contexts to be
-instantiated. They
-bear the names @code{"1"}, @code{"2"}, etc. In each of these
-contexts, vertical direction of slurs, stems, etc. is set
+The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
+voices are sometimes called "layers" other notation packages}
+@cindex layers
+to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
+each of these contexts, vertical direction of slurs, stems, etc. is set
appropriately.
This can also be done by instantiating @internalsref{Voice} contexts
- lots of values trivially shared (key doesn't change very
often). Compute those once, and use that as cache for the rest.
+ TODO: can we do without c0pos? it's partly musical.
+
*/
int
alteration_pos (SCM what, int alter, int c0p)
Midi_note::get_length () const
{
Moment m = audio_->length_mom_;
-#if 0
- //junkme?
- if (m < Moment (Rational (1, 1000)))
- {
- warning (_ ("silly duration"));
- m = 1;
- }
-#endif
return m;
}
Midi_stream&
Midi_stream::operator << (String str)
{
- Byte *b = str.get_bytes ();
-#if 0
- for (int sz = str.length (); sz--;)
+ size_t sz = sizeof (Byte);
+ size_t n = str.length ();
+ size_t written = fwrite (str.get_bytes (),
+ sz, n, out_file_);
+
+ if (written != sz * n)
{
- fputc (*b, out_file_);
- b++;
+ warning ("Could not write file. Disk full?");
}
-#else
- for (int i = 0, n = str.length (); i < n; i++)
- fputc (b[i], out_file_);
-#endif
+
return *this;
}
bool take_space)
{
Real inter_f = Staff_symbol_referencer::staff_space (me)/2;
- int lines_i = abs (pos) < interspaces
+ int line_count = (abs (pos) < interspaces)
? 0
: (abs (pos) - interspaces) / 2;
Molecule molecule = Molecule();
- if (lines_i)
+ if (line_count)
{
Real ledgerlinethickness =
(me->get_paper ()->get_realvar (ly_symbol2scm ("ledgerlinethickness")));
Real offs = (Staff_symbol_referencer::on_staffline (me, pos))
? 0.0
: -dir * inter_f;
- for (int i = 0; i < lines_i; i++)
+ for (int i = 0; i < line_count; i++)
{
Molecule ledger_line (proto_ledger_line);
ledger_line.translate_axis (-dir * inter_f * i * 2 + offs, Y_AXIS);
int interspaces = Staff_symbol_referencer::line_count (me)-1;
int pos = (int)rint (Staff_symbol_referencer::get_position (me));
- if (abs (pos) - interspaces > 1)
+ if (interspaces >= 0
+ && abs (pos) - interspaces > 1)
{
Interval hd = out.extent (X_AXIS);
Real left_ledger_protusion = hd.length ()/4;
(RepeatSlash
. (
- (molecule-callback . , Percent_repeat_item_interface::beat_slash)
+ (molecule-callback . ,Percent_repeat_item_interface::beat_slash)
(thickness . 0.48)
(slope . 1.7)
(meta . ((interfaces . (percent-repeat-interface item-interface ))))