denemo-devel
[Top][All Lists]
Advanced

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

Re: [Denemo-devel] Scheme book


From: Jeremiah Benham
Subject: Re: [Denemo-devel] Scheme book
Date: Tue, 26 Aug 2008 23:09:25 -0500

On Tue, 2008-08-26 at 13:28 +0100, Richard Shann wrote:

> I think we should break it down further
> 
> void note2lilynotename(struct note*, GString *ret)
> void *note2lilyaccidental(struct note*, GString *ret)
> void *chord2lilyduration(struct chord *, GString *ret)

I created the above interfaces in addition to:
void *note2lilyoctave(struct note*, GString *ret)

should *chord2lilyduration assign just the base direction correct?
I am assuming thats what you mean so I am creating a function called:

void *chord2lilynumdots(struct chord *, GString *ret)

It assigns the number of dots to add to the note duration. 

> The scheme interface would be to functions declared thus
> gchar *lilyNoteName(void)        yields   "a"   for example
> gchar *lilyNoteAccidental(void)      yields   "eses" for example
> gchar *lilyNoteOctave(void)    yields ",," for example
> gchar *lilyNoteDuration(void)  yields "8." for example, or perhaps
> lilyNoteBaseDuration() and lilyNoteDots()
> These functions would all apply to the note at the cursor, returning the
> empty string (not NULL) if the cursor is not on an object, or not on a
> chord or not on a chord with notes or cursor_y is not on a note in the
> chord.

So we have two methods of note entry then? Moving the cursor method and
the other directly assigning it? 
> 
> To support this we will need additional up/down cursor navigation
> functions: GoToHighestNote, NextNote, GoToLowestNote, which move the
> cursor if the current object satisfies all the conditions, that is:
> the gui->si->currentobject is not NULL, and is a chord and is a chord
> with notes.
> (As with many of our callbacks, we will want to return a status, to
> indicate whether the cursor moved).
> 
> Here is the (rough) definition of the first of the interface functions
> (off the top of my head, there's all the casts etc to do):
> 
> gchar *lilyNoteName(void){
> GString *ret = g_string_new("");
> DenemoGUI *gui = Denemo.gui;
> if(gui->si && gui->si->currentobject && typeofcurrentobject==CHORD &&
> gui->si->currentobject->object->notes) {
>       find note at gui->si->cursor_y
>       if(found) note2lilynotename(struct note*, ret)
>       }
> return g_string_free(ret, FALSE);//I haven't looked this up, but I take
> it you did!!! I mean return ret->str freeing ret
> }

Yes, I looked this up. IIRC If you make it (ret, TRUE). It deletes the
gchar * inside the GString. 

Jeremiah


> 
> 
> There should be predicates in Scheme:
> 
> SchemeChord?   #t if current object is Chord* and there are notes
> SchemeRest?     #t if current object is chord* and notes==NULL
> SchemeNote?   #t if  SchemeChord? and the cursor is on a note
> 
> which will need the obvious C-functions behind them, testing
> gui->si->currentobject.
> 
> 
> In Scheme we will write convenience functions, e.g. NextNote would do
> NextObject until SchemeChord? is #t then GoToHighestNote
> returning a status to indicate success.
> Richard
> 
> 
> 
> 
> 
> 
> 
> 
> 





reply via email to

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