denemo-devel
[Top][All Lists]
Advanced

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

Re: [Denemo-devel] Augmentation / Diminuation Prototype


From: Richard Shann
Subject: Re: [Denemo-devel] Augmentation / Diminuation Prototype
Date: Mon, 20 Jul 2009 15:14:21 +0100

OK, I think the bit of the picture you are missing is the command
d-InitializeScript
This executes a script called init.scm in the same directory as the
command it is passed. (see the docs).
The only example I can recall is in Edit->Transpose where the
TransposeNote command begins with this:

(if (not (defined? 'Transpose::init))
    (d-InitializeScript CurrentScript))

this tests to see if init.scm in Edit/Transpose has been run and if not
runs it.

The script init.scm defines all the functions needed by the Transpose
routines.

So if you wanted to write a generic procedure to put a tempo marking in
the music and set the MIDI tempo to a value you could put the procedure
to do it in an init.scm script, and then invoke that procedure with its
two parameters from the scripts that do Adagio, Allegro etc.
You could also then invoke it for a command that allowed the user to
choose the wording of the dynamic and the tempo change, although editing
an existing one might be a more natural route for that (that is the
editscript for Tempo should have procedures for changing these).

This is the advanced Denemo Scripting course here :-) But it is there
ready for when you want to use it.

BTW, the docs say that the d-InitializeScript is used for heavy
initialization tasks - perhaps we will use it more widely, to avoid
repeated code?

Richard



On Mon, 2009-07-20 at 11:51 +0200, Nils Gey wrote:
> > > Btw. What about giving "command line arguments" to scheme scripts? 
> > That is a just exactly a scheme procedure. Try this:
> > 
> > (define (myproc a b)
> >     (a 4 b))
> > 
> > 
> > (display (myproc * 8))
> > displays 32
> > 
> > (display (myproc / 8))
> > displays 1/2
> > 
> > being 4*8 and 4/8 respectively
> > 
> > Richard
> 
> Sorry, I think we still misunderstood. What you described is of course true, 
> but I already know this. For two tasks wth one script, depending on the users 
> initial input (the keypress or menu-entry), this is not enough. 
> 
> It would be nice if I could choose initial parameters to use in my script at 
> the point where I create my menu-entry. A new field additional to Name, Label 
> and "What does it do": 
> 
> "Parameters (can be blank) divided by , "
> 
> And for the aug/dim script I could use the same script and create two menu 
> items from it, each with a differet initial parameter (to choose * or / )
> 
> Nils
> 
> 
> > 
> > > Or in this case, if you create a new menu item from a script how about 
> > > giving args to it. So you can do one menu-entry with "scriptX augment" 
> > > and the other "scriptX diminish" and its the same script. Maybe usefull 
> > > for other group scripts like dynamics.
> > > 
> > > Nils
> > 
> > 
> > 
> > _______________________________________________
> > Denemo-devel mailing list
> > address@hidden
> > http://lists.gnu.org/mailman/listinfo/denemo-devel
> > 
> 
> 





reply via email to

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