[Top][All Lists]

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

Re: [Denemo-devel] Midi shortcuts

From: R. Mattes
Subject: Re: [Denemo-devel] Midi shortcuts
Date: Tue, 10 May 2011 11:40:57 +0200

On Tue, 10 May 2011 09:02:45 +0100, Richard Shann wrote
> This sounds really great. I should mention that up until recently I did
> not consider making a round trip to scheme for every note played on the
> MIDI keyboard as the handling of MIDI-in was in a very bad state. 

Is there any factual evidence for this claim? After all, running a hook 
only involves a 'scm_car' on the function stack and a 'scm_apply' on the
returned function for the common case of a single handler function. 
That's not really a high penalty, esp. considering the Quadrilles the current
code dances ... A single string eval would have a magnitude higher performance
hit. Even in venerable Emacs every single keypress dribbles through hooks and
layered keybindings - in Elisp!
> The
> code still has the response to all note on and off messages routed 
> in C to actions while other messages call a scheme hook (interpreted 
> strings ...) There is a similar story with pc-keyboard in for which 
> I wrote a proposal

I'm tempted to use the same mechanism for keyboard input as well. 
> It may be that we will need to make scheme hooks for MIDI note events
> optional - else playing-in at full speed may not work properly on slower
> machines.

What's your fear (or your goal) ? Midi events should be collected by a
dedicated thread anyway (otherwise you might loose events due to GUI
code running in the same thread) [1]. The C-level event handler should fetch
events from that queue and feed it to the handlers. Now, if your box is
to slow for keeping up with the incomming events, that's bad but there is
little you can do about that - the handling will fall behind the performance
and at some point you'll start loosing midi events (because the queue gets
filled). But that's not a problem of calling _one_ scheme function, 
scm_apply... is pretty fast. 

Cheers, RalfD 

[1] at least in Jack Midi events are timestamped so you don't loose 
timing information.
R. Mattes -
Hochschule fuer Musik Freiburg

reply via email to

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