denemo-devel
[Top][All Lists]
Advanced

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

Re: [Denemo-devel] Midi shortcuts


From: Ralf Mattes
Subject: Re: [Denemo-devel] Midi shortcuts
Date: Sat, 7 May 2011 11:58:16 +0000 (UTC)
User-agent: Pan/0.132 (Waxed in Black)

On Sat, 07 May 2011 10:38:03 +0100, Richard Shann wrote:

> No, it's just me - Nils understood you and told me on irc #denemo There
> are no commands yet to construct MIDI shortcuts (still less built-in
> methods), so you have to write a bit of scheme to do it. The hook for
> this is in denemo.scm and that was where I placed my bit of scheme this
> morning.
> This is the sort of thing you can see in denemo.scm
> 
> (define Pitchbend::commandUp "(d-CursorRight)")

??? Why isn't the value of commandUp a function? Isn't that the whole point 
of functional programming? :-)
 
> If you redefined Pitchbend::commandUp to be some other string that would
> be executed on the getting the Pitchbend up message from MIDI-in. Only a
> few of these control messages have been named in denemo.scm so far.
> 
> This itself is a layer over the primitive response to MIDI in's control
> messages.
> The primitive level is that when a control message is received the
> procedure MIDI-shortcut::controller is executed and if the value it
> returns is the name of a denemo action this is action is performed.
> (Well, I have just trawled through the code to find this out. It needed
> writing down somewhere!)

Urghs! Just had a glance at the c code. Why are you going back and forth to
_strings_ - this is so TCLish ... Why not use scm_apply_<n>  od scm_call_<n>?
For example get_midi_control_command could be written like this (of course, I'd
prefer it to take SCM values as input and return a SCM function value ...):


gchar *get_midi_control_command(guchar type, guchar value) {
    static SCM lookup_fun = scm_c_lookup("MIDI-shortcut::controller");
    gchar  r_val = NULL;
    SCM    res;

    scm_dynwind_begin(0);
    res = scm_call_2(lookup_fun, SCM_I_MAKINUM(type), SCM_I_MAKINUM(value));
    if(scm_is_string(res)) {
        SCM2LSTRING(r_val, res);
    }
    scm_dynwind_end();
    return r_val;
}


Cheers, RalfD

> HTH
> Richard
> 
> 
> 
> 




reply via email to

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