[prev in list] [next in list] [prev in thread] [next in thread]
List: lilypond-devel
Subject: Re: [PATCH] MIDI command line option
From: "Neil Puttock" <n.puttock () gmail ! com>
Date: 2008-08-30 21:42:13
Message-ID: 7ca3d5a30808301442o5f773cffvc2f6182b145188e9 () mail ! gmail ! com
[Download RAW message or body]
2008/8/30 Han-Wen Nienhuys <hanwenn@gmail.com>:
> Can you make sure that we this code only once and puts it in a
> platform variable?
>
> (if (eq? platform 'windows) .. )
Done.
There are several places where it's duplicated (e.g. ps-to-png.scm,
editor.scm), but these are standalone modules. If you wish, I'll
recode them in the same way as in lily.scm.
BTW, the DOS variable doesn't appear to be used anywhere; can it be removed?
Regards,
Neil
["0001-Add-midi-extension-command-line-option.patch" (text/x-diff)]
From bd47cffe3020570989498a32be2efc270d067dfe Mon Sep 17 00:00:00 2001
From: Neil Puttock <n.puttock@gmail.com>
Date: Sat, 30 Aug 2008 22:31:19 +0100
Subject: [PATCH] Add midi-extension command line option.
If operating system is windows, change default to .mid.
---
lily/performance.cc | 1 -
scm/lily.scm | 25 +++++++++----------------
scm/midi.scm | 29 +++++++++++++++--------------
3 files changed, 24 insertions(+), 31 deletions(-)
diff --git a/lily/performance.cc b/lily/performance.cc
index 70d5348..8ae1edf 100644
--- a/lily/performance.cc
+++ b/lily/performance.cc
@@ -94,7 +94,6 @@ Performance::write_output (string out) const
/* Maybe a bit crude, but we had this before */
File_name file_name (out);
- file_name.ext_ = "midi";
out = file_name.to_string ();
Midi_stream midi_stream (out);
diff --git a/scm/lily.scm b/scm/lily.scm
index a7ff41a..2cca01d 100644
--- a/scm/lily.scm
+++ b/scm/lily.scm
@@ -17,6 +17,11 @@
(read-enable 'positions)
(debug-enable 'debug)
+(define-public PLATFORM
+ (string->symbol
+ (string-downcase
+ (utsname:sysname (uname)))))
+
(define scheme-options-definitions
`(
@@ -55,6 +60,10 @@ ensure that all refs to parsed objects are dead. This is an internal option, an
(include-eps-fonts #t "Include fonts in separate-system EPS files.")
(job-count #f "Process in parallel")
(log-file #f "redirect output to log FILE.log")
+ (midi-extension ,(if (eq? PLATFORM 'windows)
+ "mid"
+ "midi")
+ "set the default file extension for MIDI")
(old-relative #f
"relative for simultaneous music works
@@ -180,22 +189,6 @@ on errors, and print a stack trace.")
(if (ly:get-option 'verbose)
(ly:progress "]"))))
-;; Cygwin
-;; #(CYGWIN_NT-5.1 Hostname 1.5.12(0.116/4/2) 2004-11-10 08:34 i686)
-;;
-;; Debian
-;; #(Linux hostname 2.4.27-1-686 #1 Fri Sep 3 06:28:00 UTC 2004 i686)
-;;
-;; Mingw
-;; #(Windows XP HOSTNAME build 2600 5.01 Service Pack 1 i686)
-;;
-
-;; ugh, code dup.
-(define-public PLATFORM
- (string->symbol
- (string-downcase
- (car (string-tokenize (vector-ref (uname) 0) char-set:letter)))))
-
(define-public DOS
(let ((platform (string-tokenize
(vector-ref (uname) 0) char-set:letter+digit)))
diff --git a/scm/midi.scm b/scm/midi.scm
index 715c8c0..5d3277d 100644
--- a/scm/midi.scm
+++ b/scm/midi.scm
@@ -285,17 +285,18 @@ returns the program of the instrument
;;
(define-public (write-performances-midis performances basename)
- (let
- loop
- ((perfs performances)
- (count 0))
-
-
- (if (pair? perfs)
- (begin
- (ly:performance-write
- (car perfs)
- (if (> count 0)
- (format #f "~a-~a.midi" basename count)
- (format #f "~a.midi" basename)))
- (loop (cdr perfs) (1+ count))))))
+ (let ((midi-ext (ly:get-option 'midi-extension)))
+ (let
+ loop
+ ((perfs performances)
+ (count 0))
+
+
+ (if (pair? perfs)
+ (begin
+ (ly:performance-write
+ (car perfs)
+ (if (> count 0)
+ (format #f "~a-~a.~a" basename count midi-ext)
+ (format #f "~a.~a" basename midi-ext)))
+ (loop (cdr perfs) (1+ count)))))))
--
1.5.4.3
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic