Erik Sandberg <[EMAIL PROTECTED]> writes:

> On Wednesday 24 August 2005 08.59, Daniel Johnson wrote:
>> Hello all --
>>
>> I know that MIDI output was broken under 2.7.5 (and 2.7.6?).  Is it
>> functional under 2.7.7?  I'm running the 2.7 series now and I'd prefer
>> not to have to do a parallel installation of 2.6 just for the sake of MIDI.
>
> A quick test shows that it seems to work with latest CVS, but that the output 
> is pretty broken. ({c4 d e f} => {c4*1/384 d e f} )
>
> You can subscribe to the info-lilypond list to see announcements for new 2.7 
> versions, if you're lucky it will be mentioned when midi is fixed.
>
> I'm afraid the suggested solution to your problem otherwise is to use a 
> parallel 2.6 installation.

I've been looking into this.  The problem is twofold: 

1) Time offsets devolve into "1"s (instead of "384"s).  This is due to
   the addition of Rational::operator bool().  A rational offset is
   being converted to an int in Midi_event::to_string().  In the past,
   this used numeric promotion to call Rational::operator double().
   However, since the addition of Rational::operator bool(), it used
   that instead.  (C++ still has some int/bool confusion.)  The simple
   fix is to add a Rational::operator int().  A patch is included.

2) Audio_tempo objects are not being added to the Audio_staffs.  This
   results in the tempo not being passed to the midi file.  In the
   past, it was added by Staff_performer::play_element(Audio_element).  
   Now, however, Staff_performer does not have a specialized
   play_element function, and Lilypond relies upon
   Staff_performer::acknowledge_audio_element(Audio_element_info) to
   add Audio_items to the Audio_staffs.  This never gets called for
   the track name or the tempo because these elements are generated by
   Staff_performer::initialize(), and
   Performer_group::acknowledge_audio_elements() doesn't pass the
   elements to the origin Performer.

   I don't know the right way to fix this (although I can come up with
   plenty of gross hacks which would work), so I pass the question of
   the correct way to fix this to the developers.

Index: ChangeLog
===================================================================
RCS file: /cvsroot/lilypond/lilypond/ChangeLog,v
retrieving revision 1.4089
diff -u -p -u -r1.4089 ChangeLog
--- ChangeLog	26 Aug 2005 00:42:38 -0000	1.4089
+++ ChangeLog	26 Aug 2005 19:21:03 -0000
@@ -1,3 +1,7 @@
+2005-08-26  Michael Welsh Duggan  <[EMAIL PROTECTED]>
+
+	* flower/rational.cc (int): add int conversion.
+
 2005-08-26  Han-Wen Nienhuys  <[EMAIL PROTECTED]>
 
 	* THANKS: add Vicente & Trevor.
Index: THANKS
===================================================================
RCS file: /cvsroot/lilypond/lilypond/THANKS,v
retrieving revision 1.147
diff -u -p -u -r1.147 THANKS
--- THANKS	26 Aug 2005 00:42:38 -0000	1.147
+++ THANKS	26 Aug 2005 19:21:03 -0000
@@ -17,6 +17,7 @@ Heikki Junes
 Joe Neeman
 Sven Axelsson
 Yoshinobu Ishizaki
+Michael Welsh Duggan
 
 
 SPONSORS
Index: VERSION
===================================================================
RCS file: /cvsroot/lilypond/lilypond/VERSION,v
retrieving revision 1.654
diff -u -p -u -r1.654 VERSION
--- VERSION	22 Aug 2005 23:12:44 -0000	1.654
+++ VERSION	26 Aug 2005 19:21:03 -0000
@@ -2,5 +2,5 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=7
 PATCH_LEVEL=8
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=mwd
 
Index: flower/rational.cc
===================================================================
RCS file: /cvsroot/lilypond/lilypond/flower/rational.cc,v
retrieving revision 1.35
diff -u -p -u -r1.35 rational.cc
--- flower/rational.cc	12 Aug 2005 00:04:47 -0000	1.35
+++ flower/rational.cc	26 Aug 2005 19:21:03 -0000
@@ -24,6 +24,11 @@ Rational::operator bool () const
   return sign_ && num_;
 }
 
+Rational::operator int () const
+{
+  return (int)operator double();
+}
+
 #ifdef STREAM_SUPPORT
 ostream &
 operator << (ostream &o, Rational r)
Index: flower/include/rational.hh
===================================================================
RCS file: /cvsroot/lilypond/lilypond/flower/include/rational.hh,v
retrieving revision 1.34
diff -u -p -u -r1.34 rational.hh
--- flower/include/rational.hh	13 Jul 2005 19:31:02 -0000	1.34
+++ flower/include/rational.hh	26 Aug 2005 19:21:03 -0000
@@ -45,6 +45,7 @@ public:
   int to_int () const;
   operator bool () const;
   operator double () const;
+  operator int () const;
 
   Rational operator - () const;
   /**
-- 
Michael Welsh Duggan
([EMAIL PROTECTED])
_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to