From: Neil Puttock Date: Sat, 30 Aug 2008 21:31:19 +0000 (+0100) Subject: Add midi-extension command line option. X-Git-Tag: release/2.11.60-1~3^2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2e740abdcd601e8d2148a35d48bd3c8ca5acfc99;p=lilypond.git Add midi-extension command line option. If operating system is windows, change default to .mid. --- diff --git a/lily/performance.cc b/lily/performance.cc index 70d5348a9b..8ae1edfaf3 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 a7ff41a4d1..2cca01ddcb 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 715c8c0e37..5d3277d820 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)))))))