[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Denemo-devel] Using call_out_to_guile() for built-in denemo command
From: |
Jeremiah Benham |
Subject: |
Re: [Denemo-devel] Using call_out_to_guile() for built-in denemo commands |
Date: |
Thu, 11 Mar 2010 11:11:45 -0600 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Thu, Mar 11, 2010 at 11:08:08AM +0000, Richard Shann wrote:
>
> >(Of course, we should be calling directly in C, not via guile, but that
> is another story)
> So, I tracked this through, and (call_out_to_guile "d-Insert2") is
> calling InsertDur2().
> So you should be able to make a call InsertDur2(NULL, NULL) to insert a
> quarter note at the cursor position, with creation of a new measure if
> the cursor position is at the end of the measure.
>
> Slightly better might be code like this
>
> DenemoScriptParam param;
> InsertDur2(NULL, ¶m);
Doing this did not help. I am not sure how to operate DenemoScriptParam.
I am attatching my current importmidi.c/h so you can put this into context.
>
> and then you can examine param.status to find out what happened.
> (This is off the top of my head, so E&OE)
So here is the code that is giving me trouble:
static void
insert_note_into_score(gint pitch, notetype length)
{
DenemoGUI *gui = Denemo.gui;
DenemoStaff *curstaffstruct = (DenemoStaff *) gui->si->currentstaff->data;
gint i;
/* 0-8 accepted bellow */
#if 0
gchar *proc = g_strdup_printf("(d-Insert%d)", length.notetype);
call_out_to_guile(proc);
g_free(proc);
#endif
#if 1
DenemoScriptParam param;
InsertDur2(NULL, ¶m);
g_debug("DenemoScriptParam = %s",((DenemoScriptParam) param).string->str);
#endif
/* get correct note name */
gint key = curstaffstruct->keysig.number;
harmonic enote = enharmonic (pitch, (gint) key);
gchar *name = mid_c_offsettolily (enote.pitch, enote.enshift);
/* Rename note to the correct note */
gchar *accidental = g_strdup_printf("(d-ChangeChordNotes \"%s\")", name);
call_out_to_guile(accidental);
g_free(accidental);
/* Add dots */
for (i=0;i<length.numofdots;i++)
add_dot_key (gui);
}
Thanks,
Jeremiah
>
> Richard
>
>
>
>
> _______________________________________________
> Denemo-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/denemo-devel
importmidi.c
Description: Text Data
importmidi.h
Description: Text Data