lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Midi-interface


From: Heikki Johannes Junes
Subject: [PATCH] Midi-interface
Date: Tue, 9 Apr 2002 23:45:40 +0300 (EET DST)

When using timidity with "timidity -ig" there is available a precompiled
gtk+ -interface. Though it is rather simple, it is possible to browse
between the midi-files and somewhat within a midi-file. The interface
makes it possible to skip near to a desired position in a midi-file, a
feature which is convenient when one proof-checks a long score. Below is
the patch.

Index: VERSION
===================================================================
RCS file: /home/lilypond/lilypond/VERSION,v
retrieving revision 1.376
diff -p -u -r1.376 VERSION
--- VERSION     9 Apr 2002 09:13:40 -0000       1.376
+++ VERSION     9 Apr 2002 20:20:11 -0000
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=5
 PATCH_LEVEL=51
-MY_PATCH_LEVEL=hjj1
+MY_PATCH_LEVEL=hjj2
 
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
Index: ChangeLog
===================================================================
RCS file: /home/lilypond/lilypond/ChangeLog,v
retrieving revision 1.64
diff -p -u -r1.64 ChangeLog
--- ChangeLog   9 Apr 2002 09:36:01 -0000       1.64
+++ ChangeLog   9 Apr 2002 20:21:23 -0000
@@ -14,6 +14,9 @@
        separate "Command"-menu and "LilyPond"-menu. Added "Miscellanous"-
        submenu to "LilyPond"-menu.
 
+       * lilypond-mode.el: Added "Midi all" to "Command"-menu, i.e.,
+       an interface to play midi.
+
 2002-04-08  Han-Wen Nienhuys  <address@hidden>
 
        * input/regression/script-stack-order.ly: new file.
Index: lilypond-mode.el
===================================================================
RCS file: /home/lilypond/lilypond/lilypond-mode.el,v
retrieving revision 1.31
diff -p -u -r1.31 lilypond-mode.el
--- lilypond-mode.el    9 Apr 2002 09:13:40 -0000       1.31
+++ lilypond-mode.el    9 Apr 2002 20:22:22 -0000
@@ -149,13 +149,13 @@ in LilyPond-include-path."
   :group 'LilyPond
   :type 'string)
 
-(defcustom LilyPond-gv-command "gv -watch"
-  "Command used to display PS files."
+(defcustom LilyPond-midi-command "timidity"
+  "Command used to play MIDI files."
 
   :group 'LilyPond
   :type 'string)
 
-(defcustom LilyPond-midi-command "timidity"
+(defcustom LilyPond-midi-all-command "timidity -ig"
   "Command used to play MIDI files."
 
   :group 'LilyPond
@@ -369,6 +369,25 @@ Must be the car of an entry in `LilyPond
                ".midi"))
      "Midi")))
 
+(defun LilyPond-command-all-midi ()
+  "Play next midi score of the current document."
+  (interactive)
+  (if (Midi-running)
+      (quit-process (get-process "midi") t)
+    (LilyPond-compile-file 
+     (let ((fname (LilyPond-master-file))
+          (allcount (string-to-number (substring (count-midi-words) 0 -12))))
+       (concat  LilyPond-midi-all-command " "
+               (if (> allcount 0) ; at least one midi-score
+                   (concat (substring fname 0 -3) ".midi "))
+               (if (> allcount 1) ; more than one midi-score
+                   (concat (substring fname 0 -3) "-?.midi "))
+               (if (> allcount 9) ; etc.
+                   (concat (substring fname 0 -3) "-??.midi"))
+               (if (> allcount 99) ; not first score
+                   (concat (substring fname 0 -3) "-???.midi"))))
+     "Midi")))
+
 (defun LilyPond-un-comment-region (start end level)
   "Remove up to LEVEL comment characters from each line in the region."
   (interactive "*r\np") 
@@ -571,6 +590,7 @@ command."
          '([ "View" (LilyPond-command (LilyPond-command-menu "View") 
'LilyPond-master-file) :keys "C-c C-v"])
          '([ "ViewPS" (LilyPond-command (LilyPond-command-menu "ViewPS") 
'LilyPond-master-file) :keys "C-c C-p"])
          '([ "Midi (off)" (LilyPond-command-next-midi) :keys "C-c C-m"])
+         '([ "Midi all" (LilyPond-command-all-midi)])
          ))
 
 (easy-menu-define LilyPond-mode-menu
--
      Heikki Junes




reply via email to

[Prev in Thread] Current Thread [Next in Thread]