]> git.donarmstrong.com Git - lilypond.git/commitdiff
new file: perform drum notes.
authorhanwen <hanwen>
Thu, 5 Feb 2004 19:05:25 +0000 (19:05 +0000)
committerhanwen <hanwen>
Thu, 5 Feb 2004 19:05:25 +0000 (19:05 +0000)
ChangeLog
input/mutopia/F.Schubert/morgenlied.ly
lily/accidental-engraver.cc
lily/note-performer.cc
lily/parser.yy
lily/staff-performer.cc
ly/drumpitch-init.ly
ly/performer-init.ly
scm/lily.scm
scm/midi.scm

index 6fa94cc7d1321c60fec8613c667f8c47106b5395..a3c4d5debdce3cbe8473c8a96467272fa03a7a6a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2004-02-05  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * lily/drum-note-performer.cc: new file: perform drum notes.
+
        * VERSION (PACKAGE_NAME): release 2.1.19.
        
 2004-02-05  Jan Nieuwenhuizen  <janneke@gnu.org>
index 91cafca72d709147780b0514ace81ca3b0b17343..a8e1f085505905603ea8aabf1f5b134af1add58e 100644 (file)
@@ -152,10 +152,8 @@ pianoLH = \notes \relative c'' \repeat volta 2 {
      \new Staff <<
         \context Staff \modernAccidentals
         \melody >>
-     \new LyricsVoice <<
         \lyricsto "singer" \new LyricsVoice \firstVerse
         \lyricsto "singer" \new LyricsVoice \secondVerse
-        >>
      \new PianoStaff << 
         \property PianoStaff.instrument = \markup {
             \bold
@@ -185,4 +183,7 @@ pianoLH = \notes \relative c'' \repeat volta 2 {
            minimumVerticalExtent = #'(-3. . 6)
        }
     }
+    \midi {
+       \tempo 4 = 70
+       }
 }
index f41260d6b65428042c65bdf83d998db03f6928fe..c6f1f4ed54caa3aeab6f6cdadb2096fdc7dd263d 100644 (file)
 
 /**
 
-
-FIXME: should not compute vertical positioning of accidentals, but
-get them from the noteheads
-
 The algorithm for accidentals should be documented, and made
 tweakable.
 
index 02b0baceff030583b02c4be3a657e4ee38077746..22df5b0fb80e1c9550220bc4971acaa8cd4218e2 100644 (file)
@@ -47,11 +47,11 @@ Note_performer::create_audio_elements ()
       while (note_evs_.size ())
        {
          Music* n = note_evs_.pop ();
-         Pitch *pit =  unsmob_pitch (n->get_mus_property ("pitch"));
+         SCM pit =  n->get_mus_property ("pitch");
 
-         if (pit)
+         if (Pitch * pitp = unsmob_pitch (pit))
            {
-             Audio_note* p = new Audio_note (*pit,  n->get_length (), transposing_i);
+             Audio_note* p = new Audio_note (*pitp,  n->get_length (), transposing_i);
              Audio_element_info info (p, n);
              announce_element (info);
              notes_.push (p);
index 91e83eed8d936761bde937f54e32c9fae2616b96..e9024a2e7e183fa890357935ade92c9da1f6b9ad 100644 (file)
@@ -893,7 +893,7 @@ Composite_music:
                scm_gc_unprotect_object ($2->self_scm ());
                $$ = unsmob_music (res);
                scm_gc_protect_object (res);
-               $$->set_spot (THIS->here_input())
+               $$->set_spot (THIS->here_input());
        }
        | PARTCOMBINE Music Music {
                static SCM proc;
index 859a9945bbc5aa4dc2fcaa34c414a4d43266bae5..1c5e99f0665b887646b21b7b87c52d67d7de1731 100644 (file)
@@ -93,9 +93,7 @@ Staff_performer::stop_translation_timestep ()
   /*
     UGH. -> don't use eval.
   */
-  
   static SCM proc;
-
   if (!proc)
     proc = scm_primitive_eval (ly_symbol2scm ("percussion?"));
   
index cc4ad8e7ef533dd3ae1db93233d42eb33127fd8c..bf6bca07443989aba2b678d648a2afc26b92feeb 100644 (file)
@@ -148,6 +148,83 @@ drumPitchNames =
    (de . fivedown)
    )
 
+midiDrumPitches = #`(
+       (acousticbassdrum . ,(ly:make-pitch -3 6 NATURAL))
+       (bassdrum . ,(ly:make-pitch -2 0 NATURAL))
+       (hisidestick . ,(ly:make-pitch -3 6 DOUBLE-SHARP))
+       (sidestick . ,(ly:make-pitch -2 0 SHARP))
+       (losidestick . ,(ly:make-pitch -2 1 FLAT))
+       (acousticsnare . ,(ly:make-pitch -2 1 NATURAL))
+       (snare . ,(ly:make-pitch -2 2 DOUBLE-FLAT))
+       (handclap . ,(ly:make-pitch -2 1 SHARP))
+       (electricsnare . ,(ly:make-pitch -2 2 NATURAL))
+       (lowfloortom . ,(ly:make-pitch -2 3 NATURAL))
+       (closedhihat . ,(ly:make-pitch -2 3 SHARP))
+       (hihat . ,(ly:make-pitch -2 4 FLAT))
+       (highfloortom . ,(ly:make-pitch -2 4 NATURAL))
+       (pedalhihat . ,(ly:make-pitch -2 4 SHARP))
+       (lowtom . ,(ly:make-pitch -2 5 NATURAL))
+       (openhihat . ,(ly:make-pitch -2 5 SHARP))
+       (halfopenhihat . ,(ly:make-pitch -2 5 SHARP))
+       (lowmidtom . ,(ly:make-pitch -2 6 NATURAL))
+       (himidtom . ,(ly:make-pitch -1 0 NATURAL))
+       (crashcymbala . ,(ly:make-pitch -1 0 SHARP))
+       (crashcymbal . ,(ly:make-pitch -1 1 FLAT))
+       (hightom . ,(ly:make-pitch -1 1 NATURAL))
+       (ridecymbala . ,(ly:make-pitch -1 1 SHARP))
+       (ridecymbal . ,(ly:make-pitch -1 2 FLAT))
+       (chinesecymbal . ,(ly:make-pitch -1 2 NATURAL))
+       (ridebell . ,(ly:make-pitch -1 3 NATURAL))
+       (tambourine . ,(ly:make-pitch -1 3 SHARP))
+       (splashcymbal . ,(ly:make-pitch -1 4 NATURAL))
+       (cowbell . ,(ly:make-pitch -1 4 SHARP))
+       (crashcymbalb . ,(ly:make-pitch -1 5 NATURAL))
+       (vibraslap . ,(ly:make-pitch -1 5 SHARP))
+       (ridecymbalb . ,(ly:make-pitch -1 6 NATURAL))
+       (mutehibongo . ,(ly:make-pitch -1 6 SHARP))
+       (hibongo . ,(ly:make-pitch 0 0 NATURAL))
+       (openhibongo . ,(ly:make-pitch 0 1 DOUBLE-FLAT))
+       (mutelobongo . ,(ly:make-pitch -1 6 DOUBLE-SHARP))
+       (lobongo . ,(ly:make-pitch 0 0 SHARP))
+       (openlobongo . ,(ly:make-pitch 0 1 FLAT))
+       (mutehiconga . ,(ly:make-pitch 0 1 NATURAL))
+       (muteloconga . ,(ly:make-pitch 0 2 DOUBLE-FLAT))
+       (openhiconga . ,(ly:make-pitch 0 1 SHARP))
+       (hiconga . ,(ly:make-pitch 0 2 FLAT))
+       (openloconga . ,(ly:make-pitch 0 1 DOUBLE-SHARP))
+       (loconga . ,(ly:make-pitch 0 2 NATURAL))
+       (hitimbale . ,(ly:make-pitch 0 3 NATURAL))
+       (lotimbale . ,(ly:make-pitch 0 3 SHARP))
+       (hiagogo . ,(ly:make-pitch 0 4 NATURAL))
+       (loagogo . ,(ly:make-pitch 0 4 SHARP))
+       (cabasa . ,(ly:make-pitch 0 5 NATURAL))
+       (maracas . ,(ly:make-pitch 0 5 SHARP))
+       (shortwhistle . ,(ly:make-pitch 0 6 NATURAL))
+       (longwhistle . ,(ly:make-pitch 1 0 NATURAL))
+       (shortguiro . ,(ly:make-pitch 1 0 SHARP))
+       (longguiro . ,(ly:make-pitch 1 1 NATURAL))
+       (guiro . ,(ly:make-pitch 1 0 DOUBLE-SHARP))
+       (claves . ,(ly:make-pitch 1 1 SHARP))
+       (hiwoodblock . ,(ly:make-pitch 1 2 NATURAL))
+       (lowoodblock . ,(ly:make-pitch 1 3 NATURAL))
+       (mutecuica . ,(ly:make-pitch 1 3 SHARP))
+       (opencuica . ,(ly:make-pitch 1 4 NATURAL))
+       (mutetriangle . ,(ly:make-pitch 1 4 SHARP))
+       (triangle . ,(ly:make-pitch 1 4 DOUBLE-SHARP))
+       (opentriangle . ,(ly:make-pitch 1 5 NATURAL))
+       
+       ;; "transposing" pitches:
+       (oneup . ,(ly:make-pitch 0 1 NATURAL))
+       (twoup . ,(ly:make-pitch 0 2 NATURAL))
+       (threeup . ,(ly:make-pitch 0 3 NATURAL))
+       (fourup . ,(ly:make-pitch 0 4 NATURAL))
+       (fiveup . ,(ly:make-pitch 0 5 NATURAL))
+       (onedown . ,(ly:make-pitch -1 6 NATURAL))
+       (twodown . ,(ly:make-pitch -1 5 NATURAL))
+       (threedown . ,(ly:make-pitch -1 4 NATURAL))
+       (fourdown . ,(ly:make-pitch -1 3 NATURAL))
+       (fivedown . ,(ly:make-pitch -1 2 NATURAL))
+)
 
 
 #(map
index 244f0eb5e4f1b3e13ec41fa9c1032a3afbdcb501..9255018689bc8ab9e52083f997822e12fb66a842 100644 (file)
@@ -16,6 +16,7 @@
 \translator {
     \StaffContext
     \name DrumStaff
+    midiInstrument = #"drums"
     \accepts DrumVoice
 }
 
@@ -30,6 +31,8 @@
 
 \translator {
     \VoiceContext
+    \remove "Note_performer"
+    \consists "Drum_note_performer" 
     \name DrumVoice
 }
 
     \accepts RhythmicStaff
     \accepts ChordNames
     \accepts FiguredBass
-
+    \accepts LyricsVoice
     \alias "Timing"
     \consists "Timing_translator"
     \consists "Swallow_performer"
     
     dynamicAbsoluteVolumeFunction = #default-dynamic-absolute-volume
     instrumentEqualizer = #default-instrument-equalizer
+    drumPitchTable = #(alist->hash-table midiDrumPitches) 
 }
 
 
index c10fe8241cb09a0eb92061a158db0f7177aa7cd4..5a73f5155371678eb7916e3a04b58c2a77aa90cb 100644 (file)
 
 
 (if (not (defined? 'hash-table?))      ; guile 1.6 compat
-    (define hash-table? vector?))
+    (begin
+      (define hash-table? vector?)
 
-(define-public (hash-table->alist t)
-  "Convert table t to list"
-  (apply append
-        (vector->list t)
-  ))
+      (define-public (hash-table->alist t)
+       "Convert table t to list"
+       (apply append
+              (vector->list t)
+              )))
+
+    ;; native hashtabs.
+    (begin
+      (define-public (hash-table->alist t)
+
+       (hash-fold (lambda (k v acc) (acons  k v  acc))
+                  '() t)
+       )
+      ))
 
 ;; todo: code dup with C++. 
 (define-public (alist->hash-table l)
index b1b10fd05c605c6e5824d465810f8778d8ff9ff0..63da9d1a4f11c413f30731c87af24214bf6a6350 100644 (file)
@@ -266,8 +266,8 @@ returns whether the instrument should use midi channel 9
          (entry (assoc inst instrument-names-alist))
        )
      (and entry (>= (cdr entry) 32768))
-  )
-)
+  ))
+
 (define-public (midi-program instrument)
 "
 returns the program of the instrument