<?xml version="1.0"?>
<Denemo>
  <merge>
    <title>A Denemo Keymap</title>
    <author>AT, JRR, RTS</author>
    <map>
      <row>
        <after>ReloadDrumHash</after>
        <action>ConvertDrum2GmSingleSelection</action>
        <scheme>
   (if (defined? 'DrumHash)
	   #t
	  (begin  (display "\nNo DrumHash existent. Force Reload!\n")    (d-ReloadDrumHash) ))
  

(define (ConvertDrumGm2UserSingleNote)
(if (and (d-GetNotes) (hashq-ref DrumHash (string-&gt;symbol (d-GetHighestNote))) (hashq-ref DrumHash (string-&gt;symbol (d-GetLowestNote))))
 
(let  ((newDrumList (string-tokenize(d-GetNotes)) ))

 (let transformChordList ((i 0))
    (if (&lt;= i (-(length newDrumList )1)) 
       (begin
         (set! newDrumList (replace-nth newDrumList i (hashq-ref DrumHash (string-&gt;symbol (list-ref newDrumList i)))))
          (transformChordList (+ i 1) )
        )
      )
  (d-ChangeChordNotes (string-join newDrumList)))

)

))

(if (defined? 'DrumHash)
  (SingleAndSelectionSwitcher "(ConvertDrumGm2UserSingleNote)"  "(ConvertDrumGm2UserSingleNote)")
  (begin (display "No DrumHash was loaded. Please copy and use the template that comes with Denemo. Abort.\n")#f)
)
(d-RefreshDisplay)


</scheme>
        <label>Convert GM-Drum to User-Drum</label>
        <tooltip>Converts between the midi-drum notation and a user-drum notation. The user can set his/her drummap in a template in ~/.denemo/templates or choose any other copy he made of the template file to have drummaps for different drummers avaible.</tooltip>
      </row>
    </map>
  </merge>
</Denemo>
