diff -urN /home/rshann/denemo-cvs/denemo/ChangeLog ./ChangeLog --- /home/rshann/denemo-cvs/denemo/ChangeLog 2007-08-19 16:00:11.000000000 +0100 +++ ./ChangeLog 2007-08-19 11:30:17.000000000 +0100 @@ -1,29 +1,3 @@ -2007-08-14 - * fixed bug in view.c with closing the application via the gtk - interface - * Added more doxygen style comments to denemo_types.h - -2007-08-04 - * edited playbackprops.c to allow enter key to "ok" the dialog after - typing in a new tempo - * edited prefops.c to have the default version of lily to be 2.10 - * fixed wrong conditional in prefops.c in relatation to midiplayer - * wrote doxygen style comments to DenemoPrefs in denemo_types.h - -2007-08-03 - * applied patch from Richard Shann for a new input mode based of - precomposed rhythmic motives. - * patch modifies denemo_types.h, commandfuncs.c, commandfuncs.h, - denemoui.xml, draw.c, exportlilypond.c, kbd-custom.c, keyresponses.c - -2007-08-01 - * Placed doxygen style documentation in denemo_types.h and - denemo_objects.h DenemoScore->readonly is now gboolean instead of int. - I edited file.c to use TRUE/FALSE instead of int. - -2007-07-29 - * fixed bug in function dnm_setinitialkeysig in objops.c - 2007-06-22 * added dnm_addtone and dnm_newchord to denemo_api.h diff -urN /home/rshann/denemo-cvs/denemo/include/denemo/denemo_types.h ./include/denemo/denemo_types.h --- /home/rshann/denemo-cvs/denemo/include/denemo/denemo_types.h 2007-08-19 16:00:12.000000000 +0100 +++ ./include/denemo/denemo_types.h 2007-08-19 16:32:29.000000000 +0100 @@ -280,6 +280,7 @@ GString *denemopath; /**< path were denemo files are saved */ GQueue *history; /**< Queue to contain recently opened files */ keymap *the_keymap; /**< pointer to keymap data */ + keymap *standard_keymap; /* keymap to switch back to after using a special keymap */ GString *lilyversion; /**< Lilypoind Version */ }DenemoPrefs; @@ -548,6 +549,7 @@ gint plugincounter; DenemoPrefs *prefs; /**< And the DenemoPrefs pointer */ GtkWidget* articulation_palette; /**< Articulation palette window */ + gboolean pitch_recognition;/* toggle pitch recognition off/on */ input_mode mode; /**< Input mode for Score */ GtkWidget *progressbar; DenemoScore *si; diff -urN /home/rshann/denemo-cvs/denemo/keymaps/Makefile.am ./keymaps/Makefile.am --- /home/rshann/denemo-cvs/denemo/keymaps/Makefile.am 2007-01-24 20:05:42.000000000 +0000 +++ ./keymaps/Makefile.am 2007-08-19 11:30:18.000000000 +0100 @@ -1,5 +1,5 @@ dist_pkgdata_DATA = denemo.keymaprc french.keymaprc \ english.keymaprc italian.keymaprc \ - speedy.keymaprc + speedy.keymaprc RhythmKeymaprc diff -urN /home/rshann/denemo-cvs/denemo/keymaps/Makefile.in ./keymaps/Makefile.in --- /home/rshann/denemo-cvs/denemo/keymaps/Makefile.in 2007-08-19 15:31:49.000000000 +0100 +++ ./keymaps/Makefile.in 2007-08-19 16:28:09.000000000 +0100 @@ -202,7 +202,7 @@ top_srcdir = @top_srcdir@ dist_pkgdata_DATA = denemo.keymaprc french.keymaprc \ english.keymaprc italian.keymaprc \ - speedy.keymaprc + speedy.keymaprc RhythmKeymaprc all: all-am diff -urN /home/rshann/denemo-cvs/denemo/keymaps/RhythmKeymaprc ./keymaps/RhythmKeymaprc --- /home/rshann/denemo-cvs/denemo/keymaps/RhythmKeymaprc 1970-01-01 01:00:00.000000000 +0100 +++ ./keymaps/RhythmKeymaprc 2007-08-19 11:59:19.000000000 +0100 @@ -0,0 +1,1042 @@ + + + + Test + Adam Tee + + + CursorLeft + h + Shift+H + Left + KP_Left + + + CursorDown + Down + j + Shift+J + KP_Down + + + CursorUp + Up + KP_Up + k + Shift+K + + + CursorRight + Right + KP_Right + l + Shift+L + L + + + StaffUp + Ctrl+Up + Ctrl+k + + + StaffDown + Ctrl+j + Ctrl+Down + + + MeasureLeft + Ctrl+Left + Ctrl+h + + + MeasureRight + Ctrl+Right + Ctrl+l + + + ToNearestA + a + Shift+A + A + + + ToNearestB + b + Shift+B + B + + + ToNearestC + c + Shift+C + C + + + ToNearestD + d + Shift+D + D + + + ToNearestE + e + Shift+E + E + + + ToNearestF + f + Shift+F + F + + + ToNearestG + g + Shift+G + G + + + OctaveUp + apostrophe + + + OctaveDown + comma + + + InsertWholeNote + grave + 0 + KP_0 + + + InsertHalfNote + 1 + KP_1 + + + InsertQuarterNote + 2 + KP_2 + + + InsertEighthNote + 3 + KP_3 + + + InsertSixteenthNote + 4 + KP_4 + + + InsertThirtysecondNote + 5 + KP_5 + + + InsertSixtyfourthNote + 6 + KP_6 + + + InsertBlankWholeNote + + + InsertBlankHalfNote + + + InsertBlankQuarterNote + + + InsertBlankEighthNote + + + InsertBlankSixteenthNote + + + InsertBlankThirtysecondNote + + + InsertBlankSixtyfourthNote + + + ToggleRestMode + Escape + + + ToggleBlankMode + + + InsertWholeRest + Alt+grave + Alt+0 + Alt+KP_0 + Ctrl+KP_0 + + + InsertHalfRest + Alt+1 + Alt+KP_1 + Ctrl+KP_1 + + + InsertQuarterRest + Alt+2 + Alt+space + Alt+KP_2 + Ctrl+KP_2 + + + InsertEighthRest + Alt+3 + Alt+KP_3 + Ctrl+KP_3 + + + InsertSixteenthRest + Alt+4 + Alt+KP_4 + Ctrl+KP_4 + + + InsertThirtysecondRest + Alt+5 + Alt+KP_5 + Ctrl+KP_5 + + + InsertSixtyfourthRest + Ctrl+KP_7 + Ctrl+7 + Ctrl+9 + Ctrl+KP_9 + Shift+F6 + Alt+6 + Alt+KP_6 + Ctrl+KP_6 + + + InsertDuplet + Ctrl+0 + + + InsertTriplet + Ctrl+1 + + + StartTriplet + KP_7 + + + EndTuplet + KP_8 + + + InsertQuadtuplet + Ctrl+2 + + + InsertQuintuplet + Ctrl+3 + + + InsertSextuplet + Ctrl+5 + + + InsertSeptuplet + Ctrl+6 + + + AddTone + Return + + + RemoveTone + Shift+Return + Shift+KP_Enter + Shift+KP_Add + + + Sharpen/StemDown + Shift+plus + numbersign + KP_Add + + + Flatten/StemUp + minus + KP_Subtract + + + AddDot + period + KP_Multiply + + + RemoveDot + Shift+greater + + + ToggleTie + equal + + + DeleteObject + x + Delete + + + DeletePreviousObject + Shift+X + BackSpace + + + InsertMeasure + m + + + AppendMeasure + Shift+M + + + DeleteMeasure + Ctrl+Delete + Ctrl+x + + + ShrinkMeasures + Ctrl+Shift+Left + Ctrl+Shift+KP_4 + + + WidenMeasures + Ctrl+Shift+Right + Ctrl+Shift+KP_6 + + + ShorterStaffs + Ctrl+Shift+Up + Ctrl+Shift+KP_8 + + + TallerStaffs + Ctrl+Shift+Down + Ctrl+Shift+KP_2 + + + InsertTrebleClef + + + InsertBassClef + + + Insertg8clef + + + InsertAltoClef + + + InsertTenorClef + + + InsertSopranoClef + + + SetInitialTrebleClef + + + SetInitialBassClef + + + SetInitialg8clef + + + SetInitialAltoClef + + + SetInitialTenorClef + + + SetInitialSopranoClef + + + Insert22Time + + + Insert32Time + + + Insert42Time + + + Insert44Time + + + Insert34Time + + + Insert24Time + + + Insert64Time + + + Insert38Time + + + Insert68Time + + + Insert128Time + + + Insert98Time + + + Set22Time + + + Set32Time + + + Set42Time + + + Set44Time + + + Set34Time + + + Set24Time + + + Set64Time + + + Set38Time + + + Set68Time + + + Set128Time + + + Set98Time + + + InsertCmaj + + + InsertGmaj + + + InsertDmaj + + + InsertAmaj + + + InsertEmaj + + + InsertBmaj + + + InsertFSharpmaj + + + InsertCSharpmaj + + + InsertFmaj + + + InsertBflatmaj + + + InsertEflatmaj + + + InsertAflatmaj + + + InsertDflatmaj + + + InsertGflatmaj + + + InsertCflatmaj + + + InsertAmin + + + InsertEmin + + + InsertBmin + + + InsertFSharpmin + + + InsertCSharpmin + + + InsertGSharpmin + + + InsertDSharpmin + + + InsertASharpmin + + + InsertDmin + + + InsertGmin + + + InsertCmin + + + InsertFmin + + + InsertBflatmin + + + InsertEflatmin + + + InsertAflatmin + + + SetInitialCmaj + + + SetInitialGmaj + + + SetInitialDmaj + + + SetInitialAmaj + + + SetInitialEmaj + + + SetInitialBmaj + + + SetInitialFSharpmaj + + + SetInitialCSharpmaj + + + SetInitialFmaj + + + SetInitialBflatmaj + + + SetInitialEflatmaj + + + SetInitialAflatmaj + + + SetInitialDflatmaj + + + SetInitialGflatmaj + + + SetInitialCflatmaj + + + SetInitialAmin + + + SetInitialEmin + + + SetInitialBmin + + + SetInitialFSharpmin + + + SetInitialCSharpmin + + + SetInitialGSharpmin + + + SetInitialDSharpmin + + + SetInitialASharpmin + + + SetInitialDmin + + + SetInitialGmin + + + SetInitialCmin + + + SetInitialFmin + + + SetInitialBflatmin + + + SetInitialEflatmin + + + SetInitialAflatmin + + + SetMark + Ctrl+space + + + UnsetMark + Ctrl+Shift+space + + + ToggleBeginSlur + Shift+parenleft + + + ToggleEndSlur + Shift+parenright + + + ToggleStartCrescendo + + + ToggleEndCrescendo + + + ToggleStartDiminuendo + + + ToggleEndDiminuendo + + + ToggleAccent + + + ToggleFermata + Shift+asterisk + + + ToggleStaccato + + + ToggleTenuto + + + ToggleTrill + + + ToggleTurn + + + ToggleMordent + + + ToggleStaccatissimo + + + ToggleCoda + + + ToggleFlageolet + Shift+bar + + + ToggleOpen + backslash + + + TogglePrallMordent + z + + + TogglePrallPrall + Shift+Z + + + TogglePrall + Ctrl+Shift+bar + + + ToggleReverseTurn + Ctrl+backslash + + + ToggleSegno + Alt+backslash + + + ToggleSforzato + + + ToggleStopped + Alt+Shift+bar + + + ToggleThumb + Ctrl+z + + + ToggleUpprall + Ctrl+Shift+Z + + + ToggleArpeggio + + + SetGrace + + + PlayLocal + + + ForceCaution + + + ChangePitch + + + DoubleBar + + + EndBar + + + OpenRepeat + + + CloseRepeat + + + OpenCloseRepeat + + + FirstRhythm + + + NextRhythm + space + KP_Enter + + + AppendMesauresToScore + + + File + + + New + + + NewfromTemplate + + + NewWindow + + + Open + + + OpeninNewWindow + + + Save + + + SaveAs + + + SaveParts + + + ExportPDF + + + ScoreConfiguration + + + Print + + + Close + + + Quit + + + Edit + + + Undo + + + Redo + + + Copy + + + Cut + + + Paste + + + Scoreproperties + + + SaveSelection + + + Preferences + + + SetKeybindings + + + LoadPlugins + + + UnloadPlugins + + + ListPlugins + + + ListAvailablePlugins + + + View + + + Mode + + + Insert + + + Replace + + + Blank + + + Rest + + + Default + + + Staff + + + AddBeforeCurrentStaff... + + + AddAfterCurrentStaff... + + + AddinInitialPosition... + + + AddinLastPosition... + + + DeleteStaffBefore + + + DeleteStaff + Ctrl+Shift+Delete + Ctrl+Shift+X + + + DeleteStaffAfter + + + AddVoicetoCurrentStaff... + + + AddLyricStaff... + + + AddFiguredBassStaff... + + + AddChordstoStaff... + + + StaffProperties + + + Insert + + + Clef + + + SetClef + + + InsertClefChange + + + Key + + + InitialKey + + + InsertKeyChange + + + TimeSignature + + + InitialTimeSignature + + + InsertTimeSignatureChange + + + Notehead + + + InsertStemDirective + + + Lyrics + + + InsertLyric + + + EditLyric + + + EditFiguredBass + + + EditChords + + + InsertDynamic + + + InsertBarline + + + Navigation + + + GoToMeasure... + + + GoToBeginning + + + GoToEnd + + + GoToNextScore + + + Playback + + + Play + + + PlayusingCSound... + + + PlaybackProperties + + + Help + + + Help + + + About + + + Bookmarks + + + AddBookmark + + + GotoBookmark + + + + + + OpenRecent + + + Fullnote + + + Halfnote + + + Quarternote + + + Eightnote + + + Sixteenthnote + + + Fullrest + + + Halfrest + + + Quarterrest + + + Eightrest + + + Sixteenthrest + + + Createarhythm + + + Deletearhythm + + + + diff -urN /home/rshann/denemo-cvs/denemo/pixmaps/icon-note-3dot.svg ./pixmaps/icon-note-3dot.svg --- /home/rshann/denemo-cvs/denemo/pixmaps/icon-note-3dot.svg 1970-01-01 01:00:00.000000000 +0100 +++ ./pixmaps/icon-note-3dot.svg 2007-08-19 11:30:18.000000000 +0100 @@ -0,0 +1,92 @@ + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff -urN /home/rshann/denemo-cvs/denemo/src/audiocapture.c ./src/audiocapture.c --- /home/rshann/denemo-cvs/denemo/src/audiocapture.c 1970-01-01 01:00:00.000000000 +0100 +++ ./src/audiocapture.c 2007-08-19 11:30:20.000000000 +0100 @@ -0,0 +1,142 @@ +/* + * audiocapture.c + * Hacked from patest_record.c + * Record input into an array. + * Save array to a file. + * Playback recorded data. + * + * Author: Phil Burk http://www.softsynth.com + * + * This program uses the PortAudio Portable Audio Library. + * For more information see: http://www.portaudio.com + * Copyright (c) 1999-2000 Ross Bencina and Phil Burk + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * Any person wishing to distribute modifications to the Software is + * requested to send the modifications to the original developer so that + * they can be incorporated into the canonical version. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ +#include +#include +#include +#include "portaudio.h" + +/* #define SAMPLE_RATE (17932) /* Test failure to open with this value. */ +#define SAMPLE_RATE DENEMO_SAMPLE_RATE +#define NUM_SECONDS (10) + + +#define PA_SAMPLE_TYPE paUInt8 +typedef DENEMO_SAMPLE_TYPE SAMPLE; + + +AubioCallback *aubio_routine; +typedef struct +{ + int frameIndex; /* Index into sample array. */ + int maxFrameIndex; + int samplesPerFrame; + SAMPLE *recordedSamples; +} paTestData; +/* This routine will be called by the PortAudio engine when audio is needed. +** It may be called at interrupt level on some machines so don't do anything +** that could mess up the system like calling malloc() or free(). +*/ + + +static int recordCallback( void *inputBuffer, void *outputBuffer, + unsigned long framesPerBuffer, + PaTimestamp outTime, void *userData ) +{ + + SAMPLE *rptr = (SAMPLE*)inputBuffer; + + return aubio_routine(&rptr, NULL, framesPerBuffer); +} + + + +/****************************************************************** +with param FN non null, start audio capture with FN as callback +else shutdown audio capture. +return 0 for success +*/ + + +int pa_main(AubioCallback *fn) +{ + static PortAudioStream *stream; + PaError err; + paTestData data; + int i; + int totalFrames; + int numSamples; + int numBytes; + SAMPLE max, average, val; + + if((fn==NULL) &&(stream)) { + err = Pa_StopStream( stream ); + if( err != paNoError ) goto error; + err = Pa_CloseStream( stream ); + if( err != paNoError ) goto error; + Pa_Terminate(); + return 0; + } + if(fn==NULL) + return -1; + aubio_routine = fn; + err = Pa_Initialize(); + if( err != paNoError ) goto error; + +/* Record some audio. -------------------------------------------- */ + err = Pa_OpenStream( + &stream, + Pa_GetDefaultInputDeviceID(), + 1, /* mono input */ + PA_SAMPLE_TYPE, + NULL, + paNoDevice, + 0, + PA_SAMPLE_TYPE, + NULL, + SAMPLE_RATE, + 1024, /* frames per buffer */ + 0, /* number of buffers, if zero then use default minimum */ + paClipOff, /* we won't output out of range samples so don't bother clipping them */ + recordCallback, + NULL ); + if( err != paNoError ) goto error; + + err = Pa_StartStream( stream ); + if( err != paNoError ) goto error; + printf("Now recording!!\n"); fflush(stdout); + return 0; + + +error: + Pa_Terminate(); + fprintf( stderr, "An error occured while using the portaudio stream\n" ); + fprintf( stderr, "Error number: %d\n", err ); + fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); + return -1; +} + diff -urN /home/rshann/denemo-cvs/denemo/src/audio.h ./src/audio.h --- /home/rshann/denemo-cvs/denemo/src/audio.h 1970-01-01 01:00:00.000000000 +0100 +++ ./src/audio.h 2007-08-19 11:30:19.000000000 +0100 @@ -0,0 +1,24 @@ +/* audio.h + * common header file for pitchentry, portaudio and aubio to share definitions + * + + * (c) 2007 Richard Shann + */ +#ifndef AUDIO_H +#define AUDIO_H + + +#define DENEMO_SAMPLE_RATE (44100) +#define DENEMO_SAMPLE_TYPE unsigned char + + +typedef int (AubioCallback)( + void *inputBuffer, void *outputBuffer, + unsigned long framesPerBuffer ); + +/* get pitch in Hz of new note from audio input or 0 if none */ +double get_pitch(void); +int initialize_pitch_recognition(void); +int terminate_pitch_recognition(void); + +#endif //AUDIO_H diff -urN /home/rshann/denemo-cvs/denemo/src/chordops.c ./src/chordops.c --- /home/rshann/denemo-cvs/denemo/src/chordops.c 2007-07-10 01:34:42.000000000 +0100 +++ ./src/chordops.c 2007-08-19 11:30:20.000000000 +0100 @@ -353,8 +353,28 @@ } /** - * Alter the pitch of the currentchord by setting - * the accidental value + * Set the accidental of note closest to mid_c_offset in + * the currentchord accidental = -2 ... +2 for double flat to double sharp + */ +void +changeenshift (DenemoObject * thechord, gint mid_c_offset, gint accidental) +{ + GList *tnode; /* Tone node to inflect */ + note *tone; + tnode = findclosest (((chord *) thechord->object)->tones, mid_c_offset); + if (tnode) + { + tone = (note *) tnode->data; + tone->enshift = accidental; + } +} + + +/** + * Alter the pitch the note closest to mid_c_offset in + * the currentchord by setting + * the accidental value + * one sharper or flatter subject to a limit of double sharp/flat */ void shiftpitch (DenemoObject * thechord, gint mid_c_offset, gint is_sharpening) @@ -373,6 +393,7 @@ } } + /** * Change the duration of the current chord * diff -urN /home/rshann/denemo-cvs/denemo/src/chordops.h ./src/chordops.h --- /home/rshann/denemo-cvs/denemo/src/chordops.h 2007-01-24 19:44:26.000000000 +0000 +++ ./src/chordops.h 2007-08-19 11:30:20.000000000 +0100 @@ -25,6 +25,8 @@ void shiftpitch (DenemoObject * mudelaobj, gint mid_c_offset, gint is_sharpening); +void +changeenshift (DenemoObject * thechord, gint mid_c_offset, gint accidental); void changedur (DenemoObject * thechord, gint baseduration, gint numdots); diff -urN /home/rshann/denemo-cvs/denemo/src/commandfuncs.c ./src/commandfuncs.c --- /home/rshann/denemo-cvs/denemo/src/commandfuncs.c 2007-08-19 16:00:12.000000000 +0100 +++ ./src/commandfuncs.c 2007-08-19 11:30:20.000000000 +0100 @@ -45,6 +45,8 @@ void nextrhythm(DenemoGUI *gui) { if(!gui->si->rhythmicsubmode) return; + if(!gui->si->rhythms) + return; if(gui->si->currhythm==NULL) gui->si->currhythm = g_list_last(gui->si->rhythms); gtk_widget_set_state(((RhythmPattern *)gui->si->currhythm->data)->button, GTK_STATE_NORMAL); @@ -435,21 +437,25 @@ gui->si->staffletter_y = note_value; gui->si->cursor_y = jumpcursor (gui->si->cursor_y, oldstaffletter_y, - gui->si->staffletter_y); - - /* in rhytmicsubmode we insert a note using the next step of the rhythm pattern */ + gui->si->staffletter_y); + + /* in rhythmicsubmode we insert a note using the next step of the rhythm pattern */ #define g (gui->si->rstep) - if(gui->si->rhythmicsubmode) { - if(g) { - GList *h; + if(gui->si->rhythmicsubmode && g) { + GList *start = g; + GList *h; + do { + if(g) { for(h = ((RhythmElement*)g->data)->functions;h;h=h->next) { ((GtkFunction)h->data)(gui), displayhelper(gui); } + h = ((RhythmElement*)g->data)->functions; g = g->next;/* list is circular */ - if(((RhythmElement*)g->data)->icon) { - gtk_tool_button_set_label(((RhythmPattern *)gui->si->currhythm->data)->button,((RhythmElement*)g->data)->icon); - - } + } + } while(g!=start && modifier_code(h->data)); + + if(((RhythmElement*)g->data)->icon) { + gtk_tool_button_set_label(((RhythmPattern *)gui->si->currhythm->data)->button,((RhythmElement*)g->data)->icon); } } #undef g @@ -577,22 +583,22 @@ nextmeasure (si, FALSE); switch (type) { - case 0: + case DUPLET: mudela_obj_new = newtupopen (3, 2); break; - case 1: + case TRIPLET: mudela_obj_new = newtupopen (2, 3); break; - case 2: + case QUADTUPLET: mudela_obj_new = newtupopen (3, 4); break; - case 3: + case QUINTUPLET: mudela_obj_new = newtupopen (4, 5); break; - case 4: + case SEXTUPLET: mudela_obj_new = newtupopen (4, 6); break; - case 5: + case SEPTUPLET: mudela_obj_new = newtupopen (4, 7); break; default: @@ -708,33 +714,63 @@ } /** - * Change the enharmonic shift of the tone closest to the cursor. The - * function double-checks to be sure that it's passed a chord, though - * at the moment (28 July 2000), it probably doesn't strictly need to - * + * Increment the enharmonic shift of the tone closest to the cursor. * @param si pointer to the DenemoScore structure - * @param amount enharmonic shifts distance + * @param direction, +ve for sharp -ve for flat */ void -changeenshift (DenemoScore * si, gint amount) +incrementenshift (DenemoScore * si, gint direction) { declarecurmudelaobj; int prognum; DenemoStaff *curstaffstruct; if (curmudelaobj && curmudelaobj->type == CHORD) { - shiftpitch (curmudelaobj, si->cursor_y, amount == 1); + shiftpitch (curmudelaobj, si->cursor_y, direction>0); showwhichaccidentals ((objnode *) si->currentmeasure->data, si->curmeasurekey, si->curmeasureaccs); find_xes_in_measure (si, si->currentmeasurenum, si->cursortime1, si->cursortime2); - + si->haschanged = TRUE; if (curmudelaobj->user_string) { g_free (curmudelaobj->user_string); curmudelaobj->user_string = NULL; } + curstaffstruct = (DenemoStaff *) si->currentstaff->data; + prognum = select_program (curstaffstruct->midi_instrument->str); + /* playnotes (si->prefs->immediateplayback, + *(chord *) curmudelaobj->object, prognum);*/ + + unre_data *data = (unre_data *) g_malloc (sizeof (unre_data)); + data->object = curmudelaobj; + data->position = si->cursor_x; + data->measurenum = si->currentmeasurenum; + data->staffnum = si->currentstaffnum; + data->action = ACTION_CHANGE; + update_undo_info (si, data); + } +} +/** + * Set the enharmonic shift of the tone closest to the cursor. + * @param si pointer to the DenemoScore structure + * @param enshift -2 .. +2 for double flat to double sharp FIXME make this a system wide enum + */ + +void +setenshift (DenemoScore * si, gint enshift) +{ + declarecurmudelaobj; + int prognum; + DenemoStaff *curstaffstruct; + if (curmudelaobj && curmudelaobj->type == CHORD) + { + changeenshift (curmudelaobj, si->cursor_y, enshift); + showwhichaccidentals ((objnode *) si->currentmeasure->data, + si->curmeasurekey, si->curmeasureaccs); + find_xes_in_measure (si, si->currentmeasurenum, si->cursortime1, + si->cursortime2); si->haschanged = TRUE; if (curmudelaobj->user_string) { @@ -745,14 +781,15 @@ prognum = select_program (curstaffstruct->midi_instrument->str); /* playnotes (si->prefs->immediateplayback, *(chord *) curmudelaobj->object, prognum);*/ + + unre_data *data = (unre_data *) g_malloc (sizeof (unre_data)); + data->object = curmudelaobj; + data->position = si->cursor_x; + data->measurenum = si->currentmeasurenum; + data->staffnum = si->currentstaffnum; + data->action = ACTION_CHANGE; + update_undo_info (si, data); } - unre_data *data = (unre_data *) g_malloc (sizeof (unre_data)); - data->object = curmudelaobj; - data->position = si->cursor_x; - data->measurenum = si->currentmeasurenum; - data->staffnum = si->currentstaffnum; - data->action = ACTION_CHANGE; - update_undo_info (si, data); } /** diff -urN /home/rshann/denemo-cvs/denemo/src/commandfuncs.h ./src/commandfuncs.h --- /home/rshann/denemo-cvs/denemo/src/commandfuncs.h 2007-08-19 16:00:12.000000000 +0100 +++ ./src/commandfuncs.h 2007-08-19 11:30:20.000000000 +0100 @@ -54,7 +54,8 @@ void shiftcursor (DenemoGUI *gui, gint note_value); - +void +setenshift (DenemoScore * si, gint enshift); void changeduration (DenemoScore *si, gint duration); @@ -63,7 +64,7 @@ tonechange (DenemoScore *si, gboolean remove); void -changeenshift (DenemoScore *si, gint amount); +incrementenshift (DenemoScore *si, gint direction); void change_stem_directive (DenemoScore *si, enum stemdirections amount); diff -urN /home/rshann/denemo-cvs/denemo/src/denemoui.xml ./src/denemoui.xml --- /home/rshann/denemo-cvs/denemo/src/denemoui.xml 2007-08-19 16:00:12.000000000 +0100 +++ ./src/denemoui.xml 2007-08-19 11:30:20.000000000 +0100 @@ -45,16 +45,17 @@ - + - - + - - + + + + @@ -68,7 +69,6 @@ - @@ -91,30 +91,27 @@ - + - + + - + + - + - - - - - - - - - + + + + + + + + diff -urN /home/rshann/denemo-cvs/denemo/src/draw.c ./src/draw.c --- /home/rshann/denemo-cvs/denemo/src/draw.c 2007-08-19 16:00:12.000000000 +0100 +++ ./src/draw.c 2007-08-19 11:30:20.000000000 +0100 @@ -21,7 +21,7 @@ #include "../pixmaps/toomany.xbm" #include "exportlilypond.h" /* to generate lily text for display */ #include "lyparserfuncs.h" /* to generate lily text for display */ - +#include "pitchentry.h" /** * defines function to choose the correct * depending upon the GTK version @@ -679,8 +679,15 @@ DenemoGUI *gui = (DenemoGUI *) data; /* Clear the backing pixmap */ + if(pitch_entry_active(gui)) { + gdk_draw_rectangle (gui->pixmap, + gcs_yellowgc(), + TRUE, + 0, 0, + widget->allocation.width, widget->allocation.height); - if (GTK_WIDGET_IS_SENSITIVE (gui->scorearea)) + } else { + if (GTK_WIDGET_IS_SENSITIVE (gui->scorearea) ) gdk_draw_rectangle (gui->pixmap, widget->style->white_gc, TRUE, @@ -692,6 +699,7 @@ TRUE, 0, 0, widget->allocation.width, widget->allocation.height); + } /* Draw the score */ draw_score (widget, gui); diff -urN /home/rshann/denemo-cvs/denemo/src/drawtuplets.c ./src/drawtuplets.c --- /home/rshann/denemo-cvs/denemo/src/drawtuplets.c 2007-01-24 19:44:26.000000000 +0000 +++ ./src/drawtuplets.c 2007-08-19 11:30:20.000000000 +0100 @@ -31,24 +31,35 @@ if (theobj->type == TUPOPEN) { - g_string_sprintf (tupopentext, _("Times %d/%d"), + g_string_sprintf (tupopentext, +#if 0 + _("Times %d/%d"), ((tupopen *) theobj->object)->numerator, - ((tupopen *) theobj->object)->denominator); - pango_layout_set_text (layout, tupopentext->str, -1); + ((tupopen *) theobj->object)->denominator +#else +"~" +#endif - pango_layout_set_font_description (layout, desc); - gdk_draw_layout (pixmap, gc, xx, y - 4, layout); +); + pango_layout_set_text (layout, tupopentext->str, -1); } else if (theobj->type == TUPCLOSE) { - +#if 0 pango_layout_set_text (layout, _("End Tuplet"), -1); - pango_layout_set_font_description (layout, desc); - - - gdk_draw_layout (pixmap, gc, xx, y - 4, layout); - +#else + pango_layout_set_text (layout, "|", -1); +#endif } + pango_layout_set_font_description (layout, desc); + gdk_draw_layout (pixmap, gc, xx +#if 0 +-0 +#else +-4 +#endif +, y - 4, layout); + pango_font_description_free (desc); } diff -urN /home/rshann/denemo-cvs/denemo/src/exportlilypond.c ./src/exportlilypond.c --- /home/rshann/denemo-cvs/denemo/src/exportlilypond.c 2007-08-19 16:00:12.000000000 +0100 +++ ./src/exportlilypond.c 2007-08-19 11:30:19.000000000 +0100 @@ -1193,7 +1193,7 @@ prevduration = 0; prevnumdots = -1; - fprintf (fp, "%s = \\context Voice = %s {\n", + fprintf (fp, "%s = \\context Voice = %s \\transpose c c{\n", curstaffstruct->lily_name->str, curstaffstruct->lily_name->str); /* When Lilypond changes such that it no longer accepts * '$', fix this. Of course, it's problematic that numerals diff -urN /home/rshann/denemo-cvs/denemo/src/external.c ./src/external.c --- /home/rshann/denemo-cvs/denemo/src/external.c 2007-07-10 01:34:42.000000000 +0100 +++ ./src/external.c 2007-08-19 11:30:19.000000000 +0100 @@ -111,7 +111,8 @@ get_temp_filename (const gchar * name) { gchar *path = NULL; - + if(locatedotdenemo()==NULL) + return NULL; if (name != NULL) path = g_build_filename (locatedotdenemo (), name, NULL); else @@ -126,7 +127,7 @@ gchar * dnm_get_temp_filename (const gchar * name) { - get_temp_filename (name); + return get_temp_filename (name); } /* init pid files */ @@ -135,12 +136,13 @@ { gchar *pidpath; FILE *fp; - int i = 0; + int i; - while (ext_pidfiles[i] != NULL) + for (i=0; ext_pidfiles[i] != NULL; i++) { pidpath = get_temp_filename (ext_pidfiles[i]); - + if(pidpath==NULL) + continue; fp = fopen (pidpath, "wb+"); #ifdef HAVE_FILE_LOCKS flockfile(fp); /* wait Denemo unlock it */ @@ -152,7 +154,6 @@ fclose (fp); g_free (pidpath); - i++; } } diff -urN /home/rshann/denemo-cvs/denemo/src/importmidi.c ./src/importmidi.c --- /home/rshann/denemo-cvs/denemo/src/importmidi.c 2007-07-10 01:34:43.000000000 +0100 +++ ./src/importmidi.c 2007-08-19 11:30:20.000000000 +0100 @@ -378,7 +378,7 @@ while (x-- > 0) temp = g_string_append_c(temp, (gchar) readBytes (fp, 1)); - strcpy (curstaffstruct->denemo_name->str, temp->str); + curstaffstruct->denemo_name->str = g_strdup(temp->str); dnm_set_lily_name (curstaffstruct->denemo_name, curstaffstruct->lily_name); g_string_free (temp, FALSE); } @@ -392,7 +392,7 @@ while (x-- > 0) temp = g_string_append_c(temp, (gchar) readBytes (fp, 1)); - strcpy (curstaffstruct->midi_instrument->str, temp->str); + curstaffstruct->midi_instrument->str = g_strdup(temp->str); g_string_free (temp, FALSE); } diff -urN /home/rshann/denemo-cvs/denemo/src/kbd-custom.c ./src/kbd-custom.c --- /home/rshann/denemo-cvs/denemo/src/kbd-custom.c 2007-08-19 16:00:12.000000000 +0100 +++ ./src/kbd-custom.c 2007-08-19 11:30:20.000000000 +0100 @@ -29,6 +29,9 @@ #include "playback.h" #include "keyboard.h" +static void +load_keymap_file_named (keymap * the_keymap, gchar *keymapfile, gchar *fallback); + struct name_action_and_function *denemo_commands; @@ -117,6 +120,10 @@ {KBD_CATEGORY_NOTE_ENTRY, N_("InsertDuplet"), (GtkFunction) insert_duplet}, {KBD_CATEGORY_NOTE_ENTRY, N_("InsertTriplet"), (GtkFunction) insert_triplet}, + {KBD_CATEGORY_NOTE_ENTRY, N_("StartTriplet"), + (GtkFunction) start_triplet}, + {KBD_CATEGORY_NOTE_ENTRY, N_("EndTuplet"), + (GtkFunction) end_tuplet}, {KBD_CATEGORY_NOTE_ENTRY, N_("InsertQuadtuplet"), (GtkFunction) insert_quadtuplet}, {KBD_CATEGORY_NOTE_ENTRY, N_("InsertQuintuplet"), @@ -357,7 +364,7 @@ * Warns user about old keymap file * */ -void +static void old_keymap_dialog () { GtkWidget *dialog; @@ -388,7 +395,7 @@ * Warns user that there was no keymap available to load * */ -void +static void no_map_dialog () { GtkWidget *dialog; @@ -406,24 +413,19 @@ _ ("No keymap file was found in either" " the systemwide Denemo directory" - " or in .denemo/keymaprc within your " + " or in .denemo directory within your " "home directory. Please go to" " Edit/Set Keybindings to construct a custom " "interface or to load one from" - " an alternate keymaprc file.")); + " an alternate keymap file.")); gtk_widget_show_all (dialog); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } -/** - * Create and Initialise keymap structure - * @return The newly created keymap - */ -keymap * -init_keymap () -{ + +static keymap *allocate_keymap() { keymap *the_keymap = (keymap *) g_malloc (sizeof (keymap)); gint i; gint n_unmenued_commands = (sizeof (unmenued_commands) @@ -478,11 +480,47 @@ the_keymap->quick_lookup_hashes = g_hash_table_new (NULL, NULL); for (i = 0; i < denemo_commands_size; i++) the_keymap->commands[i] = NULL; + + return the_keymap; +} + + +/** + * Create and Initialise a keymap structure + * from user's standard keymap file (or system standard keymap file if none). + * @return The newly created keymap + */ +keymap * +init_keymap () +{ + keymap *the_keymap = allocate_keymap(); load_standard_keymap_file (the_keymap); return the_keymap; } /** + * Create and Initialise a keymap structure from keymap file of name FILENAME + * located in user standard place (or system standard place if none there). + * @return The newly created keymap + */ +keymap * +create_keymap (const gchar *filename) +{ + gchar *localrc = NULL; + const gchar *dotdenemo = locatedotdenemo (); + gchar *systemwide = g_build_filename (get_data_dir (), filename, + NULL); + keymap *the_keymap = allocate_keymap(); + if(dotdenemo) + localrc = g_build_filename (dotdenemo, filename, NULL); + load_keymap_file_named (the_keymap, localrc, systemwide); + g_free(localrc); + g_free(systemwide); + return the_keymap; +} + + +/** * Utility function for clear_keymap */ static gboolean @@ -685,25 +723,29 @@ }; /** - * This function is a callback that basically serves as a wrapper for + * This function is a callback that is wrapper for * load_keymap_file + *FIXME note that non xml file support has been commented out */ void load_keymap_from_dialog (GtkWidget * widget, struct callbackdata *cbdata) { gchar *name = (gchar *) gtk_file_selection_get_filename (GTK_FILE_SELECTION (cbdata->filesel)); +#if 0 /* if(strcmp (name + strlen (name) - 4, ".xml") == 0) */ load_xml_keymap (name, cbdata->the_keymap); /* else load_keymap_file(name, cbdata->the_keymap); */ - +#else + load_keymap_file_named(cbdata->the_keymap, NULL, name); +#endif } /** * Function for loading a keymap from an arbitrary place by way of - * a user dialog. Similar to file_open. + * a user dialog. Similar to file_open. called from kbd-interface.c:configure_keyboard_dialog_OLD */ void @@ -714,7 +756,7 @@ static gchar *dotdenemo = NULL; if (!dotdenemo) - dotdenemo = g_strconcat (locatedotdenemo (), "/", NULL); + dotdenemo = g_strconcat (locatedotdenemo (), "/", NULL);//FIXME G_DIR_SEPARATOR or g_build_filename filesel = gtk_file_selection_new (_("Load keymap")); gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesel), dotdenemo); gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filesel)->ok_button), @@ -747,22 +789,16 @@ } -/** - * Load the either the local keymap - * or the global keymap - */ -void -load_standard_keymap_file (keymap * the_keymap) -{ - gchar *systemwide = g_build_filename (get_data_dir (), "denemo.keymaprc", - NULL); - g_print ("systemwide = %s\n", systemwide); - - static gchar *localrc = NULL; - - if (!localrc) - localrc = g_strconcat (locatedotdenemo (), "/keymaprc", NULL); +/* + * load_keymap_file_named: load a keymap file of the given name from one + * of the two paths: the keymap file can be in xml or text format + * param THE_KEYMAP must point to allocated memory for keymap. + * param LOCALRC file to load (full path) or NULL + * param SYSTEMWIDE fallback file (full path) + */ +static void +load_keymap_file_named (keymap * the_keymap, gchar *localrc, gchar *systemwide) { /* The plan: Load local file as xml @@ -804,8 +840,25 @@ } else g_print ("..ok.\n"); +} - g_free (systemwide); +/** + * Load the either the local keymap + * or the global keymap of the standard name + */ +void +load_standard_keymap_file (keymap * the_keymap) +{ + gchar *localrc = NULL; + const gchar *dotdenemo = locatedotdenemo (); + gchar *systemwide = g_build_filename (get_data_dir (), "denemo.keymaprc", + NULL); + g_print ("systemwide = %s\n", systemwide); + if(dotdenemo) + localrc = g_build_filename (dotdenemo, "keymaprc", NULL); + load_keymap_file_named (the_keymap, localrc, systemwide); + g_free(localrc); + g_free(systemwide); } static GScannerConfig scanner_config_template = { @@ -842,13 +895,16 @@ /** * This function loads a keymap file from file filename + * param FILENAME is full pathname of file to be loaded + * return TRUE on success */ gboolean load_keymap_file (gchar * filename, keymap * the_keymap) { gint fd, keyval, state = 0, result; static GScanner *scanner = NULL; - + if(filename==NULL) + return FALSE; if (!scanner) { int i; @@ -960,8 +1016,14 @@ * */ void -save_standard_keymap_file_wrapper (GtkWidget * widget, keymap * the_keymap) +save_standard_keymap_file_wrapper (GtkWidget * widget, DenemoGUI *gui) { + keymap * the_keymap = gui->prefs->the_keymap; + if(the_keymap != gui->prefs->standard_keymap) { + warningdialog("You are trying to overwrite your standard keymap with one designed for a particular mode.\nUse \"Save as Alternate Keymap File\" for this if you really mean it\n"); + return; + } + save_standard_keymap_file (the_keymap); } @@ -972,13 +1034,12 @@ void save_standard_keymap_file (keymap * the_keymap) { - static gchar *localrc = NULL; - - if (!localrc) - localrc = g_strconcat (locatedotdenemo (), "/keymaprc", NULL); - - /* save_keymap_file (localrc, the_keymap); */ + gchar *localrc = NULL; + const gchar *dotdenemo = locatedotdenemo (); + if(dotdenemo) + localrc = g_build_filename (dotdenemo, "keymaprc", NULL); save_xml_keymap (localrc, the_keymap); + g_free(localrc); } /** diff -urN /home/rshann/denemo-cvs/denemo/src/kbd-custom.h ./src/kbd-custom.h --- /home/rshann/denemo-cvs/denemo/src/kbd-custom.h 2007-01-24 19:44:26.000000000 +0000 +++ ./src/kbd-custom.h 2007-08-19 11:30:19.000000000 +0100 @@ -70,6 +70,9 @@ keymap * init_keymap (); +keymap * +create_keymap (const gchar *filename); + void clear_keymap (keymap *the_keymap); @@ -104,7 +107,7 @@ void save_standard_keymap_file_wrapper (GtkWidget *widget, - keymap *the_keymap); + DenemoGUI *gui); void save_standard_keymap_file (keymap *the_keymap); diff -urN /home/rshann/denemo-cvs/denemo/src/kbd-interface.c ./src/kbd-interface.c --- /home/rshann/denemo-cvs/denemo/src/kbd-interface.c 2007-01-24 19:44:26.000000000 +0000 +++ ./src/kbd-interface.c 2007-08-19 11:30:20.000000000 +0100 @@ -452,13 +452,13 @@ GTK_OBJECT (kbd_window)); gtk_signal_connect (GTK_OBJECT (button_ok_save), "clicked", GTK_SIGNAL_FUNC (save_standard_keymap_file_wrapper), - the_keymap); + gui); gtk_signal_connect_object (GTK_OBJECT (button_ok_save), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (kbd_window)); gtk_signal_connect (GTK_OBJECT (button_save), "clicked", GTK_SIGNAL_FUNC (save_standard_keymap_file_wrapper), - the_keymap); + gui); gtk_signal_connect (GTK_OBJECT (button_save_as), "clicked", GTK_SIGNAL_FUNC (save_keymap_dialog), the_keymap); gtk_signal_connect (GTK_OBJECT (button_load), "clicked", @@ -627,6 +627,8 @@ gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "Default"); const gchar *dotdenemo = locatedotdenemo (); + if(dotdenemo==NULL) + return; GDir *dir = g_dir_open (dotdenemo, 0, NULL); g_assert (dir != NULL); diff -urN /home/rshann/denemo-cvs/denemo/src/keyboard.c ./src/keyboard.c --- /home/rshann/denemo-cvs/denemo/src/keyboard.c 2007-01-24 19:44:26.000000000 +0000 +++ ./src/keyboard.c 2007-08-19 11:30:20.000000000 +0100 @@ -67,7 +67,7 @@ { xmlChar *tmp = xmlNodeListGetString (doc, cur->xmlChildrenNode, 1); - g_print ("Action %s\n", (gchar *) tmp); + //g_print ("Action %s\n", (gchar *) tmp); if (tmp) { command_number = lookup_command ((gchar *) tmp); @@ -154,6 +154,9 @@ } +/* returns 0 on success + * negative on failure + */ gint load_xml_keymap (gchar * filename, keymap * the_keymap) { @@ -161,7 +164,8 @@ xmlDocPtr doc; //xmlNsPtr ns; xmlNodePtr rootElem; - + if(filename==NULL) + return ret; doc = xmlParseFile (filename); if (doc == NULL) diff -urN /home/rshann/denemo-cvs/denemo/src/keyresponses.c ./src/keyresponses.c --- /home/rshann/denemo-cvs/denemo/src/keyresponses.c 2007-08-19 16:00:12.000000000 +0100 +++ ./src/keyresponses.c 2007-08-19 11:30:19.000000000 +0100 @@ -11,6 +11,7 @@ #include "articulations.h" #include "barline.h" #include "utils.h" +#include "tupletops.h" /** * keypress event callback @@ -46,23 +47,25 @@ ki->func.nocallback==(gpointer)insert_chord_3key || ki->func.nocallback==(gpointer)insert_chord_4key || ki->func.nocallback==(gpointer)insert_chord_5key || - ki->func.nocallback==(gpointer)insert_chord_6key || - + ki->func.nocallback==(gpointer)insert_chord_6key +#if 0 + || ki->func.nocallback==(gpointer)insert_rest_0key || ki->func.nocallback==(gpointer)insert_rest_1key || ki->func.nocallback==(gpointer)insert_rest_2key || ki->func.nocallback==(gpointer)insert_rest_3key || ki->func.nocallback==(gpointer)insert_rest_4key || ki->func.nocallback==(gpointer)insert_rest_5key || - ki->func.nocallback==(gpointer)insert_rest_6key) - + ki->func.nocallback==(gpointer)insert_rest_6key +#endif + ) { #define g (gui->si->rstep) RhythmElement *relement = (RhythmElement*)g_malloc0(sizeof(RhythmElement)); relement->functions = g_list_append(NULL, (gpointer)ki->func.callback); if(gui->si->currhythm) { - gtk_widget_set_state(((RhythmPattern *)gui->si->currhythm->data)->button, GTK_STATE_NORMAL); + gtk_widget_set_state(GTK_WIDGET(((RhythmPattern *)gui->si->currhythm->data)->button), GTK_STATE_NORMAL); } else if(g) { g_list_free(((RhythmElement*)g->data)->functions); g->next = g->prev = NULL; @@ -528,6 +531,17 @@ } void +start_triplet (DenemoGUI * gui) +{ + nextmeasure (gui->si, FALSE); + object_insert (gui->si, newtupopen(2,3)); +} +void +end_tuplet (DenemoGUI * gui) +{ + object_insert (gui->si, newtupclose ()); +} +void insert_quadtuplet (DenemoGUI * gui) { dnm_inserttuplet (gui->si, QUADTUPLET); @@ -578,6 +592,20 @@ /* And delete */ deleteobject (gui); } + else + {/* go to the previous measure and start deleting there */ + if(gui->si->currentmeasure->prev) { + measureleft(gui); + while (gui->si->currentobject && (gui->si->currentobject->next)) + { + gui->si->currentobject = gui->si->currentobject->next; + gui->si->cursor_x++; + } + cursorright(gui); + if(gui->si->currentobject) + deletepreviousobject(gui); + } + } /* if you are following a rhythmic pattern then backup the pattern */ if(gui->si->rhythmicsubmode) { @@ -599,7 +627,7 @@ if (curmudelaobj && curmudelaobj->type == STEMDIRECTIVE) change_stem_directive (gui->si, DENEMO_STEMUP); else - changeenshift (gui->si, 1); + incrementenshift (gui->si, 1); } void @@ -611,7 +639,7 @@ if (curmudelaobj && curmudelaobj->type == STEMDIRECTIVE) change_stem_directive (gui->si, DENEMO_STEMDOWN); else - changeenshift (gui->si, -1); + incrementenshift (gui->si, -1); } void diff -urN /home/rshann/denemo-cvs/denemo/src/keyresponses.h ./src/keyresponses.h --- /home/rshann/denemo-cvs/denemo/src/keyresponses.h 2007-01-24 19:44:26.000000000 +0000 +++ ./src/keyresponses.h 2007-08-19 11:30:20.000000000 +0100 @@ -66,6 +66,11 @@ void insert_duplet (DenemoGUI *gui); void insert_triplet (DenemoGUI *gui); +void start_triplet (DenemoGUI *gui); +void end_tuplet (DenemoGUI *gui); + + + void insert_quadtuplet (DenemoGUI *gui); void insert_quintuplet (DenemoGUI *gui); void insert_sextuplet (DenemoGUI *gui); diff -urN /home/rshann/denemo-cvs/denemo/src/lyparser.c ./src/lyparser.c --- /home/rshann/denemo-cvs/denemo/src/lyparser.c 2007-01-31 20:13:46.000000000 +0000 +++ ./src/lyparser.c 2007-08-19 11:30:20.000000000 +0100 @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 2.2. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C @@ -47,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.2" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -581,7 +581,7 @@ nodeglist *branch; GList *scm; } -/* Line 193 of yacc.c. */ +/* Line 187 of yacc.c. */ #line 586 "lyparser.tab.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -824,7 +824,7 @@ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 1641 +#define YYLAST 1562 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 157 @@ -833,7 +833,7 @@ /* YYNRULES -- Number of rules. */ #define YYNRULES 283 /* YYNRULES -- Number of states. */ -#define YYNSTATES 426 +#define YYNSTATES 427 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -898,28 +898,28 @@ 99, 102, 106, 109, 112, 115, 116, 118, 123, 124, 127, 130, 132, 134, 135, 140, 146, 151, 155, 160, 164, 166, 172, 174, 176, 178, 182, 186, 189, 195, - 199, 203, 205, 207, 209, 213, 217, 221, 222, 226, - 227, 231, 232, 236, 237, 241, 242, 246, 248, 250, - 252, 256, 260, 264, 269, 274, 281, 287, 294, 301, - 308, 314, 318, 325, 327, 329, 331, 332, 336, 338, - 340, 344, 346, 348, 352, 353, 356, 358, 364, 367, - 369, 371, 373, 375, 377, 379, 382, 385, 388, 391, - 393, 395, 397, 399, 401, 403, 405, 407, 409, 413, - 416, 419, 422, 424, 427, 431, 432, 435, 437, 440, - 443, 445, 447, 448, 450, 453, 456, 458, 461, 463, - 466, 468, 471, 474, 476, 479, 482, 484, 486, 489, - 492, 494, 496, 498, 500, 502, 504, 506, 508, 510, - 512, 514, 516, 518, 520, 522, 524, 526, 528, 530, - 532, 534, 536, 538, 540, 542, 544, 546, 548, 550, - 552, 553, 555, 557, 560, 563, 565, 569, 573, 575, - 579, 580, 583, 585, 588, 590, 592, 594, 596, 598, - 600, 602, 605, 608, 610, 613, 614, 617, 621, 622, - 624, 631, 634, 637, 640, 643, 646, 648, 650, 652, - 659, 660, 663, 665, 669, 670, 673, 674, 677, 678, - 681, 683, 685, 688, 690, 693, 696, 700, 704, 706, - 708, 712, 716, 720, 723, 725, 727, 729, 731, 734, - 737, 740, 743, 746, 748, 750, 752, 755, 757, 759, - 763, 764, 767, 768 + 199, 203, 205, 207, 209, 214, 218, 222, 223, 227, + 228, 232, 233, 237, 238, 242, 243, 247, 249, 251, + 253, 257, 261, 265, 270, 275, 282, 288, 295, 302, + 309, 315, 319, 326, 328, 330, 332, 333, 337, 339, + 341, 345, 347, 349, 353, 354, 357, 359, 365, 368, + 370, 372, 374, 376, 378, 380, 383, 386, 389, 392, + 394, 396, 398, 400, 402, 404, 406, 408, 410, 414, + 417, 420, 423, 425, 428, 432, 433, 436, 438, 441, + 444, 446, 448, 449, 451, 454, 457, 459, 462, 464, + 467, 469, 472, 475, 477, 480, 483, 485, 487, 490, + 493, 495, 497, 499, 501, 503, 505, 507, 509, 511, + 513, 515, 517, 519, 521, 523, 525, 527, 529, 531, + 533, 535, 537, 539, 541, 543, 545, 547, 549, 551, + 553, 554, 556, 558, 561, 564, 566, 570, 574, 576, + 580, 581, 584, 586, 589, 591, 593, 595, 597, 599, + 601, 603, 606, 609, 611, 614, 615, 618, 622, 623, + 625, 632, 635, 638, 641, 644, 647, 649, 651, 653, + 660, 661, 664, 666, 670, 671, 674, 675, 678, 679, + 682, 684, 686, 689, 691, 694, 697, 701, 705, 707, + 709, 713, 717, 721, 724, 726, 728, 730, 732, 735, + 738, 741, 744, 747, 749, 751, 753, 756, 758, 760, + 764, 765, 768, 769 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -946,63 +946,63 @@ 177, -1, 13, 147, 177, -1, 42, 177, -1, 86, 259, 112, 259, 177, -1, 90, 147, 177, -1, 81, 232, 177, -1, 179, -1, 181, -1, 180, -1, 83, - 216, 177, -1, 83, 215, 177, -1, 15, 160, 177, - -1, -1, 58, 184, 177, -1, -1, 36, 185, 177, - -1, -1, 24, 186, 177, -1, -1, 48, 187, 177, - -1, -1, 89, 188, 177, -1, 189, -1, 190, -1, - 191, -1, 67, 227, 177, -1, 70, 177, 177, -1, - 88, 147, 177, -1, 71, 147, 177, 177, -1, 82, - 147, 112, 147, -1, 62, 147, 125, 147, 112, 194, - -1, 62, 147, 125, 147, 85, -1, 64, 147, 125, - 147, 112, 160, -1, 64, 147, 125, 147, 112, 147, - -1, 63, 147, 125, 147, 112, 160, -1, 63, 147, - 160, 112, 160, -1, 65, 147, 160, -1, 62, 147, - 125, 147, 65, 160, -1, 259, -1, 258, -1, 160, - -1, -1, 195, 242, 208, -1, 204, -1, 197, -1, - 200, 229, 208, -1, 114, -1, 116, -1, 198, 201, - 199, -1, -1, 201, 203, -1, 93, -1, 216, 260, - 261, 211, 208, -1, 92, 208, -1, 202, -1, 205, - -1, 103, -1, 104, -1, 106, -1, 117, -1, 20, - 147, -1, 60, 228, -1, 26, 147, -1, 80, 232, - -1, 21, -1, 206, -1, 207, -1, 219, -1, 220, - -1, 123, -1, 124, -1, 22, -1, 105, -1, 77, - 258, 147, -1, 49, 55, -1, 49, 194, -1, 74, - 228, -1, 175, -1, 47, 55, -1, 47, 131, 10, - -1, -1, 208, 209, -1, 221, -1, 226, 210, -1, - 226, 221, -1, 224, -1, 225, -1, -1, 112, -1, - 112, 213, -1, 112, 212, -1, 128, -1, 212, 128, - -1, 129, -1, 213, 129, -1, 131, -1, 131, 212, - -1, 131, 213, -1, 132, -1, 132, 212, -1, 132, - 213, -1, 214, -1, 217, -1, 54, 160, -1, 34, - 160, -1, 35, -1, 44, -1, 222, -1, 12, -1, - 11, -1, 234, -1, 120, -1, 121, -1, 122, -1, - 99, -1, 100, -1, 98, -1, 101, -1, 50, -1, - 223, -1, 259, -1, 130, -1, 154, -1, 152, -1, - 151, -1, 117, -1, 116, -1, 125, -1, 155, -1, - 155, -1, 154, -1, 151, -1, 214, -1, 231, -1, - 218, -1, -1, 231, -1, 218, -1, 257, 233, -1, - 134, 233, -1, 230, -1, 231, 119, 257, -1, 231, - 119, 135, -1, 135, -1, 149, 118, 149, -1, -1, - 233, 125, -1, 156, -1, 156, 257, -1, 130, -1, - 149, -1, 151, -1, 152, -1, 127, -1, 111, -1, - 235, -1, 237, 236, -1, 123, 237, -1, 237, -1, - 238, 124, -1, -1, 239, 238, -1, 37, 239, 38, - -1, -1, 94, -1, 216, 260, 261, 211, 229, 241, - -1, 240, 229, -1, 145, 229, -1, 146, 229, -1, - 51, 229, -1, 147, 229, -1, 245, -1, 96, -1, - 95, -1, 215, 229, 246, 248, 249, 250, -1, -1, - 108, 247, -1, 251, -1, 247, 125, 251, -1, -1, - 110, 247, -1, -1, 118, 215, -1, -1, 107, 215, - -1, 252, -1, 133, -1, 133, 252, -1, 257, -1, - 257, 152, -1, 257, 109, -1, 253, 152, 254, -1, - 253, 151, 254, -1, 254, -1, 255, -1, 255, 119, - 255, -1, 255, 118, 255, -1, 120, 253, 121, -1, - 151, 255, -1, 256, -1, 149, -1, 150, -1, 139, - -1, 150, 27, -1, 150, 66, -1, 150, 45, -1, - 150, 53, -1, 150, 25, -1, 149, -1, 130, -1, - 256, -1, 151, 258, -1, 147, -1, 143, -1, 259, - 152, 259, -1, -1, 260, 127, -1, -1, 261, 126, - -1 + 216, 216, 177, -1, 83, 215, 177, -1, 15, 160, + 177, -1, -1, 58, 184, 177, -1, -1, 36, 185, + 177, -1, -1, 24, 186, 177, -1, -1, 48, 187, + 177, -1, -1, 89, 188, 177, -1, 189, -1, 190, + -1, 191, -1, 67, 227, 177, -1, 70, 177, 177, + -1, 88, 147, 177, -1, 71, 147, 177, 177, -1, + 82, 147, 112, 147, -1, 62, 147, 125, 147, 112, + 194, -1, 62, 147, 125, 147, 85, -1, 64, 147, + 125, 147, 112, 160, -1, 64, 147, 125, 147, 112, + 147, -1, 63, 147, 125, 147, 112, 160, -1, 63, + 147, 160, 112, 160, -1, 65, 147, 160, -1, 62, + 147, 125, 147, 65, 160, -1, 259, -1, 258, -1, + 160, -1, -1, 195, 242, 208, -1, 204, -1, 197, + -1, 200, 229, 208, -1, 114, -1, 116, -1, 198, + 201, 199, -1, -1, 201, 203, -1, 93, -1, 216, + 260, 261, 211, 208, -1, 92, 208, -1, 202, -1, + 205, -1, 103, -1, 104, -1, 106, -1, 117, -1, + 20, 147, -1, 60, 228, -1, 26, 147, -1, 80, + 232, -1, 21, -1, 206, -1, 207, -1, 219, -1, + 220, -1, 123, -1, 124, -1, 22, -1, 105, -1, + 77, 258, 147, -1, 49, 55, -1, 49, 194, -1, + 74, 228, -1, 175, -1, 47, 55, -1, 47, 131, + 10, -1, -1, 208, 209, -1, 221, -1, 226, 210, + -1, 226, 221, -1, 224, -1, 225, -1, -1, 112, + -1, 112, 213, -1, 112, 212, -1, 128, -1, 212, + 128, -1, 129, -1, 213, 129, -1, 131, -1, 131, + 212, -1, 131, 213, -1, 132, -1, 132, 212, -1, + 132, 213, -1, 214, -1, 217, -1, 54, 160, -1, + 34, 160, -1, 35, -1, 44, -1, 222, -1, 12, + -1, 11, -1, 234, -1, 120, -1, 121, -1, 122, + -1, 99, -1, 100, -1, 98, -1, 101, -1, 50, + -1, 223, -1, 259, -1, 130, -1, 154, -1, 152, + -1, 151, -1, 117, -1, 116, -1, 125, -1, 155, + -1, 155, -1, 154, -1, 151, -1, 214, -1, 231, + -1, 218, -1, -1, 231, -1, 218, -1, 257, 233, + -1, 134, 233, -1, 230, -1, 231, 119, 257, -1, + 231, 119, 135, -1, 135, -1, 149, 118, 149, -1, + -1, 233, 125, -1, 156, -1, 156, 257, -1, 130, + -1, 149, -1, 151, -1, 152, -1, 127, -1, 111, + -1, 235, -1, 237, 236, -1, 123, 237, -1, 237, + -1, 238, 124, -1, -1, 239, 238, -1, 37, 239, + 38, -1, -1, 94, -1, 216, 260, 261, 211, 229, + 241, -1, 240, 229, -1, 145, 229, -1, 146, 229, + -1, 51, 229, -1, 147, 229, -1, 245, -1, 96, + -1, 95, -1, 215, 229, 246, 248, 249, 250, -1, + -1, 108, 247, -1, 251, -1, 247, 125, 251, -1, + -1, 110, 247, -1, -1, 118, 215, -1, -1, 107, + 215, -1, 252, -1, 133, -1, 133, 252, -1, 257, + -1, 257, 152, -1, 257, 109, -1, 253, 152, 254, + -1, 253, 151, 254, -1, 254, -1, 255, -1, 255, + 119, 255, -1, 255, 118, 255, -1, 120, 253, 121, + -1, 151, 255, -1, 256, -1, 149, -1, 150, -1, + 139, -1, 150, 27, -1, 150, 66, -1, 150, 45, + -1, 150, 53, -1, 150, 25, -1, 149, -1, 130, + -1, 256, -1, 151, 258, -1, 147, -1, 143, -1, + 259, 152, 259, -1, -1, 260, 127, -1, -1, 261, + 126, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -1172,7 +1172,7 @@ 2, 3, 2, 2, 2, 0, 1, 4, 0, 2, 2, 1, 1, 0, 4, 5, 4, 3, 4, 3, 1, 5, 1, 1, 1, 3, 3, 2, 5, 3, - 3, 1, 1, 1, 3, 3, 3, 0, 3, 0, + 3, 1, 1, 1, 4, 3, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 1, 1, 1, 3, 3, 3, 4, 4, 6, 5, 6, 6, 6, 5, 3, 6, 1, 1, 1, 0, 3, 1, 1, @@ -1221,7 +1221,7 @@ 106, 139, 0, 105, 140, 275, 104, 103, 106, 199, 126, 205, 198, 0, 0, 0, 0, 160, 197, 106, 0, 106, 106, 141, 0, 0, 208, 0, 128, 106, - 0, 0, 163, 166, 106, 106, 167, 106, 0, 106, + 0, 0, 163, 166, 106, 0, 167, 106, 0, 106, 106, 106, 0, 39, 34, 37, 38, 225, 200, 200, 200, 200, 200, 280, 200, 145, 236, 0, 202, 145, 201, 0, 169, 0, 0, 0, 0, 272, 268, 270, @@ -1231,19 +1231,19 @@ 82, 0, 0, 80, 144, 84, 276, 78, 0, 0, 0, 0, 0, 101, 156, 158, 161, 162, 90, 106, 91, 106, 138, 0, 0, 70, 0, 168, 164, 165, - 75, 74, 65, 0, 92, 86, 69, 50, 57, 49, + 75, 106, 65, 0, 92, 86, 69, 50, 57, 49, 0, 234, 232, 233, 235, 240, 282, 231, 107, 145, 116, 112, 113, 119, 115, 280, 110, 238, 59, 33, 0, 262, 257, 256, 261, 260, 279, 211, 47, 56, 58, 207, 206, 0, 0, 0, 0, 157, 159, 53, - 93, 0, 209, 94, 106, 227, 219, 0, 214, 215, - 220, 223, 226, 0, 244, 281, 152, 196, 146, 118, - 282, 32, 0, 96, 0, 0, 100, 0, 0, 55, - 61, 68, 222, 218, 216, 217, 221, 224, 251, 241, - 242, 250, 253, 0, 246, 153, 283, 200, 152, 102, - 95, 99, 98, 97, 48, 252, 0, 255, 254, 245, - 0, 248, 155, 154, 228, 145, 0, 243, 247, 0, - 239, 229, 230, 117, 54, 249 + 93, 0, 209, 94, 74, 106, 227, 219, 0, 214, + 215, 220, 223, 226, 0, 244, 281, 152, 196, 146, + 118, 282, 32, 0, 96, 0, 0, 100, 0, 0, + 55, 61, 68, 222, 218, 216, 217, 221, 224, 251, + 241, 242, 250, 253, 0, 246, 153, 283, 200, 152, + 102, 95, 99, 98, 97, 48, 252, 0, 255, 254, + 245, 0, 248, 155, 154, 228, 145, 0, 243, 247, + 0, 239, 229, 230, 117, 54, 249 }; /* YYDEFGOTO[NTERM-NUM]. */ @@ -1251,81 +1251,81 @@ { -1, 1, 16, 25, 18, 19, 26, 37, 20, 21, 136, 137, 330, 22, 90, 23, 24, 39, 91, 212, - 309, 379, 93, 94, 95, 96, 97, 178, 166, 162, + 309, 380, 93, 94, 95, 96, 97, 178, 166, 162, 170, 210, 98, 99, 100, 101, 102, 174, 103, 104, 105, 106, 322, 107, 227, 323, 324, 108, 109, 110, - 111, 318, 368, 254, 397, 286, 287, 203, 204, 205, + 111, 318, 369, 254, 398, 286, 287, 203, 204, 205, 206, 228, 112, 113, 143, 144, 256, 257, 258, 145, - 189, 180, 229, 181, 230, 198, 265, 146, 360, 386, - 361, 362, 310, 224, 422, 225, 114, 328, 226, 364, - 389, 394, 411, 420, 390, 391, 236, 148, 149, 150, - 158, 176, 177, 316, 366 + 189, 180, 229, 181, 230, 198, 265, 146, 361, 387, + 362, 363, 310, 224, 423, 225, 114, 328, 226, 365, + 390, 395, 412, 421, 391, 392, 236, 148, 149, 150, + 158, 176, 177, 316, 367 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -223 +#define YYPACT_NINF -220 static const yytype_int16 yypact[] = { - -223, 24, -223, -223, -49, -40, -223, -29, -49, -11, - 9, 12, 0, -223, 37, -223, -223, -223, -223, -223, - -223, -223, -223, -223, 27, -223, -223, -223, 76, -223, - -223, 1386, -223, -223, 948, -223, -223, -61, 21, -223, - -223, 10, -49, 16, -223, -223, -223, 26, 89, 92, - -223, -223, 1500, -223, -25, -223, 64, -223, -22, 42, - 63, 69, 72, 95, -42, 1500, 80, -22, 104, -49, - -91, -91, 85, -28, 88, 97, -223, 105, -223, -223, - -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, - 91, -223, -223, -223, -223, -223, -223, -223, -223, -223, - -223, -223, -223, -8, -223, -223, -223, -22, -223, -223, - -223, -223, -223, -223, -223, -223, -223, -49, -86, -223, - -223, -223, -223, 79, -223, -223, -223, -223, -223, -223, - 131, 84, -223, -223, 3, -223, -223, -223, -223, -223, - -223, -223, -223, -223, -223, 1028, -223, -58, -223, 73, - -223, 87, -223, -223, -223, -223, -223, 124, -223, 1500, - 1500, -223, 1500, -223, -223, -223, 1500, -223, -223, 246, - 1500, -223, 104, -223, -223, -223, -223, 87, 1500, -223, - -223, -223, 138, 133, -34, 135, -49, 96, -223, 1500, - -21, 1500, 1500, -223, 115, -49, -223, 146, -223, 1500, - 153, -49, 96, -223, 1500, 1500, -223, 1172, -70, 1500, - 1500, 1500, 333, -223, -223, -223, -223, -223, -22, -22, - -22, -22, -22, -223, -22, -223, -223, -18, -223, -223, - 138, 462, -223, 125, 79, 79, -62, -223, -223, -223, - -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, - -223, -223, -223, -223, -223, -223, -223, -223, -223, 87, - 79, 79, 79, 79, -42, 141, 3, 141, -223, -223, - -223, 576, 705, -223, -223, -223, -223, -223, 60, 122, - 123, 159, 126, -223, -223, -223, 144, 145, -223, 1500, - -223, 1500, -223, 163, 127, -223, 130, -223, 144, 145, - -223, -223, -223, -42, -223, -223, -223, -223, -223, -223, - -23, -223, -223, -223, -223, 170, 155, -223, 66, -223, - -223, -223, -223, -223, -223, -223, 66, -223, -223, -223, - 165, -223, -223, -223, -223, -223, -223, -223, -223, -223, - -223, -223, -223, -33, 171, -49, 172, -223, -223, 266, - -223, -49, -223, -223, 1279, -223, -223, -77, -223, -223, - -223, -88, 162, -64, 177, -223, 34, -223, -223, 66, - 155, -223, -49, -223, 98, -49, -223, -99, 175, -223, - -223, -223, -88, -223, -223, -223, -223, -223, 3, 164, - -223, -223, -72, -64, 173, 96, -223, -22, 34, -223, - -223, -223, -223, -223, -223, -223, -64, -223, -223, 164, - 158, 185, 144, 145, 199, -223, 834, -223, -223, 158, - -223, -223, -223, 66, -223, -223 + -220, 23, -220, -220, -51, -41, -220, -19, -51, 20, + 55, 62, 3, -220, -65, -220, -220, -220, -220, -220, + -220, -220, -220, -220, 26, -220, -220, -220, 106, -220, + -220, 1307, -220, -220, 949, -220, -220, -66, -44, -220, + -220, 39, -51, 46, -220, -220, -220, 51, 96, 109, + -220, -220, 1421, -220, -24, -220, 76, -220, -22, 81, + 82, 87, 89, 108, -5, 1421, 95, -22, 57, -51, + -15, -15, 100, -28, 11, 111, -220, 116, -220, -220, + -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, + 24, -220, -220, -220, -220, -220, -220, -220, -220, -220, + -220, -220, -220, 162, -220, -220, -220, -22, -220, -220, + -220, -220, -220, -220, -220, -220, -220, -51, -76, -220, + -220, -220, -220, 6, -220, -220, -220, -220, -220, -220, + 7, 101, -220, -220, -85, -220, -220, -220, -220, -220, + -220, -220, -220, -220, -220, 132, -220, -60, -220, 4, + -220, 85, -220, -220, -220, -220, -220, 131, -220, 1421, + 1421, -220, 1421, -220, -220, -220, 1421, -220, -220, 245, + 1421, -220, 57, -220, -220, -220, -220, 85, 1421, -220, + -220, -220, 137, 139, 28, 141, -51, 37, -220, 1421, + -87, 1421, 1421, -220, 120, -51, -220, 150, -220, 1421, + 157, -51, 37, -220, 1421, -25, -220, 1093, -73, 1421, + 1421, 1421, 334, -220, -220, -220, -220, -220, -22, -22, + -22, -22, -22, -220, -22, -220, -220, 71, -220, -220, + 137, 463, -220, 128, 6, 6, -63, -220, -220, -220, + -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, + -220, -220, -220, -220, -220, -220, -220, -220, -220, 85, + 6, 6, 6, 6, -5, 147, -85, 147, -220, -220, + -220, 577, 706, -220, -220, -220, -220, -220, 43, 126, + 127, 164, 133, -220, -220, -220, 153, 156, -220, 1421, + -220, 1421, -220, 170, 140, -220, 143, -220, 153, 156, + -220, 1421, -220, -5, -220, -220, -220, -220, -220, -220, + -2, -220, -220, -220, -220, 184, 171, -220, 90, -220, + -220, -220, -220, -220, -220, -220, 90, -220, -220, -220, + 189, -220, -220, -220, -220, -220, -220, -220, -220, -220, + -220, -220, -220, -35, 193, -51, 194, -220, -220, 291, + -220, -51, -220, -220, -220, 1200, -220, -220, -71, -220, + -220, -220, -53, 188, -79, 203, -220, 34, -220, -220, + 90, 171, -220, -51, -220, 152, -51, -220, 70, 201, + -220, -220, -220, -53, -220, -220, -220, -220, -220, -85, + 190, -220, -220, -67, -79, 198, 37, -220, -22, 34, + -220, -220, -220, -220, -220, -220, -220, -79, -220, -220, + 190, 185, 211, 153, 156, 225, -220, 835, -220, -220, + 185, -220, -220, -220, 90, -220, -220 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -223, -223, -223, -1, -223, -223, 286, -223, 205, 260, - -223, -223, -223, 264, -223, -3, -223, -223, 271, -108, - -30, -223, -223, -223, -223, -223, -223, -223, -223, -223, - -223, -223, -223, -223, -223, -223, -223, -74, -223, -223, - -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, - -223, -222, 267, -223, -96, -197, -194, 240, -100, -92, - -223, 4, -223, -223, 160, -223, -223, -223, -223, -223, - -223, 237, -201, 268, -7, 236, 150, -223, -223, -223, - -48, -223, -223, -223, -223, -223, -223, -223, -223, -223, - -82, -223, -223, -223, -94, -75, 280, -10, -118, -54, - -125, -52, -24, -9, -55 + -220, -220, -220, -1, -220, -220, 314, -220, 233, 287, + -220, -220, -220, 292, -220, -6, -220, -220, 299, -108, + -30, -220, -220, -220, -220, -220, -220, -220, -220, -220, + -220, -220, -220, -220, -220, -220, -220, -47, -220, -220, + -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, + -220, -219, 295, -220, -69, -195, -193, 268, -100, -92, + -220, 29, -220, -220, 187, -220, -220, -220, -220, -220, + -220, 266, -203, 296, -14, 265, 179, -220, -220, -220, + -20, -220, -220, -220, -220, -220, -220, -220, -220, -220, + -52, -220, -220, -220, -68, -49, 307, -56, -111, -54, + -129, -55, -26, 18, -23 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -1335,67 +1335,80 @@ #define YYTABLE_NINF -278 static const yytype_int16 yytable[] = { - 17, 92, 175, 222, 140, 298, 231, 326, 299, 243, - 151, 223, 117, 242, 175, 355, 194, 311, 312, 313, - 314, 315, 167, 317, 2, 3, 201, 233, 35, 217, - 168, 139, 372, 135, 356, 191, 201, 407, 142, 383, - 190, 160, 303, 218, 196, 13, 201, 4, 402, 15, - 208, 182, 373, 358, 152, 173, 271, 272, 197, 331, - 182, 200, 179, 384, 385, 289, 154, 5, 195, 388, - 6, 179, 359, 27, 319, 320, 7, 115, 116, 374, - 408, 8, 264, 9, 28, 156, 14, 216, 356, 260, - 261, 280, 213, 260, 261, 13, 10, 369, 321, 15, - 357, 127, 30, 187, 202, 128, 169, 358, 154, 154, - 13, 11, 155, 187, 15, 12, 232, 242, 175, 171, - 276, 259, 31, 187, 202, 32, 359, 156, 156, 268, - 269, 264, 270, 154, 5, 325, 273, 219, 220, 221, - 275, 338, 36, 7, 334, 335, 395, 33, 277, 34, - 9, 154, 156, 342, 38, 155, 237, 159, 238, 288, - 396, 290, 291, 161, 119, 120, 121, 122, 13, 295, - 156, 14, 15, 163, 300, 301, 239, 302, 11, 304, - 305, 306, 12, 281, 240, 283, 247, 124, 125, 183, - 154, 262, 263, 423, 293, 341, 414, 241, 412, 234, - 297, 413, 164, 126, 234, 165, 214, 127, 13, 156, - 184, 128, 15, 129, 130, 172, 185, 367, 126, 186, - 132, 133, 134, 126, 284, 285, 187, 192, 129, 130, - 235, 127, 200, 129, 130, 207, 266, 126, 392, 264, - 336, 127, 13, 126, 209, 128, 15, 129, 130, 172, - 332, 333, 211, 129, 130, 172, 274, 278, 279, 349, - 282, 350, 292, 392, 294, 296, 337, 329, 392, 343, - 344, 345, 347, 346, 348, 351, 352, 353, 363, 354, - 371, 392, 365, 375, 377, 378, 387, 393, 404, 406, - 202, 410, 419, 421, 29, 215, 416, 153, 138, 40, - 400, 141, 415, 188, 193, 255, 157, 199, 267, 382, - 418, 409, 417, 405, 147, 398, 370, 0, 0, 425, - 175, 0, 0, 0, 381, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 307, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 376, 0, 41, 0, 42, 0, - 380, 0, 0, 43, 44, 45, 0, 46, 0, 47, + 17, 92, 175, 222, 140, 243, 231, 298, 151, 299, + 326, 223, 117, 194, 175, 311, 312, 313, 314, 315, + 242, 317, 167, 2, 3, 213, 201, 35, 139, 201, + 373, 168, 237, 135, 238, 191, 356, 233, 190, 303, + 357, 160, 408, 154, 182, 154, 4, 34, 208, 152, + 374, 154, 239, 182, 389, 173, 271, 272, 331, 359, + 240, 289, 156, 142, 156, 264, 5, 5, 195, 6, + 156, 200, 27, 241, 384, 7, 7, 375, 360, 264, + 8, 14, 9, 9, 216, 409, 154, 179, 260, 261, + 155, 260, 261, 13, 28, 10, 179, 15, 385, 386, + 370, 115, 116, 187, 202, 156, 187, 169, 154, 357, + 11, 11, 155, 301, 12, 12, 232, 276, 175, 259, + 196, 358, 262, 263, 242, 201, 234, 156, 359, 268, + 269, 171, 270, 30, 197, 325, 273, 338, 127, 214, + 275, 36, 128, 115, 116, 126, 396, 360, 277, 342, + 33, 334, 335, 280, 127, 129, 130, 235, 207, 288, + 397, 290, 291, 319, 320, 284, 285, 13, 31, 295, + 14, 15, 13, 154, 300, 32, 15, 302, 341, 304, + 305, 306, 244, 281, 38, 283, 159, 321, 119, 120, + 121, 122, 156, 161, 293, 415, 126, 424, 163, 217, + 297, 413, 187, 414, 332, 333, 129, 130, 172, 164, + 247, 124, 125, 218, 13, 126, 201, 403, 15, 127, + 13, 234, 165, 128, 15, 129, 130, 172, 183, 184, + 119, 120, 121, 122, 185, 393, 186, 264, 336, 187, + 126, 368, 192, 266, 132, 133, 134, 200, 245, 246, + 129, 130, 247, 124, 125, 274, 278, 248, 209, 349, + 393, 350, 249, 211, 279, 393, 282, 292, 294, 296, + 329, 354, 337, 343, 344, 127, 345, 355, 393, 128, + 346, 347, 351, 250, 251, 348, 252, 253, 134, 352, + 353, 126, 364, 187, 202, 127, 13, 417, 366, 128, + 15, 129, 130, 172, 372, 376, 378, 219, 220, 221, + 379, 419, 388, 394, 405, 407, 411, 202, 420, 422, + 426, 175, 29, 215, 153, 382, 138, 40, 401, 141, + 416, 188, 255, 193, 157, 307, 199, 267, 383, 418, + 406, 147, 410, 371, 377, 0, 0, 41, 399, 42, + 381, 0, 0, 0, 43, 44, 45, 0, 46, 0, + 47, 0, 0, 48, 49, 0, 0, 0, 0, 50, + 51, -106, 400, 0, 173, 402, 52, 404, 53, 0, + 0, 54, 55, 56, 0, -106, 0, 0, -106, 0, + 0, 0, 57, 0, 58, 0, 59, 60, 61, 62, + 0, 63, 0, 64, 65, 66, 0, 0, 67, 0, + 0, 68, 38, 69, 70, 71, 72, 73, 0, 0, + 74, 0, 75, 76, 77, 0, 0, 0, 0, 0, + 78, 0, 0, 0, 0, 0, 0, 79, 80, 81, + 82, 0, 0, 0, 0, 0, 0, 83, 84, 308, + 0, 85, 0, 0, 0, 0, 0, 86, 87, 0, + 0, 0, 0, 0, 307, -106, -106, 0, 0, 0, + 0, 0, 0, 0, 0, 89, 41, 0, 42, -106, + -106, -106, 0, 43, 44, 45, 0, 46, 0, 47, 0, 0, 48, 49, 0, 0, 0, 0, 50, 51, - -106, 399, 0, 173, 401, 52, 403, 53, 0, 0, + -106, 0, 0, 0, 0, 52, 0, 53, 0, 0, 54, 55, 56, 0, -106, 0, 0, -106, 0, 0, 0, 57, 0, 58, 0, 59, 60, 61, 62, 0, 63, 0, 64, 65, 66, 0, 0, 67, 0, 0, 68, 38, 69, 70, 71, 72, 73, 0, 0, 74, - 0, 75, 76, 77, 0, 0, 0, 0, 0, 78, + 0, 75, 76, 77, 0, 0, 0, 0, 327, 78, 0, 0, 0, 0, 0, 0, 79, 80, 81, 82, - 0, 0, 0, 0, 0, 0, 83, 84, 308, 0, + 0, 0, 0, 0, 0, 0, 83, 84, 307, 0, 85, 0, 0, 0, 0, 0, 86, 87, 0, 0, - 0, 0, 0, 307, -106, -106, 0, 0, 0, 0, - 0, 0, 0, 0, 89, 41, 0, 42, -106, -106, - -106, 0, 43, 44, 45, 0, 46, 0, 47, 0, - 0, 48, 49, 0, 0, 0, 0, 50, 51, -106, - 0, 0, 0, 0, 52, 0, 53, 0, 0, 54, - 55, 56, 0, -106, 0, 0, -106, 0, 0, 0, - 57, 0, 58, 0, 59, 60, 61, 62, 0, 63, - 0, 64, 65, 66, 0, 0, 67, 0, 0, 68, - 38, 69, 70, 71, 72, 73, 0, 0, 74, 0, - 75, 76, 77, 0, 0, 0, 0, 327, 78, 0, - 0, 0, 0, 0, 0, 79, 80, 81, 82, 0, - 0, 0, 0, 0, 0, 83, 84, 307, 0, 85, - 0, 0, 0, 0, 0, 86, 87, 0, 0, 41, - 0, 42, 0, -106, -106, 0, 43, 44, 45, 0, - 46, 0, 47, 89, 0, 48, 49, -106, -106, -106, + 41, 0, 42, 0, -106, -106, 0, 43, 44, 45, + 0, 46, 0, 47, 89, 0, 48, 49, -106, -106, + -106, 0, 50, 51, -106, 0, 0, 0, 0, 52, + 0, 53, 0, 0, 54, 55, 56, 0, -106, 0, + 0, -106, 0, 0, 0, 57, 0, 58, 0, 59, + 60, 61, 62, 0, 63, 0, 64, 65, 66, 0, + 0, 67, 0, 0, 68, 38, 69, 70, 71, 72, + 73, 0, 0, 74, 0, 75, 76, 77, 0, 0, + 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, + 79, 80, 81, 82, 0, 0, 0, 0, 0, 0, + 83, 84, 339, 0, 85, 0, 0, 0, 0, 0, + 86, 87, 0, 0, 0, 0, 0, 307, -106, -106, + 0, 0, 0, 0, 0, 0, 0, 0, 89, 41, + 0, 42, -106, -106, -106, 0, 43, 44, 45, 0, + 46, 0, 47, 0, 0, 48, 49, 0, 0, 0, 0, 50, 51, -106, 0, 0, 0, 0, 52, 0, 53, 0, 0, 54, 55, 56, 0, -106, 0, 0, -106, 0, 0, 0, 57, 0, 58, 0, 59, 60, @@ -1404,7 +1417,7 @@ 0, 0, 74, 0, 75, 76, 77, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, 79, 80, 81, 82, 0, 0, 0, 0, 0, 0, 83, - 84, 339, 0, 85, 0, 0, 0, 0, 0, 86, + 84, 340, 0, 85, 0, 0, 0, 0, 0, 86, 87, 0, 0, 0, 0, 0, 307, -106, -106, 0, 0, 0, 0, 0, 0, 0, 0, 89, 41, 0, 42, -106, -106, -106, 0, 43, 44, 45, 0, 46, @@ -1417,79 +1430,36 @@ 0, 74, 0, 75, 76, 77, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, 79, 80, 81, 82, 0, 0, 0, 0, 0, 0, 83, 84, - 340, 0, 85, 0, 0, 0, 0, 0, 86, 87, - 0, 0, 0, 0, 0, 307, -106, -106, 0, 0, - 0, 0, 0, 0, 0, 0, 89, 41, 0, 42, - -106, -106, -106, 0, 43, 44, 45, 0, 46, 0, - 47, 0, 0, 48, 49, 0, 0, 0, 0, 50, - 51, -106, 0, 0, 0, 0, 52, 0, 53, 0, - 0, 54, 55, 56, 0, -106, 0, 0, -106, 0, - 0, 0, 57, 0, 58, 0, 59, 60, 61, 62, - 0, 63, 0, 64, 65, 66, 0, 0, 67, 0, - 0, 68, 38, 69, 70, 71, 72, 73, 0, 0, - 74, 0, 75, 76, 77, 0, 0, 0, 0, 0, - 78, 0, 0, 0, 0, 0, 0, 79, 80, 81, - 82, 0, 0, 0, 0, 0, 0, 83, 84, 424, - 0, 85, 0, 0, 0, 0, 0, 86, 87, 115, - 116, 41, 0, 42, 0, -106, -106, 0, 43, 44, - 45, 0, 46, 0, 47, 89, 0, 48, 49, -106, - -106, -106, 117, 50, 51, 0, 0, 0, 0, 0, - 52, 0, 53, 0, 0, 54, 55, 56, 0, 0, - 7, 0, 0, 0, 0, 0, 57, 9, 58, 0, - 59, 60, 61, 62, 0, 63, 0, 64, 65, 66, - 10, 0, 67, 0, 0, 68, 38, 69, 70, 71, - 118, 73, 0, 0, 74, 11, 75, 76, 77, 115, - 116, 0, 0, 0, 78, 0, 119, 120, 121, 122, - 0, 79, 80, 81, 82, 0, 0, 0, 0, 0, - 0, 83, 84, 0, 0, 85, 0, 0, 123, 124, - 125, 86, 87, 0, 0, 0, 0, 0, 244, 0, - 0, 0, 0, 0, 0, 0, 0, 126, 0, 89, - 0, 127, 13, 0, 0, 128, 15, 129, 130, 131, - 0, 0, 132, 133, 134, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 119, 120, 121, 122, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 245, 246, 0, 0, 247, 124, - 125, 0, 0, 248, 0, 0, 0, 0, 249, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 127, 0, 0, 0, 128, 0, 0, 0, 250, - 251, 0, 252, 253, 134, 41, 0, 42, 0, 0, - 0, 0, 43, 44, 45, 0, 46, 0, 47, 0, - 0, 48, 49, 0, 0, 0, 0, 50, 51, 0, - 0, 0, 0, 0, 52, 0, 53, 0, 0, 54, - 55, 56, 0, 0, 0, 0, 0, 0, 0, 0, - 57, 0, 58, 0, 59, 60, 61, 62, 0, 63, - 0, 64, 65, 66, 0, 0, 67, 0, 0, 68, - 38, 69, 70, 71, 72, 73, 0, 0, 74, 0, - 75, 76, 77, 0, 0, 0, 0, 0, 78, 0, - 0, 0, 0, 0, 0, 79, 80, 81, 82, 0, - 0, 0, 0, 0, -277, 83, 84, 0, 0, 85, - 0, 0, 41, 0, 42, 86, 87, 0, 0, 43, - 44, 45, 0, 46, 0, 47, 0, 0, 48, 49, - 0, 0, 0, 89, 50, 51, 0, 0, 0, 0, - 0, 52, 0, 53, -277, 0, 54, 55, 56, 0, - 0, 0, 0, 0, 0, 0, 0, 57, 0, 58, + 425, 0, 85, 0, 0, 0, 0, 0, 86, 87, + 115, 116, 41, 0, 42, 0, -106, -106, 0, 43, + 44, 45, 0, 46, 0, 47, 89, 0, 48, 49, + -106, -106, -106, 117, 50, 51, 0, 0, 0, 0, + 0, 52, 0, 53, 0, 0, 54, 55, 56, 0, + 0, 7, 0, 0, 0, 0, 0, 57, 9, 58, 0, 59, 60, 61, 62, 0, 63, 0, 64, 65, - 66, 0, 0, 67, 0, 0, 68, 38, 69, 70, - 71, 72, 73, 0, 0, 74, 0, 75, 76, 77, - 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, - 0, 0, 79, 80, 81, 82, 0, 0, 0, 0, - 0, 0, 83, 84, 0, 0, 85, 0, 0, 41, - 0, 42, 86, 87, 0, 0, 43, 44, 45, 0, - 46, 0, 47, 0, 0, 48, 49, 0, 0, 0, - 89, 50, 51, 0, 0, 0, 0, 0, 52, 0, - 53, 264, 0, 54, 55, 56, 0, 0, 0, 0, - 0, 0, 0, 0, 57, 0, 58, 0, 59, 60, - 61, 62, 0, 63, 0, 64, 65, 66, 0, 0, - 67, 0, 0, 68, 38, 69, 70, 71, 72, 73, - 0, 0, 74, 0, 75, 76, 77, 0, 0, 0, - 0, 0, 78, 0, 0, 0, 0, 0, 0, 79, - 80, 81, 82, 0, 0, 0, 0, 0, 0, 83, - 84, 0, 0, 85, 0, 0, 0, 0, 0, 86, - 87, 0, 0, 41, 0, 42, 0, 0, 0, 0, - 43, 44, 45, 88, 46, 0, 47, 89, 0, 48, - 49, 0, 0, 0, 0, 50, 51, 0, 0, 0, - 0, 0, 52, 0, 53, 0, 0, 54, 55, 56, + 66, 10, 0, 67, 0, 0, 68, 38, 69, 70, + 71, 118, 73, 0, 0, 74, 11, 75, 76, 77, + 0, 0, 0, 0, 0, 78, 0, 119, 120, 121, + 122, 0, 79, 80, 81, 82, 0, 0, 0, 0, + 0, 0, 83, 84, 0, 0, 85, 0, 0, 123, + 124, 125, 86, 87, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 126, 0, + 89, 0, 127, 13, 0, 0, 128, 15, 129, 130, + 131, 0, 0, 132, 133, 134, 41, 0, 42, 0, + 0, 0, 0, 43, 44, 45, 0, 46, 0, 47, + 0, 0, 48, 49, 0, 0, 0, 0, 50, 51, + 0, 0, 0, 0, 0, 52, 0, 53, 0, 0, + 54, 55, 56, 0, 0, 0, 0, 0, 0, 0, + 0, 57, 0, 58, 0, 59, 60, 61, 62, 0, + 63, 0, 64, 65, 66, 0, 0, 67, 0, 0, + 68, 38, 69, 70, 71, 72, 73, 0, 0, 74, + 0, 75, 76, 77, 0, 0, 0, 0, 0, 78, + 0, 0, 0, 0, 0, 0, 79, 80, 81, 82, + 0, 0, 0, 0, 0, -277, 83, 84, 0, 0, + 85, 0, 0, 41, 0, 42, 86, 87, 0, 0, + 43, 44, 45, 0, 46, 0, 47, 0, 0, 48, + 49, 0, 0, 0, 89, 50, 51, 0, 0, 0, + 0, 0, 52, 0, 53, -277, 0, 54, 55, 56, 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, 58, 0, 59, 60, 61, 62, 0, 63, 0, 64, 65, 66, 0, 0, 67, 0, 0, 68, 38, 69, @@ -1497,74 +1467,109 @@ 77, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, 79, 80, 81, 82, 0, 0, 0, 0, 0, 0, 83, 84, 0, 0, 85, 0, 0, - 0, 0, 0, 86, 87, 0, 0, 0, 0, 0, + 41, 0, 42, 86, 87, 0, 0, 43, 44, 45, + 0, 46, 0, 47, 0, 0, 48, 49, 0, 0, + 0, 89, 50, 51, 0, 0, 0, 0, 0, 52, + 0, 53, 264, 0, 54, 55, 56, 0, 0, 0, + 0, 0, 0, 0, 0, 57, 0, 58, 0, 59, + 60, 61, 62, 0, 63, 0, 64, 65, 66, 0, + 0, 67, 0, 0, 68, 38, 69, 70, 71, 72, + 73, 0, 0, 74, 0, 75, 76, 77, 0, 0, + 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, + 79, 80, 81, 82, 0, 0, 0, 0, 0, 0, + 83, 84, 0, 0, 85, 0, 0, 0, 0, 0, + 86, 87, 0, 0, 41, 0, 42, 0, 0, 0, + 0, 43, 44, 45, 88, 46, 0, 47, 89, 0, + 48, 49, 0, 0, 0, 0, 50, 51, 0, 0, + 0, 0, 0, 52, 0, 53, 0, 0, 54, 55, + 56, 0, 0, 0, 0, 0, 0, 0, 0, 57, + 0, 58, 0, 59, 60, 61, 62, 0, 63, 0, + 64, 65, 66, 0, 0, 67, 0, 0, 68, 38, + 69, 70, 71, 72, 73, 0, 0, 74, 0, 75, + 76, 77, 0, 0, 0, 0, 0, 78, 0, 0, + 0, 0, 0, 0, 79, 80, 81, 82, 0, 0, + 0, 0, 0, 0, 83, 84, 0, 0, 85, 0, + 0, 0, 0, 0, 86, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 89 + 0, 0, 89 }; static const yytype_int16 yycheck[] = { - 1, 31, 56, 103, 34, 202, 114, 229, 202, 134, - 34, 103, 34, 131, 68, 38, 68, 218, 219, 220, - 221, 222, 52, 224, 0, 1, 54, 113, 1, 37, - 55, 34, 65, 34, 111, 65, 54, 109, 34, 127, - 64, 42, 112, 51, 135, 144, 54, 23, 147, 148, - 74, 58, 85, 130, 115, 56, 164, 165, 149, 121, - 67, 147, 58, 151, 152, 190, 130, 43, 69, 133, - 46, 67, 149, 113, 92, 93, 52, 11, 12, 112, - 152, 57, 152, 59, 113, 149, 147, 90, 111, 151, - 152, 125, 1, 151, 152, 144, 72, 319, 116, 148, - 123, 143, 113, 131, 132, 147, 131, 130, 130, 130, - 144, 87, 134, 131, 148, 91, 117, 235, 172, 55, - 172, 145, 113, 131, 132, 113, 149, 149, 149, 159, - 160, 152, 162, 130, 43, 227, 166, 145, 146, 147, - 170, 266, 115, 52, 262, 263, 112, 147, 178, 112, - 59, 130, 149, 278, 78, 134, 25, 147, 27, 189, - 126, 191, 192, 147, 98, 99, 100, 101, 144, 199, - 149, 147, 148, 147, 204, 205, 45, 207, 87, 209, - 210, 211, 91, 184, 53, 186, 120, 121, 122, 147, - 130, 118, 119, 415, 195, 135, 397, 66, 395, 120, - 201, 395, 113, 139, 120, 113, 115, 143, 144, 149, - 147, 147, 148, 149, 150, 151, 147, 151, 139, 147, - 154, 155, 156, 139, 128, 129, 131, 147, 149, 150, - 151, 143, 147, 149, 150, 147, 112, 139, 363, 152, - 264, 143, 144, 139, 147, 147, 148, 149, 150, 151, - 260, 261, 147, 149, 150, 151, 10, 119, 125, 289, - 125, 291, 147, 388, 118, 112, 125, 142, 393, 147, - 147, 112, 128, 147, 129, 112, 149, 147, 108, 303, - 115, 406, 127, 112, 112, 19, 124, 110, 113, 125, - 132, 118, 107, 94, 8, 90, 404, 37, 34, 28, - 374, 34, 398, 63, 67, 145, 38, 71, 158, 357, - 410, 393, 406, 388, 34, 370, 325, -1, -1, 419, - 374, -1, -1, -1, 354, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 345, -1, 13, -1, 15, -1, - 351, -1, -1, 20, 21, 22, -1, 24, -1, 26, + 1, 31, 56, 103, 34, 134, 114, 202, 34, 202, + 229, 103, 34, 68, 68, 218, 219, 220, 221, 222, + 131, 224, 52, 0, 1, 1, 54, 1, 34, 54, + 65, 55, 25, 34, 27, 65, 38, 113, 64, 112, + 111, 42, 109, 130, 58, 130, 23, 112, 74, 115, + 85, 130, 45, 67, 133, 56, 164, 165, 121, 130, + 53, 190, 149, 34, 149, 152, 43, 43, 69, 46, + 149, 147, 113, 66, 127, 52, 52, 112, 149, 152, + 57, 147, 59, 59, 90, 152, 130, 58, 151, 152, + 134, 151, 152, 144, 113, 72, 67, 148, 151, 152, + 319, 11, 12, 131, 132, 149, 131, 131, 130, 111, + 87, 87, 134, 205, 91, 91, 117, 172, 172, 145, + 135, 123, 118, 119, 235, 54, 120, 149, 130, 159, + 160, 55, 162, 113, 149, 227, 166, 266, 143, 115, + 170, 115, 147, 11, 12, 139, 112, 149, 178, 278, + 147, 262, 263, 125, 143, 149, 150, 151, 147, 189, + 126, 191, 192, 92, 93, 128, 129, 144, 113, 199, + 147, 148, 144, 130, 204, 113, 148, 207, 135, 209, + 210, 211, 50, 184, 78, 186, 147, 116, 98, 99, + 100, 101, 149, 147, 195, 398, 139, 416, 147, 37, + 201, 396, 131, 396, 260, 261, 149, 150, 151, 113, + 120, 121, 122, 51, 144, 139, 54, 147, 148, 143, + 144, 120, 113, 147, 148, 149, 150, 151, 147, 147, + 98, 99, 100, 101, 147, 364, 147, 152, 264, 131, + 139, 151, 147, 112, 154, 155, 156, 147, 116, 117, + 149, 150, 120, 121, 122, 10, 119, 125, 147, 289, + 389, 291, 130, 147, 125, 394, 125, 147, 118, 112, + 142, 301, 125, 147, 147, 143, 112, 303, 407, 147, + 147, 128, 112, 151, 152, 129, 154, 155, 156, 149, + 147, 139, 108, 131, 132, 143, 144, 405, 127, 147, + 148, 149, 150, 151, 115, 112, 112, 145, 146, 147, + 19, 411, 124, 110, 113, 125, 118, 132, 107, 94, + 420, 375, 8, 90, 37, 355, 34, 28, 375, 34, + 399, 63, 145, 67, 38, 1, 71, 158, 358, 407, + 389, 34, 394, 325, 345, -1, -1, 13, 371, 15, + 351, -1, -1, -1, 20, 21, 22, -1, 24, -1, + 26, -1, -1, 29, 30, -1, -1, -1, -1, 35, + 36, 37, 373, -1, 375, 376, 42, 378, 44, -1, + -1, 47, 48, 49, -1, 51, -1, -1, 54, -1, + -1, -1, 58, -1, 60, -1, 62, 63, 64, 65, + -1, 67, -1, 69, 70, 71, -1, -1, 74, -1, + -1, 77, 78, 79, 80, 81, 82, 83, -1, -1, + 86, -1, 88, 89, 90, -1, -1, -1, -1, -1, + 96, -1, -1, -1, -1, -1, -1, 103, 104, 105, + 106, -1, -1, -1, -1, -1, -1, 113, 114, 115, + -1, 117, -1, -1, -1, -1, -1, 123, 124, -1, + -1, -1, -1, -1, 1, 131, 132, -1, -1, -1, + -1, -1, -1, -1, -1, 141, 13, -1, 15, 145, + 146, 147, -1, 20, 21, 22, -1, 24, -1, 26, -1, -1, 29, 30, -1, -1, -1, -1, 35, 36, - 37, 372, -1, 374, 375, 42, 377, 44, -1, -1, + 37, -1, -1, -1, -1, 42, -1, 44, -1, -1, 47, 48, 49, -1, 51, -1, -1, 54, -1, -1, -1, 58, -1, 60, -1, 62, 63, 64, 65, -1, 67, -1, 69, 70, 71, -1, -1, 74, -1, -1, 77, 78, 79, 80, 81, 82, 83, -1, -1, 86, - -1, 88, 89, 90, -1, -1, -1, -1, -1, 96, + -1, 88, 89, 90, -1, -1, -1, -1, 95, 96, -1, -1, -1, -1, -1, -1, 103, 104, 105, 106, - -1, -1, -1, -1, -1, -1, 113, 114, 115, -1, + -1, -1, -1, -1, -1, -1, 113, 114, 1, -1, 117, -1, -1, -1, -1, -1, 123, 124, -1, -1, - -1, -1, -1, 1, 131, 132, -1, -1, -1, -1, - -1, -1, -1, -1, 141, 13, -1, 15, 145, 146, - 147, -1, 20, 21, 22, -1, 24, -1, 26, -1, - -1, 29, 30, -1, -1, -1, -1, 35, 36, 37, - -1, -1, -1, -1, 42, -1, 44, -1, -1, 47, - 48, 49, -1, 51, -1, -1, 54, -1, -1, -1, - 58, -1, 60, -1, 62, 63, 64, 65, -1, 67, - -1, 69, 70, 71, -1, -1, 74, -1, -1, 77, - 78, 79, 80, 81, 82, 83, -1, -1, 86, -1, - 88, 89, 90, -1, -1, -1, -1, 95, 96, -1, - -1, -1, -1, -1, -1, 103, 104, 105, 106, -1, - -1, -1, -1, -1, -1, 113, 114, 1, -1, 117, - -1, -1, -1, -1, -1, 123, 124, -1, -1, 13, - -1, 15, -1, 131, 132, -1, 20, 21, 22, -1, - 24, -1, 26, 141, -1, 29, 30, 145, 146, 147, + 13, -1, 15, -1, 131, 132, -1, 20, 21, 22, + -1, 24, -1, 26, 141, -1, 29, 30, 145, 146, + 147, -1, 35, 36, 37, -1, -1, -1, -1, 42, + -1, 44, -1, -1, 47, 48, 49, -1, 51, -1, + -1, 54, -1, -1, -1, 58, -1, 60, -1, 62, + 63, 64, 65, -1, 67, -1, 69, 70, 71, -1, + -1, 74, -1, -1, 77, 78, 79, 80, 81, 82, + 83, -1, -1, 86, -1, 88, 89, 90, -1, -1, + -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, + 103, 104, 105, 106, -1, -1, -1, -1, -1, -1, + 113, 114, 115, -1, 117, -1, -1, -1, -1, -1, + 123, 124, -1, -1, -1, -1, -1, 1, 131, 132, + -1, -1, -1, -1, -1, -1, -1, -1, 141, 13, + -1, 15, 145, 146, 147, -1, 20, 21, 22, -1, + 24, -1, 26, -1, -1, 29, 30, -1, -1, -1, -1, 35, 36, 37, -1, -1, -1, -1, 42, -1, 44, -1, -1, 47, 48, 49, -1, 51, -1, -1, 54, -1, -1, -1, 58, -1, 60, -1, 62, 63, @@ -1587,78 +1592,35 @@ -1, 96, -1, -1, -1, -1, -1, -1, 103, 104, 105, 106, -1, -1, -1, -1, -1, -1, 113, 114, 115, -1, 117, -1, -1, -1, -1, -1, 123, 124, - -1, -1, -1, -1, -1, 1, 131, 132, -1, -1, - -1, -1, -1, -1, -1, -1, 141, 13, -1, 15, - 145, 146, 147, -1, 20, 21, 22, -1, 24, -1, - 26, -1, -1, 29, 30, -1, -1, -1, -1, 35, - 36, 37, -1, -1, -1, -1, 42, -1, 44, -1, - -1, 47, 48, 49, -1, 51, -1, -1, 54, -1, - -1, -1, 58, -1, 60, -1, 62, 63, 64, 65, - -1, 67, -1, 69, 70, 71, -1, -1, 74, -1, - -1, 77, 78, 79, 80, 81, 82, 83, -1, -1, - 86, -1, 88, 89, 90, -1, -1, -1, -1, -1, - 96, -1, -1, -1, -1, -1, -1, 103, 104, 105, - 106, -1, -1, -1, -1, -1, -1, 113, 114, 115, - -1, 117, -1, -1, -1, -1, -1, 123, 124, 11, - 12, 13, -1, 15, -1, 131, 132, -1, 20, 21, - 22, -1, 24, -1, 26, 141, -1, 29, 30, 145, - 146, 147, 34, 35, 36, -1, -1, -1, -1, -1, - 42, -1, 44, -1, -1, 47, 48, 49, -1, -1, - 52, -1, -1, -1, -1, -1, 58, 59, 60, -1, - 62, 63, 64, 65, -1, 67, -1, 69, 70, 71, - 72, -1, 74, -1, -1, 77, 78, 79, 80, 81, - 82, 83, -1, -1, 86, 87, 88, 89, 90, 11, - 12, -1, -1, -1, 96, -1, 98, 99, 100, 101, - -1, 103, 104, 105, 106, -1, -1, -1, -1, -1, - -1, 113, 114, -1, -1, 117, -1, -1, 120, 121, - 122, 123, 124, -1, -1, -1, -1, -1, 50, -1, - -1, -1, -1, -1, -1, -1, -1, 139, -1, 141, - -1, 143, 144, -1, -1, 147, 148, 149, 150, 151, - -1, -1, 154, 155, 156, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 98, 99, 100, 101, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 116, 117, -1, -1, 120, 121, - 122, -1, -1, 125, -1, -1, -1, -1, 130, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 143, -1, -1, -1, 147, -1, -1, -1, 151, - 152, -1, 154, 155, 156, 13, -1, 15, -1, -1, - -1, -1, 20, 21, 22, -1, 24, -1, 26, -1, - -1, 29, 30, -1, -1, -1, -1, 35, 36, -1, - -1, -1, -1, -1, 42, -1, 44, -1, -1, 47, - 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, - 58, -1, 60, -1, 62, 63, 64, 65, -1, 67, - -1, 69, 70, 71, -1, -1, 74, -1, -1, 77, - 78, 79, 80, 81, 82, 83, -1, -1, 86, -1, - 88, 89, 90, -1, -1, -1, -1, -1, 96, -1, - -1, -1, -1, -1, -1, 103, 104, 105, 106, -1, - -1, -1, -1, -1, 112, 113, 114, -1, -1, 117, - -1, -1, 13, -1, 15, 123, 124, -1, -1, 20, - 21, 22, -1, 24, -1, 26, -1, -1, 29, 30, - -1, -1, -1, 141, 35, 36, -1, -1, -1, -1, - -1, 42, -1, 44, 152, -1, 47, 48, 49, -1, - -1, -1, -1, -1, -1, -1, -1, 58, -1, 60, + 11, 12, 13, -1, 15, -1, 131, 132, -1, 20, + 21, 22, -1, 24, -1, 26, 141, -1, 29, 30, + 145, 146, 147, 34, 35, 36, -1, -1, -1, -1, + -1, 42, -1, 44, -1, -1, 47, 48, 49, -1, + -1, 52, -1, -1, -1, -1, -1, 58, 59, 60, -1, 62, 63, 64, 65, -1, 67, -1, 69, 70, - 71, -1, -1, 74, -1, -1, 77, 78, 79, 80, - 81, 82, 83, -1, -1, 86, -1, 88, 89, 90, - -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, - -1, -1, 103, 104, 105, 106, -1, -1, -1, -1, - -1, -1, 113, 114, -1, -1, 117, -1, -1, 13, - -1, 15, 123, 124, -1, -1, 20, 21, 22, -1, - 24, -1, 26, -1, -1, 29, 30, -1, -1, -1, - 141, 35, 36, -1, -1, -1, -1, -1, 42, -1, - 44, 152, -1, 47, 48, 49, -1, -1, -1, -1, - -1, -1, -1, -1, 58, -1, 60, -1, 62, 63, - 64, 65, -1, 67, -1, 69, 70, 71, -1, -1, - 74, -1, -1, 77, 78, 79, 80, 81, 82, 83, - -1, -1, 86, -1, 88, 89, 90, -1, -1, -1, - -1, -1, 96, -1, -1, -1, -1, -1, -1, 103, - 104, 105, 106, -1, -1, -1, -1, -1, -1, 113, - 114, -1, -1, 117, -1, -1, -1, -1, -1, 123, - 124, -1, -1, 13, -1, 15, -1, -1, -1, -1, - 20, 21, 22, 137, 24, -1, 26, 141, -1, 29, - 30, -1, -1, -1, -1, 35, 36, -1, -1, -1, - -1, -1, 42, -1, 44, -1, -1, 47, 48, 49, + 71, 72, -1, 74, -1, -1, 77, 78, 79, 80, + 81, 82, 83, -1, -1, 86, 87, 88, 89, 90, + -1, -1, -1, -1, -1, 96, -1, 98, 99, 100, + 101, -1, 103, 104, 105, 106, -1, -1, -1, -1, + -1, -1, 113, 114, -1, -1, 117, -1, -1, 120, + 121, 122, 123, 124, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 139, -1, + 141, -1, 143, 144, -1, -1, 147, 148, 149, 150, + 151, -1, -1, 154, 155, 156, 13, -1, 15, -1, + -1, -1, -1, 20, 21, 22, -1, 24, -1, 26, + -1, -1, 29, 30, -1, -1, -1, -1, 35, 36, + -1, -1, -1, -1, -1, 42, -1, 44, -1, -1, + 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, + -1, 58, -1, 60, -1, 62, 63, 64, 65, -1, + 67, -1, 69, 70, 71, -1, -1, 74, -1, -1, + 77, 78, 79, 80, 81, 82, 83, -1, -1, 86, + -1, 88, 89, 90, -1, -1, -1, -1, -1, 96, + -1, -1, -1, -1, -1, -1, 103, 104, 105, 106, + -1, -1, -1, -1, -1, 112, 113, 114, -1, -1, + 117, -1, -1, 13, -1, 15, 123, 124, -1, -1, + 20, 21, 22, -1, 24, -1, 26, -1, -1, 29, + 30, -1, -1, -1, 141, 35, 36, -1, -1, -1, + -1, -1, 42, -1, 44, 152, -1, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, 60, -1, 62, 63, 64, 65, -1, 67, -1, 69, 70, 71, -1, -1, 74, -1, -1, 77, 78, 79, @@ -1666,9 +1628,31 @@ 90, -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, 103, 104, 105, 106, -1, -1, -1, -1, -1, -1, 113, 114, -1, -1, 117, -1, -1, - -1, -1, -1, 123, 124, -1, -1, -1, -1, -1, + 13, -1, 15, 123, 124, -1, -1, 20, 21, 22, + -1, 24, -1, 26, -1, -1, 29, 30, -1, -1, + -1, 141, 35, 36, -1, -1, -1, -1, -1, 42, + -1, 44, 152, -1, 47, 48, 49, -1, -1, -1, + -1, -1, -1, -1, -1, 58, -1, 60, -1, 62, + 63, 64, 65, -1, 67, -1, 69, 70, 71, -1, + -1, 74, -1, -1, 77, 78, 79, 80, 81, 82, + 83, -1, -1, 86, -1, 88, 89, 90, -1, -1, + -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, + 103, 104, 105, 106, -1, -1, -1, -1, -1, -1, + 113, 114, -1, -1, 117, -1, -1, -1, -1, -1, + 123, 124, -1, -1, 13, -1, 15, -1, -1, -1, + -1, 20, 21, 22, 137, 24, -1, 26, 141, -1, + 29, 30, -1, -1, -1, -1, 35, 36, -1, -1, + -1, -1, -1, 42, -1, 44, -1, -1, 47, 48, + 49, -1, -1, -1, -1, -1, -1, -1, -1, 58, + -1, 60, -1, 62, 63, 64, 65, -1, 67, -1, + 69, 70, 71, -1, -1, 74, -1, -1, 77, 78, + 79, 80, 81, 82, 83, -1, -1, 86, -1, 88, + 89, 90, -1, -1, -1, -1, -1, 96, -1, -1, + -1, -1, -1, -1, 103, 104, 105, 106, -1, -1, + -1, -1, -1, -1, 113, 114, -1, -1, 117, -1, + -1, -1, -1, -1, 123, 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 141 + -1, -1, 141 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -1705,19 +1689,19 @@ 177, 176, 176, 177, 10, 177, 258, 177, 119, 125, 125, 160, 125, 160, 128, 129, 212, 213, 177, 257, 177, 177, 147, 160, 118, 177, 112, 160, 212, 213, - 177, 177, 177, 112, 177, 177, 177, 1, 115, 177, + 177, 216, 177, 112, 177, 177, 177, 1, 115, 177, 239, 229, 229, 229, 229, 229, 260, 229, 208, 92, 93, 116, 199, 202, 203, 216, 208, 95, 244, 142, 169, 121, 254, 254, 255, 255, 259, 125, 257, 115, 115, 135, 257, 147, 147, 112, 147, 128, 129, 177, - 177, 112, 149, 147, 259, 38, 111, 123, 130, 149, - 235, 237, 238, 108, 246, 127, 261, 151, 209, 208, - 260, 115, 65, 85, 112, 112, 160, 112, 19, 178, - 160, 177, 237, 127, 151, 152, 236, 124, 133, 247, - 251, 252, 257, 110, 248, 112, 126, 211, 261, 160, - 194, 160, 147, 160, 113, 252, 125, 109, 152, 247, - 118, 249, 212, 213, 229, 211, 176, 251, 215, 107, - 250, 94, 241, 208, 115, 215 + 177, 112, 149, 147, 177, 259, 38, 111, 123, 130, + 149, 235, 237, 238, 108, 246, 127, 261, 151, 209, + 208, 260, 115, 65, 85, 112, 112, 160, 112, 19, + 178, 160, 177, 237, 127, 151, 152, 236, 124, 133, + 247, 251, 252, 257, 110, 248, 112, 126, 211, 261, + 160, 194, 160, 147, 160, 113, 252, 125, 109, 152, + 247, 118, 249, 212, 213, 229, 211, 176, 251, 215, + 107, 250, 94, 241, 208, 115, 215 }; #define yyerrok (yyerrstatus = 0) @@ -1844,14 +1828,14 @@ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_value_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep, const YYLTYPE * const yylocationp) +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp) FILE *yyoutput; int yytype; - const YYSTYPE * const yyvaluep; - const YYLTYPE * const yylocationp; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; #endif { if (!yyvaluep) @@ -1878,14 +1862,14 @@ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep, const YYLTYPE * const yylocationp) +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) FILE *yyoutput; int yytype; - const YYSTYPE * const yyvaluep; - const YYLTYPE * const yylocationp; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; #endif { if (yytype < YYNTOKENS) @@ -1938,8 +1922,7 @@ yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) #else static void -yy_reduce_print (yyvsp, yylsp, yyrule - ) +yy_reduce_print (yyvsp, yylsp, yyrule) YYSTYPE *yyvsp; YYLTYPE *yylsp; int yyrule; @@ -3304,11 +3287,11 @@ /* could we try to display transposed?? later FIXME */ GList* ret; - MALLOC_NODE(n1, (yyvsp[(1) - (3)].generic)); - n1->user_string = g_strconcat((yyvsp[(1) - (3)].generic).user_string, (yyvsp[(2) - (3)].n).user_string, + MALLOC_NODE(n1, (yyvsp[(1) - (4)].generic)); + n1->user_string = g_strconcat((yyvsp[(1) - (4)].generic).user_string, (yyvsp[(2) - (4)].n).user_string, (yyvsp[(3) - (4)].n).user_string, NULL); ret = g_list_append(NULL, n1); - (yyval.scm) = g_list_concat(ret, (yyvsp[(3) - (3)].scm)); + (yyval.scm) = g_list_concat(ret, (yyvsp[(4) - (4)].scm)); ;} @@ -5343,7 +5326,7 @@ /* Line 1267 of yacc.c. */ -#line 5347 "lyparser.tab.c" +#line 5330 "lyparser.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -5558,7 +5541,8 @@ if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - return yyresult; + /* Make sure YYID is used. */ + return YYID (yyresult); } diff -urN /home/rshann/denemo-cvs/denemo/src/lyparser.h ./src/lyparser.h --- /home/rshann/denemo-cvs/denemo/src/lyparser.h 2007-01-31 20:13:46.000000000 +0000 +++ ./src/lyparser.h 2007-08-19 11:30:20.000000000 +0100 @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 2.2. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C @@ -330,7 +330,7 @@ nodeglist *branch; GList *scm; } -/* Line 1528 of yacc.c. */ +/* Line 1489 of yacc.c. */ #line 335 "lyparser.tab.h" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff -urN /home/rshann/denemo-cvs/denemo/src/lyparser.y ./src/lyparser.y --- /home/rshann/denemo-cvs/denemo/src/lyparser.y 2007-01-31 20:13:46.000000000 +0000 +++ ./src/lyparser.y 2007-08-19 11:30:20.000000000 +0100 @@ -1029,15 +1029,15 @@ | Sequential_music { $$ = $1; } - | TRANSPOSE pitch Music { + | TRANSPOSE pitch pitch Music { /* could we try to display transposed?? later FIXME */ GList* ret; MALLOC_NODE(n1, $1); - n1->user_string = g_strconcat($1.user_string, $2.user_string, + n1->user_string = g_strconcat($1.user_string, $2.user_string, $3.user_string, NULL); ret = g_list_append(NULL, n1); - $$ = g_list_concat(ret, $3); + $$ = g_list_concat(ret, $4); } diff -urN /home/rshann/denemo-cvs/denemo/src/main.c ./src/main.c --- /home/rshann/denemo-cvs/denemo/src/main.c 2007-03-18 11:50:37.000000000 +0000 +++ ./src/main.c 2007-08-19 11:30:20.000000000 +0100 @@ -468,16 +468,17 @@ * a blank score is created whether or not a load was specified. * This is done this way because the load could bomb out. */ - GDir *dir; + GDir *dir=NULL; gchar *filename; error = NULL; - dir = g_dir_open (locatedotdenemo (), 0, &error); - if (error) - { - g_print ("Cannot find .denemo directory %s\n", error->message); - g_error_free (error); - } - + if(locatedotdenemo ()) { + dir = g_dir_open (locatedotdenemo (), 0, &error); + if (error) + { + g_print ("Cannot read .denemo directory %s\n", error->message); + g_error_free (error); + } + } while (dir && (filename = (gchar *) g_dir_read_name (dir)) != NULL) { if (0 == strcmp ("crashrecovery.denemo", filename)) diff -urN /home/rshann/denemo-cvs/denemo/src/Makefile.am ./src/Makefile.am --- /home/rshann/denemo-cvs/denemo/src/Makefile.am 2007-02-23 21:23:52.000000000 +0000 +++ ./src/Makefile.am 2007-08-19 11:45:35.000000000 +0100 @@ -30,7 +30,8 @@ alsaplayback.c alsaplayback.h bookmarks.c bookmarks.h scorewizard.c \ external.h scorewizard.h fakechord.h \ parseinstruments.c parseinstruments.h keyboard.c \ - midiseq.h alsaseq.h alsaseq.c + midiseq.h alsaseq.h alsaseq.c \ + pitchentry.c pitchrecog.c audiocapture.c pitchentry.h audio.h #drawlilydir.c lilydirectives.h lilydirectives.c EXTRA_DIST = frogparser.y froglexer.l lylexer.l lyparser.y diff -urN /home/rshann/denemo-cvs/denemo/src/Makefile.in ./src/Makefile.in --- /home/rshann/denemo-cvs/denemo/src/Makefile.in 2007-08-19 15:31:50.000000000 +0100 +++ ./src/Makefile.in 2007-08-19 16:28:10.000000000 +0100 @@ -87,7 +87,8 @@ froglexer.$(OBJEXT) binreloc.$(OBJEXT) alsaplayback.$(OBJEXT) \ bookmarks.$(OBJEXT) scorewizard.$(OBJEXT) \ parseinstruments.$(OBJEXT) keyboard.$(OBJEXT) \ - alsaseq.$(OBJEXT) + alsaseq.$(OBJEXT) pitchentry.$(OBJEXT) pitchrecog.$(OBJEXT) \ + audiocapture.$(OBJEXT) denemo_OBJECTS = $(am_denemo_OBJECTS) am__DEPENDENCIES_1 = denemo_DEPENDENCIES = $(am__DEPENDENCIES_1) @@ -289,7 +290,8 @@ alsaplayback.c alsaplayback.h bookmarks.c bookmarks.h scorewizard.c \ external.h scorewizard.h fakechord.h \ parseinstruments.c parseinstruments.h keyboard.c \ - midiseq.h alsaseq.h alsaseq.c + midiseq.h alsaseq.h alsaseq.c \ + pitchentry.c pitchrecog.c audiocapture.c pitchentry.h audio.h #drawlilydir.c lilydirectives.h lilydirectives.c EXTRA_DIST = frogparser.y froglexer.l lylexer.l lyparser.y @@ -379,6 +381,7 @@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @@ -444,6 +447,8 @@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ diff -urN /home/rshann/denemo-cvs/denemo/src/pitchentry.c ./src/pitchentry.c --- /home/rshann/denemo-cvs/denemo/src/pitchentry.c 1970-01-01 01:00:00.000000000 +0100 +++ ./src/pitchentry.c 2007-08-19 11:30:20.000000000 +0100 @@ -0,0 +1,745 @@ +/* pitchentry.c + * responses to pitchrecognition from audio in + * + * for Denemo, a gtk+ frontend to GNU Lilypond + * (c)2007 Richard Shann + */ +#include +#include "audio.h" +#include "pitchentry.h" +#include "view.h" + + +#define DEFAULT_HIGH (4500.0) +#define DEFAULT_LOW (60.0) +#define DEFAULT_TIMER_RATE (50) + + +static GtkWidget *PR_window = NULL;/* a top level window for controlling pitch-recognition entry. + We do not create one of these for each view (ie each DenemoGUI object, ie each score) because there is only one audio input source being used, so we would have to cope with resource contention issues, there is just no point. */ +DenemoGUI *PR_gui; /* the gui for which the pitch recognition has been set up */ +static GtkWidget *PR_notelabel = NULL; +static GtkWidget *PR_deviation = NULL; +static guint PR_timer;// timer id +static guint PR_enter;// signal id +static guint PR_leave;// signal id +//keymap *PR_oldkeymap;// the keymap of PR_gui when PR was started +//keymap *PR_rhythmkeymap;// special keymap for rhythm work. + +static guint PR_time = DEFAULT_TIMER_RATE;//the period of timer for checking for a new pitch in ms 10 gives quicker response,100 more reliability... +gboolean PR_enable = TRUE; +guint greatest_interval; +static gdouble lowest_pitch = DEFAULT_LOW; +static gdouble highest_pitch = DEFAULT_HIGH; +static gboolean repeated_notes_allowed; +static gdouble transposition_required = 1.0; +typedef struct notespec { + guint step; /* 0=C 1=D ... 6=B */ + gint alteration; /* -2 = bb, -1=b, 0=natural, 1=#, 2=x */ +} notespec; + +typedef struct notepitch { + + double pitch; /* pitch of note of given notespec in range C=260 to B=493 Hz + actual pitch is *=2^octave */ + notespec spec; +} notepitch; + +typedef struct temperament { + gchar *name; + gint sharp;/* which notepitch is the sharpest in circle of 5ths - initially G# */ + gint flat;/* which notepitch is the flattest in circle of 5ths - initially Eb */ + notepitch notepitches[12]; /* pitches of C-natural, C#, ... A#, B-natural */ +} temperament; + +#if 0 +Pythagorean +261.6 279.4 294.3 310.1 331.1 348.8 372.5 392.4 419.1 441.5 465.1 496.7 +Van Zwolle +261.6 279.4 294.3 314.3 331.1 353.6 372.5 392.4 419.1 441.5 471.5 496.7 +Meantone +261.6 272.8 292.3 313.2 326.7 350.0 365.0 391.1 407.9 437.0 468.3 488.3 +Silbermann I +261.6 275.0 293.0 312.2 328.1 349.6 367.5 391.6 411.6 438.5 467.2 491.1 +Silbermann II +261.6 276.2 293.0 312.2 329.6 349.6 369.2 391.6 413.4 438.5 467.2 493.3 +Rameau +261.6 276.9 293.3 309.7 330.4 348.8 369.2 391.1 413.9 438.5 463.0 493.9 +Werckmeister III +261.6 277.5 293.3 311.1 328.9 350.0 370.0 391.1 414.8 438.5 466.7 493.3 +Werckmeister IV +261.6 275.6 293.0 311.5 329.6 348.8 369.2 390.7 413.4 437.5 467.2 492.2 +Werckmeister V +261.6 275.6 293.3 311.1 328.9 348.8 368.7 392.4 413.4 438.5 465.1 493.3 +Werckmeister VI +261.6 278.3 293.8 311.3 331.1 349.5 372.5 391.7 414.2 441.5 466.9 496.7 +Kirnberger II +261.6 277.5 294.3 312.2 328.9 348.8 370.0 392.4 416.2 438.5 465.1 493.3 +Kirnberger III +261.6 277.5 293.3 311.1 328.9 348.8 370.0 391.1 414.8 438.5 465.1 493.3 +Italian 18th Century +261.6 277.2 293.0 311.1 328.9 349.2 370.0 391.1 414.4 438.0 465.1 492.8 +Equal Temperament +261.6 277.2 293.7 311.1 329.6 349.2 370.0 392.0 415.3 440.0 466.2 493.9 +HARPSICHORD TUNING - A COURSE OUTLINE, by G.C. Klop, distributed by The Sunbury Press, P.O. Box 1778, Raleigh, NC 27602. +#endif +static temperament Equal = { + "Equal Temperament", 8,3, + { + {261.6, {0, 0}}, + {277.2, {0, 1}}, + {293.7, {1, 0}}, + {311.1, {2, -1}}, + {329.6, {2, 0}}, + {349.2, {3, 0}}, + {370.0, {3, 1}}, + {392.0, {4, 0}}, + {415.3, {4, 1}}, + {440.0, {5, 0}}, + {466.2, {6, -1}}, + {493.9, {6, 0}} + } +}; + + + +static temperament Meantone = { + "Quarter comma meantone", 8,3, + { + {261.6, {0, 0}}, + {272.8, {0, 1}}, + {292.3, {1, 0}}, + {313.2, {2, -1}}, + {326.7, {2, 0}}, + {350.0, {3, 0}}, + {365.0, {3, 1}}, + {391.1, {4, 0}}, + {407.9, {4, 1}}, + {437.0, {5, 0}}, + {468.3, {6, -1}}, + {488.3, {6, 0}} + } +}; + + +static temperament WerkmeisterIV = { + "Werkmeister IV", 8,3, + { + {262.513, {0, 0}}, /* c */ + {274.070, {0, 1}}, + {293.997, {1, 0}}, /* d */ + {311.830, {2, -1}},/* Eb */ + {329.256, {2, 0}}, /* e */ + {350.809, {3, 0}}, /* f */ + {365.427, {3, 1}}, + {392.882, {4, 0}}, /* g */ + {410.641, {4, 1}},/* g# */ + {440.000, {5, 0}}, /* a */ + {467.218, {6, -1}}, /* Bb */ + {493.883, {6, 0}}/* b */ + } +}; + +static temperament *PR_temperament; /* the currently used temperament */ + + + +static void pr_display_note(DenemoGUI*gui, gchar *notename) { + gchar *labelstr = g_strdup_printf("%s",notename); + //printf("string is %s\n", labelstr); + gtk_label_set_markup(GTK_LABEL(PR_notelabel), labelstr); + g_free(labelstr); +} + +static void pr_display_pitch_deviation(DenemoGUI*gui, double deviation) { + gchar *labelstr = g_strdup_printf("%2.1f",deviation>0.0?"blue":deviation<0.0?"red":"black", deviation); + gtk_label_set_markup(GTK_LABEL(PR_deviation),labelstr ); + g_free(labelstr); +} + + + +/* return c,d,e,f,g,a,b depending on the step. German translation will + be difficult I'm afraid. */ +static gchar step_name(guint step) { + if(step>4) + step -= 7; + return 'C'+step; + + +} + +/* return "##", "#" ..." "..... "bb" for double sharp to double flat accidentals + a const string is returned*/ +static gchar *alteration_name(gint alteration) { + switch(alteration) { + case -2: + return "bb"; + case -1: + return "b"; + case 0: + return ""; + case 1: + return "#"; + + case 2: + return "##"; + default: + return "ER"; + } +} + + + + +/* returns the note names currently set for the given temperament + caller must free the string */ +static gchar * notenames(gpointer p) { + temperament *t=(temperament*)p; + gchar *str, *oldstr; + gint i; + oldstr = g_strdup(""); + for(i=0;i<12;i++) { + if(i==t->flat) + str = g_strdup_printf("%s%c%s ", oldstr, step_name(t->notepitches[i].spec.step), alteration_name(t->notepitches[i].spec.alteration)); + else + if(i==t->sharp) + str = g_strdup_printf("%s%c%s ", oldstr, step_name(t->notepitches[i].spec.step), alteration_name(t->notepitches[i].spec.alteration)); + else + str = g_strdup_printf("%s%c%s ", oldstr, step_name(t->notepitches[i].spec.step), alteration_name(t->notepitches[i].spec.alteration)); + g_free(oldstr); + oldstr = str; + } + return str; +} + + +/* returns an opaque id for the user's default temperament + FIXME user prefs */ +static gpointer default_temperament() { + return (gpointer) ⩵ +} + + +static void sharpen(GtkButton *button, GtkWidget *label) { +#define f (PR_temperament->notepitches[PR_temperament->flat].spec) + gint next = (PR_temperament->flat+11)%12; +#define g (PR_temperament->notepitches[next].spec) + if(g.alteration+1>2) + return; + else { + f.step = g.step; + + f.alteration = g.alteration+1; + + } +#undef f +#undef g + PR_temperament->sharp = PR_temperament->flat; + PR_temperament->flat = (PR_temperament->flat+7)%12; + gchar *names = notenames(PR_temperament); + gtk_label_set_markup((GtkLabel*)label, names); + g_free(names); + return; +} + + + + +static void flatten(GtkButton *button, GtkWidget *label) { + +#define s (PR_temperament->notepitches[PR_temperament->sharp].spec) + gint next = (PR_temperament->sharp+1)%12; +#define t (PR_temperament->notepitches[next].spec) +if(t.alteration-1<-2) + return; + else { + s.step = t.step; + s.alteration = t.alteration-1; + } +#undef s +#undef t + PR_temperament->flat = PR_temperament->sharp; + PR_temperament->sharp = (PR_temperament->sharp+5)%12; + gchar *names = notenames(PR_temperament); + gtk_label_set_markup((GtkLabel*)label, names); + g_free(names); + return; +} + + + + +/* return note for the passed pitch, or NULL if not a good note; + * @param pitch, the pitch being enquired about + * @temperament, the temperament to use to determine which pitch. + * @param which_octave returns the number of the octave above/below mid_c +FIXME there is a bug when the enharmonic changes take b# into the wrong octave +*/ +static notepitch * determine_note(gdouble pitch, temperament *t, gint* which_octave, double *deviation) { + gint i; + gint octave = 0; + while(pitch > t->notepitches[11].pitch*(1.0231)/* quartertone */) { + //printf("pitch going down %f pitch %f\n", pitch, t->notepitches[11].pitch*(1.0231) ); + pitch /= 2; + octave++; + } + while(pitch < t->notepitches[0].pitch*(0.977)/* quartertone */) { + //printf("pitch going up %f pitch\n", pitch); + pitch *=2; + octave--; + } + for(i=0;i<12;i++) { + //printf("considering %d %f\n", pitch, t->notepitches[i].pitch); + if((pitch > t->notepitches[i].pitch*(0.977)) && + (pitch <= t->notepitches[i].pitch*(1.0231))) { + *which_octave = octave; + //printf("found %d octave \n", octave); + *deviation = (pitch - t->notepitches[i].pitch)/( t->notepitches[i].pitch*(pow(2,1.0/12.0)-1.0)/100.0) ; + return &t->notepitches[i]; + } + } + + return NULL; +} + +/* look for a new note played into audio input, if + present insert it into the score */ +gint pitchentry(DenemoGUI *gui) { + static gint last_step=-1, last_alteration, last_octave; + if(PR_window==NULL) + return FALSE;/* stops the timer */ + // if(GTK_WIDGET_HAS_FOCUS (gui->scorearea)) + //return TRUE; + + double deviation; + temperament *t = (temperament*)PR_temperament; + gint octave; + gdouble note = get_pitch(); + static guint gap = 0; + note *= transposition_required; + + if((notelowest_pitch)) + { + //printf("Got a note %2.1f\n", note); + notepitch *found = determine_note(note, t , &octave, &deviation); + if(found) { + if(!repeated_notes_allowed) + if(found->spec.step==last_step && + found->spec.alteration==last_alteration && + (octave==last_octave || octave==last_octave-1)/* sometimes it jumps down an octave */) { + last_step=-1; + printf("Ignoring repeated note\n"); + return TRUE; + } + + last_step = found->spec.step; + last_alteration = found->spec.alteration; + last_octave = octave; + + + int i; + gchar *octstr=g_strdup(""); + for(i=0;ioctave;i--) { + gchar *str = g_strdup_printf("%s%c",octstr,','); + g_free(octstr); + octstr=str; + } + + //printf("note enshift %d %d\n",found->spec.step, found->spec.alteration ); + pr_display_note(gui, g_strdup_printf("%c%s%s",step_name(found->spec.step), alteration_name(found->spec.alteration), octstr)); + g_free(octstr); + pr_display_pitch_deviation(gui, deviation); + + if(!PR_enable) { + //printf("Enter the score area to insert notes!"); + return TRUE; + } + + // Enter the note in the score + + //printf("Cursor_y %d and staffletter = %d\n", gui->si->cursor_y, gui->si->staffletter_y); + gui->si->cursor_y = gui->si->staffletter_y = found->spec.step; + gui->si->cursor_y += 7*octave; + shiftcursor(gui, found->spec.step); + setenshift(gui->si, found->spec.alteration); + displayhelper (gui); + gap = 0; + }//note found + } +#if 0 + else { + gap++; + printf("%d\n",gap); + if(gap>10) + gap=0, + + last_step = -1; + } +#endif + return TRUE; +} + + +static void change_silence(GtkSpinButton *widget, gpointer data){ + double silence = gtk_spin_button_get_value(widget); + set_silence(silence); +} +static void change_threshold(GtkSpinButton *widget, gpointer data){ + double t = gtk_spin_button_get_value(widget); + set_threshold(t); +} +static void change_smoothing(GtkSpinButton *widget, gpointer data){ + double m = gtk_spin_button_get_value(widget); + set_smoothing(m); +} + +static void change_onset_detection(GtkSpinButton *widget, gpointer data){ + guint m = gtk_spin_button_get_value(widget); + set_onset_type(m); +} + + +static void change_lowest_pitch(GtkSpinButton *widget, gpointer data){ + lowest_pitch = gtk_spin_button_get_value(widget); +} +static void change_highest_pitch(GtkSpinButton *widget, gpointer data){ + highest_pitch = gtk_spin_button_get_value(widget); +} + +static void change_greatest_interval(GtkSpinButton *widget, gpointer data){ + greatest_interval = gtk_spin_button_get_value_as_int(widget); +} + +static void change_transposition(GtkSpinButton *widget, gpointer data){ + gdouble power = gtk_spin_button_get_value_as_int(widget); + transposition_required = pow(2.0, power); + printf("transposing = %f 2^1/12=%f\n", transposition_required, pow(2,1.0/12.0)); +} + +/* destroy PR_window, and hence terminate the pitch recog subsystem */ +static void stop_PR_controls(void) { + if(PR_window) + gtk_widget_destroy(PR_window); + PR_window = NULL; +} + +/* stop the pitch recognition subsystem and optionally destroy the window + that controls it */ +static int stop_pitch_recognition_and_window(gboolean stop_window) { + if(PR_gui==NULL)// when closing a second gui after the first has dismissed PR + return; + if(PR_timer) + g_source_remove(PR_timer); + // if(PR_oldkeymap) // should always be true! + // PR_gui->prefs->the_keymap = PR_oldkeymap; + if(PR_enter) + g_signal_handler_disconnect (PR_gui->scorearea, PR_enter); + if(PR_leave) + g_signal_handler_disconnect (PR_gui->scorearea, PR_leave); + PR_timer = PR_enter = PR_leave = 0; + if(stop_window) + stop_PR_controls();// which calls terminate_pitch_recognition + else + terminate_pitch_recognition(); + PR_window = NULL; + + PR_gui = NULL; + + return 0; +} + +static stop_pitch_recognition_callback(){ + stop_pitch_recognition_and_window(FALSE); +} + + + + +static void toggle_repeated_notes_allowed(){ + repeated_notes_allowed = !repeated_notes_allowed; +} +static void change_timer_rate(GtkSpinButton *widget, DenemoGUI *gui){ + PR_time = (guint)gtk_spin_button_get_value(widget); + start_pitch_recognition(gui); +} + + + +static void create_pitch_recognition_window(DenemoGUI *gui) { + if(PR_window) { + g_warning("unexpected call"); + return; + } + PR_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);/* FIXME catch a destroy on this window + and turn off pitch detection, returning to unitialized state */ + + gtk_window_set_title (GTK_WINDOW (PR_window), "Pitch Recognition Control"); + g_signal_connect (G_OBJECT (PR_window), "destroy", + G_CALLBACK (stop_pitch_recognition_callback), NULL); + GtkWidget *main_vbox = gtk_vbox_new (FALSE, 1); + gtk_container_border_width (GTK_CONTAINER (main_vbox), 1); + gtk_container_add (GTK_CONTAINER (PR_window), main_vbox); + + GtkWidget *frame = gtk_frame_new( "Enharmonic selection"); + gtk_container_add (GTK_CONTAINER (main_vbox), frame); + GtkWidget *hbox = gtk_hbox_new (FALSE, 1); + gtk_container_add (GTK_CONTAINER (frame), hbox); + GtkWidget *label = gtk_label_new(""); + GtkWidget *button = gtk_button_new_with_label("flatten"); + gtk_box_pack_start (GTK_BOX (hbox), button, + TRUE, TRUE, 0); + g_signal_connect (G_OBJECT (button), "clicked", + G_CALLBACK (flatten), label); + gchar *names = notenames(PR_temperament); + + gtk_label_set_markup(GTK_LABEL(label),names); + g_free(names); + gtk_box_pack_start (GTK_BOX (hbox), label, + TRUE, TRUE, 0); + + button = gtk_button_new_with_label("sharpen"); + gtk_box_pack_start (GTK_BOX (hbox), button, + TRUE, TRUE, 0); + g_signal_connect (G_OBJECT (button), "clicked", + G_CALLBACK (sharpen), label); + + frame = gtk_frame_new( "Detected note"); + gtk_container_add (GTK_CONTAINER (main_vbox), frame); + hbox = gtk_hbox_new (FALSE, 1); + gtk_container_add (GTK_CONTAINER (frame), hbox); + + PR_notelabel = gtk_label_new("---"); + gtk_box_pack_start (GTK_BOX (hbox), PR_notelabel, + TRUE, TRUE, 0); + PR_deviation = gtk_label_new("0.0"); + gtk_box_pack_start (GTK_BOX (hbox), PR_deviation, + TRUE, TRUE, 0); + /* spinners to select silence, threshold, smoothing */ + + frame = gtk_frame_new( "Pitch Recognition Parameters"); + gtk_container_add (GTK_CONTAINER (main_vbox), frame); + hbox = gtk_hbox_new (FALSE, 1); + gtk_container_add (GTK_CONTAINER (frame), hbox); + + GtkWidget *hbox2 = gtk_hbox_new (FALSE, 1); + gtk_box_pack_start (GTK_BOX (hbox), hbox2, TRUE, TRUE, 0); + + label = gtk_label_new("Silence"); + gtk_box_pack_start (GTK_BOX (hbox2), label, TRUE, TRUE, 0); + GtkAdjustment *spinner_adj = + (GtkAdjustment *) gtk_adjustment_new (-90.0, -1000.0, + 100.0, 10.0, 1.0, 1.0); + GtkWidget *spinner = gtk_spin_button_new (spinner_adj, 100.0, 0); + gtk_box_pack_start (GTK_BOX (hbox), spinner, TRUE, TRUE, 0); + g_signal_connect (G_OBJECT (spinner), "value-changed", + G_CALLBACK (change_silence), NULL); + + hbox2 = gtk_hbox_new (FALSE, 1); + gtk_box_pack_start (GTK_BOX (hbox), hbox2, TRUE, TRUE, 0); + + label = gtk_label_new("Threshold"); + gtk_box_pack_start (GTK_BOX (hbox2), label, TRUE, TRUE, 0); + spinner_adj = + (GtkAdjustment *) gtk_adjustment_new (0.3, 0.01, + 100.0, 0.01, 1.0, 1.0); + spinner = gtk_spin_button_new (spinner_adj, 0.5, 2); + gtk_box_pack_start (GTK_BOX (hbox2), spinner, TRUE, TRUE, 0); + g_signal_connect (G_OBJECT (spinner), "value-changed", + G_CALLBACK (change_threshold), NULL); + + hbox2 = gtk_hbox_new (FALSE, 1); + gtk_box_pack_start (GTK_BOX (hbox), hbox2, TRUE, TRUE, 0); + + label = gtk_label_new("Smoothing"); + gtk_box_pack_start (GTK_BOX (hbox2), label, TRUE, TRUE, 0); + spinner_adj = + (GtkAdjustment *) gtk_adjustment_new (6.0, 0.0, + 100.0, 1.0, 1.0, 1.0); + spinner = gtk_spin_button_new (spinner_adj, 0.5, 2); + gtk_box_pack_start (GTK_BOX (hbox2), spinner, TRUE, TRUE, 0); + g_signal_connect (G_OBJECT (spinner), "value-changed", + G_CALLBACK (change_smoothing), NULL); + + label = gtk_label_new("Onset"); + gtk_box_pack_start (GTK_BOX (hbox2), label, TRUE, TRUE, 0); + spinner_adj = + (GtkAdjustment *) gtk_adjustment_new (7.0, 0.0, + 7.0, 1.0, 1.0, 1.0); + spinner = gtk_spin_button_new (spinner_adj, 0.5, 2); + gtk_box_pack_start (GTK_BOX (hbox2), spinner, TRUE, TRUE, 0); + g_signal_connect (G_OBJECT (spinner), "value-changed", + G_CALLBACK (change_onset_detection), NULL); + + + + /* spinners to constrain the note values */ + + + frame = gtk_frame_new( "Note validation criteria"); + gtk_container_add (GTK_CONTAINER (main_vbox), frame); + hbox = gtk_hbox_new (FALSE, 1); + gtk_container_add (GTK_CONTAINER (frame), hbox); + + hbox2 = gtk_hbox_new (FALSE, 1); + gtk_box_pack_start (GTK_BOX (hbox), hbox2, TRUE, TRUE, 0); + + label = gtk_label_new("Lowest Pitch"); + gtk_box_pack_start (GTK_BOX (hbox2), label, TRUE, TRUE, 0); + spinner_adj = + (GtkAdjustment *) gtk_adjustment_new (DEFAULT_LOW, 60.0, 2080.0, + 10.0, 1.0, 1.0); + spinner = gtk_spin_button_new (spinner_adj, 100.0, 1); + gtk_box_pack_start (GTK_BOX (hbox), spinner, TRUE, TRUE, 0); + g_signal_connect (G_OBJECT (spinner), "value-changed", + G_CALLBACK (change_lowest_pitch), NULL); + + hbox2 = gtk_hbox_new (FALSE, 1); + gtk_box_pack_start (GTK_BOX (hbox), hbox2, TRUE, TRUE, 0); + + label = gtk_label_new("Highest Pitch"); + gtk_box_pack_start (GTK_BOX (hbox2), label, TRUE, TRUE, 0); + spinner_adj = + (GtkAdjustment *) gtk_adjustment_new (DEFAULT_HIGH, 120.0, 2400.0, + 0.01, 1.0, 1.0); + spinner = gtk_spin_button_new (spinner_adj, 100.0, 1); + gtk_box_pack_start (GTK_BOX (hbox2), spinner, TRUE, TRUE, 0); + g_signal_connect (G_OBJECT (spinner), "value-changed", + G_CALLBACK (change_highest_pitch), NULL); + + hbox2 = gtk_hbox_new (FALSE, 1); + gtk_box_pack_start (GTK_BOX (hbox), hbox2, TRUE, TRUE, 0); + + label = gtk_label_new("Greatest Interval"); + gtk_box_pack_start (GTK_BOX (hbox2), label, TRUE, TRUE, 0); + spinner_adj = + (GtkAdjustment *) gtk_adjustment_new (8.0, 1.0, + 15.0, 1.0, 1.0, 1.0); + spinner = gtk_spin_button_new (spinner_adj, 1.0, 0); + gtk_box_pack_start (GTK_BOX (hbox2), spinner, TRUE, TRUE, 0); + g_signal_connect (G_OBJECT (spinner), "value-changed", + G_CALLBACK (change_greatest_interval), NULL); + + /* options */ + + frame = gtk_frame_new( "Input handling"); + gtk_container_add (GTK_CONTAINER (main_vbox), frame); + hbox = gtk_hbox_new (FALSE, 1); + gtk_container_add (GTK_CONTAINER (frame), hbox); + + + + label = gtk_check_button_new_with_label("Disable repeated notes"); + gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); + g_signal_connect (G_OBJECT (label), "clicked", + G_CALLBACK (toggle_repeated_notes_allowed), NULL); + label = gtk_label_new("Transpose Input"); + gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); + spinner_adj = + (GtkAdjustment *) gtk_adjustment_new (0.0, -3.0, + 3.0, 1.0, 1.0, 1.0); + spinner = gtk_spin_button_new (spinner_adj, 1.0, 0); + gtk_box_pack_start (GTK_BOX (hbox), spinner, TRUE, TRUE, 0); + g_signal_connect (G_OBJECT (spinner), "value-changed", + G_CALLBACK (change_transposition), NULL); + + label = gtk_label_new("Delay"); + gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); + spinner_adj = + (GtkAdjustment *) gtk_adjustment_new (DEFAULT_TIMER_RATE, 1.0, + 500.0, 10.0, 1.0, 1.0); + spinner = gtk_spin_button_new (spinner_adj, 10.0, 0); + gtk_box_pack_start (GTK_BOX (hbox), spinner, TRUE, TRUE, 0); + g_signal_connect (G_OBJECT (spinner), "value-changed", + G_CALLBACK (change_timer_rate), gui); + +/* now show the window, but leave the main window with the focus */ + gtk_window_set_focus_on_map((GtkWindow *)PR_window, FALSE); + gtk_widget_show_all(PR_window); + gtk_window_set_focus((GtkWindow*)PR_window, NULL); + gtk_widget_grab_focus(gui->scorearea); + +} + +#if 0 +static void read_PRkeymap(DenemoGUI *gui) { + PR_oldkeymap = gui->prefs->the_keymap; + if(PR_rhythmkeymap==NULL) + PR_rhythmkeymap = + gui->prefs->the_keymap = create_keymap ("RhythmKeymaprc"); + gui->prefs->the_keymap = PR_rhythmkeymap; + + gchar *localrc = g_build_filename (locatedotdenemo (), "PRkeymaprc", NULL); + load_xml_keymap (localrc, gui->prefs->the_keymap); + +} +#endif +gint setup_pitch_recognition(DenemoGUI *gui){ + if(PR_window) { + gtk_window_present(GTK_WINDOW(PR_window)); + return 0; + } + if(PR_temperament==NULL) + PR_temperament = default_temperament(); + if(initialize_pitch_recognition()==0) { + set_silence(-90.0); + set_threshold(0.3); + set_smoothing(6.0); + transposition_required = 1.0; + lowest_pitch = DEFAULT_LOW; + highest_pitch = DEFAULT_HIGH; + repeated_notes_allowed = TRUE; + create_pitch_recognition_window(gui); + //read_PRkeymap(gui); + return 0; + } else + return -1; +} + + + +/* stop_pitch_recognition + stop audio and aubio + param STOP_WINDOW means destroy the PR_window, otherwise it is + being called from the destroy callback of PR_window itself */ +int stop_pitch_recognition(void) { + return stop_pitch_recognition_and_window(TRUE); + +} + +static void +scorearea_set_active(GtkWidget *widget, GdkEventCrossing *event, DenemoGUI *gui) { + PR_enable = TRUE; + gtk_widget_draw(gui->scorearea, NULL); +} +static void +scorearea_set_inactive(GtkWidget *widget, GdkEventCrossing *event, DenemoGUI *gui) { + PR_enable = FALSE; + gtk_widget_draw(gui->scorearea, NULL); +} +void start_pitch_recognition(DenemoGUI *gui) { + if(PR_timer) + g_source_remove(PR_timer); + PR_timer = g_timeout_add (PR_time, (GSourceFunc)pitchentry, gui); + if(PR_timer==0) + g_error("Timer id 0 - if valid the code needs re-writing (documentation not clear)"); + gtk_widget_add_events (gui->scorearea, GDK_LEAVE_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK); + PR_enter = g_signal_connect (G_OBJECT (gui->scorearea), "enter-notify-event", + G_CALLBACK (scorearea_set_active), (gpointer)gui); + PR_leave = g_signal_connect (G_OBJECT (gui->scorearea), "leave-notify-event", + G_CALLBACK (scorearea_set_inactive), (gpointer)gui); + PR_gui = gui; +} +gboolean pitch_recognition_system_active(void) { + return PR_window!=NULL; +} + +gboolean pitch_entry_active(DenemoGUI *gui) { + return (PR_gui == gui) && PR_enable; +} + diff -urN /home/rshann/denemo-cvs/denemo/src/pitchentry.h ./src/pitchentry.h --- /home/rshann/denemo-cvs/denemo/src/pitchentry.h 1970-01-01 01:00:00.000000000 +0100 +++ ./src/pitchentry.h 2007-08-19 11:30:19.000000000 +0100 @@ -0,0 +1,23 @@ +/* pitchentry.h + * function prototypes for responses to pitchrecognition from audio in + * + * for Denemo, a gtk+ frontend to GNU Lilypond + * (c)2007 Richard Shann + */ + +#ifndef PITCHENTRY_H +#define PITCHENTRY_H + +#include +#include + +#include "selectops.h" +#include "chordops.h" +#include "objops.h" + + +gint setup_pitch_recognition(DenemoGUI *gui); +gint stop_pitch_recognition(void); +void start_pitch_recognition(DenemoGUI *gui); +gboolean pitch_recognition_system_active(void); +#endif //PITCHENTRY_H Binary files /home/rshann/denemo-cvs/denemo/src/pitchrecog and ./src/pitchrecog differ diff -urN /home/rshann/denemo-cvs/denemo/src/pitchrecog.c ./src/pitchrecog.c --- /home/rshann/denemo-cvs/denemo/src/pitchrecog.c 1970-01-01 01:00:00.000000000 +0100 +++ ./src/pitchrecog.c 2007-08-19 12:01:47.000000000 +0100 @@ -0,0 +1,370 @@ +/* + * pitchrecog.c + Hacked from aubionotes.c for denemo by Richard Shann (c) 2007 + Copyright (C) 2003 Paul Brossier + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_C99_VARARGS_MACROS +#define debug(...) if (verbose) fprintf (stderr, __VA_ARGS__) +#define errmsg(...) fprintf (stderr, __VA_ARGS__) +#define outmsg(...) fprintf (stdout, __VA_ARGS__) +#else +#define debug(format, args...) if (verbose) fprintf(stderr, format , ##args) +#define errmsg(format, args...) fprintf(stderr, format , ##args) +#define outmsg(format, args...) fprintf(stdout, format , ##args) +#endif + + + + + + +typedef int (*aubio_process_func_t) + (smpl_t **input, smpl_t **output, int nframes); + + + +static void send_noteon(int pitch, int velo); + + + + + + +#define MAX_PITCHES (20) + +static smpl_t pitches[MAX_PITCHES]; + +static int usejack = 1; +static int usedoubled = 1; + + +/* energy,specdiff,hfc,complexdomain,phase */ +static aubio_onsetdetection_type type_onset = aubio_onset_kl; +static aubio_onsetdetection_type type_onset2 = aubio_onset_complex; +static smpl_t threshold = 0.3; +static smpl_t silence = -90.; +static uint_t buffer_size = 1024; //512; //1024; +static uint_t overlap_size = 512; //256; //512; +static uint_t channels = 1; +static uint_t samplerate = 44100; + +static aubio_pvoc_t * pv; +static fvec_t * ibuf; +static fvec_t * obuf; +static cvec_t * fftgrain; + +static aubio_onsetdetection_t *o; +static aubio_onsetdetection_t *o2; +static fvec_t *onset; +static fvec_t *onset2; +static int isonset = 0; +static aubio_pickpeak_t * parms; + + +/* pitch objects */ +static smpl_t pitch = 0.; +static aubio_pitchdetection_t * pitchdet; +static aubio_pitchdetection_type type_pitch = aubio_pitch_yinfft; // aubio_pitch_mcomb +static aubio_pitchdetection_mode mode_pitch = aubio_pitchm_freq; +static uint_t median = 6; + +static fvec_t * note_buffer = NULL; +static fvec_t * note_buffer2 = NULL; +static smpl_t curlevel = 0.; + + + +static smpl_t curnote = 0.;// should not be global +//smpl_t newnote = 0.; +static uint_t isready = 0;// should not be global, is static within pitchrecog() + + +static aubio_onsetdetection_type onset_types[] = + {aubio_onset_energy, + aubio_onset_specdiff, + aubio_onset_hfc, + aubio_onset_complex, + aubio_onset_complex, + aubio_onset_phase, + aubio_onset_mkl, + aubio_onset_kl + }; + + + + + +static void init_aubio(void) { + + ibuf = new_fvec(overlap_size, channels); + obuf = new_fvec(overlap_size, channels); + fftgrain = new_cvec(buffer_size, channels); + + { + pitchdet = new_aubio_pitchdetection(buffer_size*4, + overlap_size, channels, samplerate, type_pitch, mode_pitch); + aubio_pitchdetection_set_yinthresh(pitchdet, 0.7); + + if (median) { + note_buffer = new_fvec(median, 1); + note_buffer2= new_fvec(median, 1); + } + } + /* phase vocoder */ + pv = new_aubio_pvoc(buffer_size, overlap_size, channels); + /* onsets */ + parms = new_aubio_peakpicker(threshold); + o = new_aubio_onsetdetection(type_onset,buffer_size,channels); + onset = new_fvec(1, channels); + if (usedoubled) { + o2 = new_aubio_onsetdetection(type_onset2,buffer_size,channels); + onset2 = new_fvec(1 , channels); + } + +} + + +static void aubio_finish(void){ + { + send_noteon(curnote,0); + del_aubio_pitchdetection(pitchdet); + if (median) { + del_fvec(note_buffer); + del_fvec(note_buffer2); + } + } + if (usedoubled) { + del_aubio_onsetdetection(o2); + del_fvec(onset2); + } + del_aubio_onsetdetection(o); + del_aubio_peakpicker(parms); + del_aubio_pvoc(pv); + del_fvec(obuf); + del_fvec(ibuf); + del_cvec(fftgrain); + del_fvec(onset); + aubio_cleanup(); +} +static volatile int count; +#if 0 +static void send_noteon(int pitch, int velo) +{ +#if 1 +#define MIN_PITCH (0.0) + if(velo){ + if(pitch> MIN_PITCH && ++count < MAX_PITCHES) + pitches[count] = pitch; + } else { + if(pitch> MIN_PITCH && ++count < MAX_PITCHES) + pitches[count] = -1.0;// note off signal + } +#else + if(velo) + count=1,pitches[1] = pitch,pitches[2] = 1.0; + if(velo==0 && count==1) + count++,pitches[2] = -1.0; +#endif +} +#endif + + +static void send_noteon(int pitch, int velo) +{ + if(velo) + if( ++count < MAX_PITCHES) + pitches[count] = pitch; +} + + + + +/** append new note candidate to the note_buffer and return filtered value. we + * need to copy the input array as vec_median destroy its input data.*/ +static void note_append(fvec_t * note_buffer, smpl_t anote) { + uint_t i = 0; + for (i = 0; i < note_buffer->length - 1; i++) { + note_buffer->data[0][i] = note_buffer->data[0][i+1]; + } + note_buffer->data[0][note_buffer->length - 1] = anote; + return; +} + +static uint_t get_note(fvec_t *note_buffer, fvec_t *note_buffer2){ + uint_t i = 0; + for (i = 0; i < note_buffer->length; i++) { + note_buffer2->data[0][i] = note_buffer->data[0][i]; + } + return vec_median(note_buffer2); +} + + +static int calls; + + +static int Stop; + +int pitchrecog(float **input, float **output, int nframes) { + unsigned int pos = 0; /*frames%dspblocksize*/ + unsigned int i; /*channels*/ + unsigned int j; /*frames*/ + calls++; + if(Stop) + return Stop; + for (j=0;j<(unsigned)nframes;j++) { + if(usejack) { + for (i=0;idata[i][pos] = (float) (*(in+j)-127.0); + } + } + /*when pos reaches overlap size it is time for fft to look for a note*/ + if (pos == overlap_size-1) { + /* block loop */ + aubio_pvoc_do (pv,ibuf, fftgrain); + aubio_onsetdetection(o,fftgrain, onset); + if (usedoubled) { + aubio_onsetdetection(o2,fftgrain, onset2); + onset->data[0][0] *= onset2->data[0][0]; + } + isonset = aubio_peakpick_pimrt(onset,parms); + + pitch = aubio_pitchdetection(pitchdet,ibuf); + + if(median){ + note_append(note_buffer, pitch); + } + + /* curlevel is negatif or 1 if silence */ + curlevel = aubio_level_detection(ibuf, silence); + + if (isonset) { + /* test for silence */ +#ifndef SUSPICIOUS_CODE + if (curlevel == 1.) { +#else + //if (curlevel <= 1.) { + +#endif + + isonset=0; + if (median) isready = 0; + /* send note off */ + send_noteon(curnote,0); + } else { // not silent + if (median) { + isready = 1; + } else { + /* kill old note */ + send_noteon(curnote,0); + /* get and send new one */ + send_noteon(pitch,1); + curnote = pitch; + } + + + } + } else {//not onset + if (median) { + if (isready > 0) + isready++; + if (isready == median) + { + /* kill old note */ + send_noteon(curnote,0); + + curnote = get_note(note_buffer, note_buffer2); + /* get and send new one */ + if (curnote>45){//FIXME + send_noteon(curnote,1); + } + } + } // if median + + } + /* end of block loop */ + pos = -1; /* so it will be zero next j loop */ + } /* end of if pos==overlap_size-1 */ + pos++; + } + return Stop; +} + + +extern int pa_main(aubio_process_func_t process_func); + +#define START init_aubio();return pa_main(pitchrecog); +#define STOP (void)pa_main(NULL);aubio_finish(); + +int set_silence(double shh) { + silence = shh; +} +int set_threshold(double thresh) { /* threshold requires memory allocation */ + STOP + threshold = thresh; + START +} +int set_smoothing(double smooth ) { /* median requires memory allocation */ + STOP + median = (unsigned)smooth; + START +} + +/* FIXME consider controlling usedoubled parameter as well*/ +int set_onset_type(unsigned onset) { + /* changing onset type requires memory allocation */ + if(onset>= sizeof(onset_types)/sizeof(aubio_onsetdetection_type)) + return; + STOP + type_onset = onset_types[onset]; + START +} + +int initialize_pitch_recognition(void ) { + Stop = 0; + init_aubio(); + return pa_main(pitchrecog); +} + +int terminate_pitch_recognition(void ) { + (void)pa_main(NULL); + aubio_finish(); + return 0; +} + +double get_pitch(void) { + double ret=0.0; + if(count) { + //printf("count is %d\n", count); + ret=pitches[count]; + count = 0; + } + + return ret; +} diff -urN /home/rshann/denemo-cvs/denemo/src/portaudio.h ./src/portaudio.h --- /home/rshann/denemo-cvs/denemo/src/portaudio.h 1970-01-01 01:00:00.000000000 +0100 +++ ./src/portaudio.h 2007-08-19 16:34:05.000000000 +0100 @@ -0,0 +1,427 @@ +#ifndef PORT_AUDIO_H +#define PORT_AUDIO_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * PortAudio Portable Real-Time Audio Library + * PortAudio API Header File + * Latest version available at: http://www.audiomulch.com/portaudio/ + * + * Copyright (c) 1999-2000 Ross Bencina and Phil Burk + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * Any person wishing to distribute modifications to the Software is + * requested to send the modifications to the original developer so that + * they can be incorporated into the canonical version. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +typedef int PaError; +typedef enum { + paNoError = 0, + + paHostError = -10000, + paInvalidChannelCount, + paInvalidSampleRate, + paInvalidDeviceId, + paInvalidFlag, + paSampleFormatNotSupported, + paBadIODeviceCombination, + paInsufficientMemory, + paBufferTooBig, + paBufferTooSmall, + paNullCallback, + paBadStreamPtr, + paTimedOut, + paInternalError +} PaErrorNum; + +/* + Pa_Initialize() is the library initialisation function - call this before + using the library. +*/ + +PaError Pa_Initialize( void ); + +/* + Pa_Terminate() is the library termination function - call this after + using the library. +*/ + +PaError Pa_Terminate( void ); + +/* + Return host specific error. + This can be called after receiving a paHostError. +*/ +long Pa_GetHostError( void ); + +/* + Translate the error number into a human readable message. +*/ +const char *Pa_GetErrorText( PaError errnum ); + +/* + Sample formats + + These are formats used to pass sound data between the callback and the + stream. Each device has a "native" format which may be used when optimum + efficiency or control over conversion is required. + + Formats marked "always available" are supported (emulated) by all devices. + + The floating point representation uses +1.0 and -1.0 as the respective + maximum and minimum. + +*/ + +typedef unsigned long PaSampleFormat; +#define paFloat32 ((PaSampleFormat) (1<<0)) /*always available*/ +#define paInt16 ((PaSampleFormat) (1<<1)) /*always available*/ +#define paInt32 ((PaSampleFormat) (1<<2)) /*always available*/ +#define paInt24 ((PaSampleFormat) (1<<3)) +#define paPackedInt24 ((PaSampleFormat) (1<<4)) +#define paInt8 ((PaSampleFormat) (1<<5)) +#define paUInt8 ((PaSampleFormat) (1<<6)) /* unsigned 8 bit, 128 is "ground" */ +#define paCustomFormat ((PaSampleFormat) (1<<16)) + +/* + Device enumeration mechanism. + + Device ids range from 0 to Pa_CountDevices()-1. + + Devices may support input, output or both. Device 0 is always the "default" + device and should support at least stereo in and out if that is available + on the taget platform _even_ if this involves kludging an input/output + device on platforms that usually separate input from output. Other platform + specific devices are specified by positive device ids. +*/ + +typedef int PaDeviceID; +#define paNoDevice -1 + +typedef struct{ + int structVersion; + const char *name; + int maxInputChannels; + int maxOutputChannels; +/* Number of discrete rates, or -1 if range supported. */ + int numSampleRates; +/* Array of supported sample rates, or {min,max} if range supported. */ + const double *sampleRates; + PaSampleFormat nativeSampleFormats; +} PaDeviceInfo; + + +int Pa_CountDevices(); +/* + Pa_GetDefaultInputDeviceID(), Pa_GetDefaultOutputDeviceID() + + Return the default device ID or paNoDevice if there is no devices. + The result can be passed to Pa_OpenStream(). + + On the PC, the user can specify a default device by + setting an environment variable. For example, to use device #1. + + set PA_RECOMMENDED_OUTPUT_DEVICE=1 + + The user should first determine the available device ID by using + the supplied application "pa_devs". +*/ +PaDeviceID Pa_GetDefaultInputDeviceID( void ); +PaDeviceID Pa_GetDefaultOutputDeviceID( void ); + +/* + PaTimestamp is used to represent a continuous sample clock with arbitrary + start time useful for syncronisation. The type is used in the outTime + argument to the callback function and the result of Pa_StreamTime() +*/ + +typedef double PaTimestamp; + +/* + Pa_GetDeviceInfo() returns a pointer to an immutable PaDeviceInfo structure + referring to the device specified by id. + If id is out of range the function returns NULL. + + The returned structure is owned by the PortAudio implementation and must + not be manipulated or freed. The pointer is guaranteed to be valid until + between calls to Pa_Initialize() and Pa_Terminate(). +*/ + +const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceID devID ); + +/* + PortAudioCallback is implemented by clients of the portable audio api. + + inputBuffer and outputBuffer are arrays of interleaved samples, + the format, packing and number of channels used by the buffers are + determined by parameters to Pa_OpenStream() (see below). + + framesPerBuffer is the number of sample frames to be processed by the callback. + + outTime is the time in samples when the buffer(s) processed by + this callback will begin being played at the audio output. + See also Pa_StreamTime() + + userData is the value of a user supplied pointer passed to Pa_OpenStream() + intended for storing synthesis data etc. + + return value: + The callback can return a nonzero value to stop the stream. This may be + useful in applications such as soundfile players where a specific duration + of output is required. However, it is not necessary to utilise this mechanism + as StopStream() will also terminate the stream. A callback returning a + nonzero value must fill the entire outputBuffer. + + NOTE: None of the other stream functions may be called from within the + callback function except for Pa_GetCPULoad(). + +*/ + +typedef int (PortAudioCallback)( + void *inputBuffer, void *outputBuffer, + unsigned long framesPerBuffer, + PaTimestamp outTime, void *userData ); + + +/* + Stream flags + + These flags may be supplied (ored together) in the streamFlags argument to + the Pa_OpenStream() function. + + [ suggestions? ] +*/ + +#define paNoFlag (0) +#define paClipOff (1<<0) /* disable defult clipping of out of range samples */ +#define paDitherOff (1<<1) /* disable default dithering */ +#define paPlatformSpecificFlags (0x00010000) +typedef unsigned long PaStreamFlags; + +/* + A single PortAudioStream provides multiple channels of real-time + input and output audio streaming to a client application. + Pointers to PortAudioStream objects are passed between PortAudio functions. +*/ + +typedef void PortAudioStream; +#define PaStream PortAudioStream + +/* + Pa_OpenStream() opens a stream for either input, output or both. + + stream is the address of a PortAudioStream pointer which will receive + a pointer to the newly opened stream. + + inputDevice is the id of the device used for input (see PaDeviceID above.) + inputDevice may be paNoDevice to indicate that an input device is not required. + + numInputChannels is the number of channels of sound to be delivered to the + callback. It can range from 1 to the value of maxInputChannels in the + device input record for the device specified in the inputDevice parameter. + If inputDevice is paNoDevice numInputChannels is ignored. + + inputSampleFormat is the format of inputBuffer provided to the callback + function. inputSampleFormat may be any of the formats described by the + PaSampleFormat enumeration (see above). PortAudio guarantees support for + the sound devices native formats (nativeSampleFormats in the device info + record) and additionally 16 and 32 bit integer and 32 bit floating point + formats. Support for other formats is implementation defined. + + inputDriverInfo is a pointer to an optional driver specific data structure + containing additional information for device setup or stream processing. + inputDriverInfo is never required for correct operation. If not used + inputDriverInfo should be NULL. + + outputDevice is the id of the device used for output (see PaDeviceID above.) + outputDevice may be paNoDevice to indicate that an output device is not required. + + numOutputChannels is the number of channels of sound to be supplied by the + callback. See the definition of numInputChannels above for more details. + + outputSampleFormat is the sample format of the outputBuffer filled by the + callback function. See the definition of inputSampleFormat above for more + details. + + outputDriverInfo is a pointer to an optional driver specific data structure + containing additional information for device setup or stream processing. + outputDriverInfo is never required for correct operation. If not used + outputDriverInfo should be NULL. + + sampleRate is the desired sampleRate for input and output + + framesPerBuffer is the length in sample frames of all internal sample buffers + used for communication with platform specific audio routines. Wherever + possible this corresponds to the framesPerBuffer parameter passed to the + callback function. + + numberOfBuffers is the number of buffers used for + multibuffered communication with the platform specific audio + routines. If you pass zero, then an optimum value will be + chosen for you internally. This parameter is provided only + as a guide - and does not imply that an implementation must + use multibuffered i/o when reliable double buffering is + available (such as SndPlayDoubleBuffer() on the Macintosh.) + + streamFlags may contain a combination of flags ORed together. + These flags modify the behavior of the + streaming process. Some flags may only be relevant to certain buffer formats. + + callback is a pointer to a client supplied function that is responsible + for processing and filling input and output buffers (see above for details.) + + userData is a client supplied pointer which is passed to the callback + function. It could for example, contain a pointer to instance data necessary + for processing the audio buffers. + + return value: + Apon success Pa_OpenStream() returns PaNoError and places a pointer to a + valid PortAudioStream in the stream argument. The stream is inactive (stopped). + If a call to Pa_OpenStream() fails a nonzero error code is returned (see + PAError above) and the value of stream is invalid. + +*/ + +PaError Pa_OpenStream( PortAudioStream** stream, + PaDeviceID inputDevice, + int numInputChannels, + PaSampleFormat inputSampleFormat, + void *inputDriverInfo, + PaDeviceID outputDevice, + int numOutputChannels, + PaSampleFormat outputSampleFormat, + void *outputDriverInfo, + double sampleRate, + unsigned long framesPerBuffer, + unsigned long numberOfBuffers, + PaStreamFlags streamFlags, + PortAudioCallback *callback, + void *userData ); + + +/* + Pa_OpenDefaultStream() is a simplified version of Pa_OpenStream() that + opens the default input and/or ouput devices. Most parameters have + identical meaning to their Pa_OpenStream() counterparts, with the following + exceptions: + + If either numInputChannels or numOutputChannels is 0 the respective device + is not opened (same as passing paNoDevice in the device arguments to Pa_OpenStream() ) + + sampleFormat applies to both the input and output buffers. +*/ + +PaError Pa_OpenDefaultStream( PortAudioStream** stream, + int numInputChannels, + int numOutputChannels, + PaSampleFormat sampleFormat, + double sampleRate, + unsigned long framesPerBuffer, + unsigned long numberOfBuffers, + PortAudioCallback *callback, + void *userData ); + +/* + Pa_CloseStream() closes an audio stream, flushing any pending buffers. +*/ + +PaError Pa_CloseStream( PortAudioStream* ); + +/* + Pa_StartStream() and Pa_StopStream() begin and terminate audio processing. + Pa_StopStream() waits until all pending audio buffers have been played. + Pa_AbortStream() stops playing immediately without waiting for pending + buffers to complete. +*/ + +PaError Pa_StartStream( PortAudioStream *stream ); + +PaError Pa_StopStream( PortAudioStream *stream ); + +PaError Pa_AbortStream( PortAudioStream *stream ); + +/* + Pa_StreamActive() returns one when the stream is playing audio, + zero when not playing, or a negative error number if the + stream is invalid. + The stream is active between calls to Pa_StartStream() and Pa_StopStream(), + but may also become inactive if the callback returns a non-zero value. + In the latter case, the stream is considered inactive after the last + buffer has finished playing. +*/ + +PaError Pa_StreamActive( PortAudioStream *stream ); + +/* + Pa_StreamTime() returns the current output time for the stream in samples. + This time may be used as a time reference (for example syncronising audio to + MIDI). +*/ + +PaTimestamp Pa_StreamTime( PortAudioStream *stream ); + +/* + The "CPU Load" is a fraction of total CPU time consumed by the + stream's audio processing. + A value of 0.5 would imply that PortAudio and the sound generating + callback was consuming roughly 50% of the available CPU time. + This function may be called from the callback function or the application. +*/ +double Pa_GetCPULoad( PortAudioStream* stream ); + +/* + Use Pa_GetMinNumBuffers() to determine minimum number of buffers required for + the current host based on minimum latency. + On the PC, for the DirectSound implementation, latency can be optionally set + by user by setting an environment variable. + For example, to set latency to 200 msec, put: + + set PA_MIN_LATENCY_MSEC=200 + + in the AUTOEXEC.BAT file and reboot. + If the environment variable is not set, then the latency will be determined + based on the OS. Windows NT has higher latency than Win95. +*/ + +int Pa_GetMinNumBuffers( int framesPerBuffer, double sampleRate ); + +/* + Sleep for at least 'msec' milliseconds. + You may sleep longer than the requested time so don't rely + on this for accurate musical timing. +*/ +void Pa_Sleep( long msec ); + +/* + Return size in bytes of a single sample in a given PaSampleFormat + or paSampleFormatNotSupported. +*/ +PaError Pa_GetSampleSize( PaSampleFormat format ); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* PORT_AUDIO_H */ diff -urN /home/rshann/denemo-cvs/denemo/src/prefops.c ./src/prefops.c --- /home/rshann/denemo-cvs/denemo/src/prefops.c 2007-08-19 16:00:12.000000000 +0100 +++ ./src/prefops.c 2007-08-19 11:30:20.000000000 +0100 @@ -36,8 +36,8 @@ locatedotdenemo () { static gchar *dotdenemo = NULL; +#if 0 DIR *dir; - if (!dotdenemo) { dotdenemo = g_build_filename (g_get_home_dir(), ".denemo", NULL); @@ -57,7 +57,22 @@ else g_warning (_("locatedotdenemo : error opening directory %s : %s"), dotdenemo, g_strerror (errno)); + g_free(dotdenemo); + dotdenemo = NULL; } +#else + gboolean err; + if (!dotdenemo) + { + dotdenemo = g_build_filename (g_get_home_dir(), ".denemo", NULL); + } + err = g_mkdir_with_parents(dotdenemo, 0770); + if(err) { + warningdialog("Could not create .denemo for you personal settings"); + g_free(dotdenemo); + dotdenemo = NULL; + } +#endif return dotdenemo; } @@ -73,7 +88,8 @@ { gchar *systemwide = g_build_filename (get_data_dir (), "denemo.conf", NULL); DenemoPrefs *ret = (DenemoPrefs *) g_malloc (sizeof (DenemoPrefs)); - gchar *localrc = g_build_filename (locatedotdenemo (), "denemorc", NULL); + gchar * dotdenemo = locatedotdenemo (); + gchar *localrc = dotdenemo?g_build_filename (dotdenemo, "denemorc", NULL):NULL; /* Reasonable default values */ @@ -86,7 +102,7 @@ ret->pdfviewer = g_string_new ("xpdf"); ret->texteditor = g_string_new ("xedit"); ret->denemopath = g_string_new (g_get_home_dir()); - ret->lilyversion = g_string_new ("2.10"); + ret->lilyversion = g_string_new (""); ret->immediateplayback = TRUE; ret->saveparts = FALSE; ret->rtcs = TRUE; @@ -106,7 +122,8 @@ /* Read values from personal preferences file */ //readpreffile (localrc, ret); - readxmlprefs (localrc, ret, TRUE); + if(localrc) + readxmlprefs (localrc, ret, TRUE); g_free (systemwide); g_free (localrc); @@ -502,10 +519,7 @@ if (prefs->lilypath) xmlNewChild (child, NULL, (xmlChar *) "lilypondpath", (xmlChar *) prefs->lilypath->str); - if (prefs->lilyversion) - xmlNewChild (child, NULL, (xmlChar *) "lilyversion", - (xmlChar *) prefs->lilyversion->str); - if (prefs->midiplayer) + if (prefs->lilypath) xmlNewChild (child, NULL, (xmlChar *) "midiplayer", (xmlChar *) prefs->midiplayer->str); if (prefs->audioplayer) @@ -526,6 +540,9 @@ if (prefs->denemopath) xmlNewChild (child, NULL, (xmlChar *) "denemopath", (xmlChar *) prefs->denemopath->str); + if (prefs->lilyversion) + xmlNewChild (child, NULL, (xmlChar *) "lilyversion", + (xmlChar *) prefs->lilyversion->str); newXMLIntChild (child, (xmlChar *) "autosave", prefs->autosave); newXMLIntChild (child, (xmlChar *) "autosavetimeout", prefs->autosave_timeout); diff -urN /home/rshann/denemo-cvs/denemo/src/scorewizard.c ./src/scorewizard.c --- /home/rshann/denemo-cvs/denemo/src/scorewizard.c 2007-01-24 19:44:26.000000000 +0000 +++ ./src/scorewizard.c 2007-08-19 11:30:19.000000000 +0100 @@ -12,6 +12,17 @@ */ /** + * Instrument properties + */ +typedef struct instproperties +{ + gint *clef; + gint numstaffs; + gint *transposition; +}instproperties; + + +/** * Lilyponds supported font sizes */ static gchar *fontsizes[8] = @@ -94,9 +105,14 @@ curstaffstruct = (DenemoStaff *) wdata->gui->si->currentstaff->data; dnm_setinitialclef(wdata->gui->si, curstaffstruct, (int) ((instproperties *) inst)->clef); - strcpy(curstaffstruct->denemo_name->str, instrument); + //strcpy(curstaffstruct->denemo_name->str, instrument); + + curstaffstruct->denemo_name->str = g_strdup(instrument); + set_lily_name (curstaffstruct->denemo_name,curstaffstruct->lily_name); - strcpy(curstaffstruct->midi_instrument->str, instrument); + //strcpy(curstaffstruct->midi_instrument->str, instrument); + curstaffstruct->midi_instrument->str = g_strdup(instrument); + curstaffstruct->transposition = (int) inst->transposition; @@ -137,10 +153,13 @@ g_string_assign(temp, instrument); gchar *pianobasslh = "rh"; g_string_append(temp,pianobasslh); - strcpy(curstaffstruct->denemo_name->str, temp->str); + //strcpy(curstaffstruct->denemo_name->str, temp->str); + curstaffstruct->denemo_name->str = g_strdup(temp->str); + set_lily_name (curstaffstruct->denemo_name, curstaffstruct->lily_name); //strcpy(curstaffstruct->midi_instrument->str, instrument); + curstaffstruct->midi_instrument->str = g_strdup(instrument); } if (numstaffsforinstrument == 2){ wdata->gui->si->currentstaff = @@ -155,7 +174,9 @@ g_string_assign(temp, instrument); gchar *pianobassrh = "lh"; g_string_append(temp,pianobassrh); - strcpy(curstaffstruct->denemo_name->str, temp->str); + // strcpy(curstaffstruct->denemo_name->str, temp->str); + + curstaffstruct->denemo_name->str = g_strdup(temp->str); set_lily_name (curstaffstruct->denemo_name, curstaffstruct->lily_name); //strcpy(curstaffstruct->midi_instrument->str, instrument); @@ -185,7 +206,6 @@ break; } }; - g_free(instrument); printf("\nlocation c currentstaffnum = %i\n", wdata->gui->si->currentstaffnum); @@ -241,7 +261,7 @@ //g_print("string comparison returns %i\n", (!strcmp(((InstrumentConfig *)inst->data)->name->str,"Flute"))); instr->clef = (gint *) ((InstrumentConfig *)inst->data)->sclef; instr->transposition = (gint *) ((InstrumentConfig *)inst->data)->transposition; - instr->numstaffs = (gint *) ((InstrumentConfig *)inst->data)->numstaffs; + instr->numstaffs = ((InstrumentConfig *)inst->data)->numstaffs; #ifdef DEBUG g_print("instrument name inst->data)->name->str = %s\n", ((InstrumentConfig *)inst->data)->name->str); g_print("number of staves for instrument = %i\n", (gint) ((InstrumentConfig *)inst->data)->numstaffs); @@ -270,6 +290,7 @@ //g_print ("Row %s: %s staff #= %i\n", tree_path_str,name,staffnumber); instproperties *instr = (instproperties *) lookup_instrument_properties(name, wdata); create_staff_instruments(wdata, name, instr); + g_free(name); return FALSE; } /** @@ -1070,7 +1091,7 @@ wizarddata *wdata = (wizarddata *) g_malloc0 (sizeof (wizarddata)); wdata->icbdata = (instsdata *) g_malloc0 (sizeof (instsdata)); - GList *instruments; + wdata->gui = (DenemoGUI *) gui; wdata->staffnumber = 0; diff -urN /home/rshann/denemo-cvs/denemo/src/scorewizard.h ./src/scorewizard.h --- /home/rshann/denemo-cvs/denemo/src/scorewizard.h 2007-01-24 19:44:26.000000000 +0000 +++ ./src/scorewizard.h 2007-08-19 11:30:19.000000000 +0100 @@ -68,15 +68,6 @@ GtkListStore *list_store; }instsdata; -/** - * Instrument properties - */ -typedef struct instproperties -{ - gint *clef; - gint *numstaffs; - gint *transposition; -}instproperties; /** * Score setup callback data diff -urN /home/rshann/denemo-cvs/denemo/src/utils.c ./src/utils.c --- /home/rshann/denemo-cvs/denemo/src/utils.c 2007-01-24 19:44:26.000000000 +0000 +++ ./src/utils.c 2007-08-19 11:30:20.000000000 +0100 @@ -37,8 +37,6 @@ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); - - } @@ -154,8 +152,8 @@ /** * Sets the minimum space that needs to be allocated for drawing a mudela - * object - * + * object based on the type + * also sets space_before * @param theobj the DenemoObject to set the minimum space on * @return none */ @@ -225,7 +223,12 @@ case TUPCLOSE: /* The real way do this will be with a gdk_string_width. Until * then, though: */ - theobj->minpixelsalloted = 40; + theobj->minpixelsalloted = +#if 0 + 40; +#else + 8; +#endif theobj->space_before = 0; break; case CLEF: diff -urN /home/rshann/denemo-cvs/denemo/src/view.c ./src/view.c --- /home/rshann/denemo-cvs/denemo/src/view.c 2007-08-19 16:00:12.000000000 +0100 +++ ./src/view.c 2007-08-19 15:40:27.000000000 +0100 @@ -14,6 +14,7 @@ #include "playback.h" #include "alsaplayback.h" #include "midiseq.h" +#include "pitchentry.h" #if GTK_MAJOR_VERSION > 1 #include @@ -22,9 +23,10 @@ #define INITIAL_WIDTH 1000 #define INITIAL_HEIGHT 500 -extern GList *displays; +extern GList *displays; /* list of DenemoGUI objects */ extern midi_seq *sq; /* global denemo sequencer FIXME: should not be global */ + /** * close the application and shut down the sequencer if open * @@ -57,8 +59,6 @@ if ((gui->si->haschanged) ? (confirmbox (gui)) : 1) { closeit (NULL, gui); - writeHistory (gui->prefs); - ext_quit (); } else { @@ -71,14 +71,14 @@ if ((gui->si->haschanged) ? (confirmbox (gui)) : 1) { close_view (NULL, gui); - writeHistory (gui->prefs); - ext_quit (); } else { g_printf ("Don't quit now!\n"); } } + writeHistory (gui->prefs); + ext_quit (); } /** @@ -170,6 +170,7 @@ void close_view (GtkWidget * widget, gpointer data) { + stop_pitch_recognition(); displays = g_list_remove (displays, data); gtk_widget_destroy (((DenemoGUI *) data)->window); g_free ((DenemoGUI *) data); @@ -319,16 +320,7 @@ insert_rest_4key (gui); displayhelper (gui); } -/** - * Rhythm callback toggle rhythm entry submode - * - */ -void -toggle_rhythmicsubmode(GtkCheckButton *button, DenemoGUI * gui) { - gui->si->rhythmicsubmode = !gui->si->rhythmicsubmode; - -} /** @@ -373,8 +365,9 @@ * */ gchar modifier_code(gpointer fn) { - return fn==(gpointer)insert_triplet ? '~': - (gpointer)add_dot_key ? '.': + return fn==(gpointer)start_triplet ? '~': + fn==(gpointer)end_tuplet ? '|': + fn==(gpointer)add_dot_key ? '.': fn==(gpointer)toggle_begin_slur ? '(': fn==(gpointer)toggle_end_slur ? ')': fn==(gpointer)insert_rest_0key ? 'r': @@ -402,18 +395,6 @@ last_data = NULL; } -#if 0 -#define GDK_Shift_L 0xFFE1 -#define GDK_Shift_R 0xFFE2 -#define GDK_Alt_L 0xFFE9 -#define GDK_Return 0xFF0D - if (event->key.keyval == GDK_Alt_L || - event->key.keyval == GDK_Shift_L || - event->key.keyval == GDK_Shift_R || - event->key.keyval == GDK_Return - ) - return FALSE; -#endif #define GDK_BackSpace 0xFF08 /* to save including gdkkeysyms.h */ if (event->key.keyval == GDK_BackSpace) { @@ -551,6 +532,8 @@ { GSList*g = gtk_action_get_proxies(action); + +#if 0 if(g && g->data) { static GtkWidget *label_widget; if(label_widget==NULL) { @@ -558,39 +541,31 @@ gtk_tool_button_set_label_widget(g->data, label_widget); gtk_widget_show(label_widget); } - - g_print("for %s\n", g_type_name(G_TYPE_FROM_INSTANCE(g->data))); - g_print("label is %s\n", gtk_tool_button_get_label( GTK_TOOL_BUTTON(g->data))); - - gchar *labelstr = g_strdup_printf("Create rhythm: %s", "here"); - g_print("label is %p\n",label_widget); if(label_widget){ - g_print("edit first rhythm %p is %s", label_widget, g_type_name(G_TYPE_FROM_INSTANCE(label_widget))); - gtk_label_set_markup (GTK_LABEL (label_widget),labelstr); + gtk_label_set_markup (GTK_LABEL (label_widget),"Create a rhythm"); } - g_free(labelstr); } - +#endif if(g && g->data) { /* make one rhythm */ RhythmPattern *r = (RhythmPattern*)g_malloc0(sizeof(RhythmPattern)); r->gui = gui; - GtkToolButton *button = gtk_tool_button_new(NULL, NULL); + GtkToolButton *button = (GtkToolButton *)gtk_tool_button_new(NULL, NULL); r->button = button; rhythm_edit(gui, r); if(r->rsteps==NULL) { - gtk_widget_destroy(button); + gtk_widget_destroy(GTK_WIDGET(button)); g_free(r); } else { GtkWidget *toolbar = gtk_widget_get_parent(g->data); - gtk_toolbar_insert(toolbar, button, -1); - gtk_widget_show(button); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(button), -1); + gtk_widget_show(GTK_WIDGET(button)); gui->si->rstep = r->rsteps; gui->si->rhythms = g_list_append(gui->si->rhythms , r); gui->si->currhythm = g_list_last(gui->si->rhythms); - gui->si->rhythmicsubmode = gui->si->rhythms; + //gui->si->rhythmicsubmode = (gboolean)gui->si->rhythms; g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (select_rhythm_pattern), (gpointer)r); } @@ -609,7 +584,7 @@ if(gui->si->currhythm==NULL) return; RhythmPattern *r =(RhythmPattern *)gui->si->currhythm->data; - gtk_widget_destroy(r->button); + gtk_widget_destroy(GTK_WIDGET(r->button)); /* list is circular, so before we free it we have to break it */ r->rsteps->prev->next = NULL; r->rsteps->prev = NULL; @@ -624,11 +599,15 @@ gui->si->currhythm = g_list_last(gui->si->rhythms); if(gui->si->currhythm == NULL) - gui->si->rhythmicsubmode = FALSE /**/; + gui->si->rstep = NULL;/* gui->si->rhythmicsubmode = FALSE */ else gui->si->rstep = ((RhythmPattern *)gui->si->currhythm->data)->rsteps; } + +static void dummy(void) { + return; +} /** * Menu entries with shortcut keys, tooltips, and callback functions */ @@ -795,7 +774,7 @@ G_CALLBACK (addbookmark)}, {"GotoBookMark", NULL, N_("Goto Bookmark"), NULL, NULL, G_CALLBACK (gotobookmark)}, - {"Stub", NULL, "", NULL, "", NULL}, + {"Stub", NULL, N_(" "), NULL, NULL, G_CALLBACK (dummy)}, {"OpenRecent", NULL, N_("Open Recent")}, /* Note entry */ {"InsertWholeNote", "denemo-whole-note", N_("Full note"), NULL, @@ -864,33 +843,79 @@ gtk_widget_show (widget); } } + + /** - * Function to toggle whether rhythm toolbar is visible + * Function to toggle entry of notes by pitch recognition off/on * */ static void +toggle_pitch_recognition (GtkAction * action, DenemoGUI * gui) { + if(pitch_recognition_system_active() + && (!gui->pitch_recognition)){ + /* can be out of step with checkbox because of + user destroying the window, or multiple guis */ + g_warning("out of step"); + stop_pitch_recognition(); + } + if(!gui->pitch_recognition) { + if(setup_pitch_recognition(gui)) + {/*FIXME error */ + g_warning("Error setting up pitch recognition"); + return; + } + } + /* then turn on/off */ + if(gui->pitch_recognition) { + stop_pitch_recognition(); + } else { + start_pitch_recognition(gui);// FIXME different guis + } + gui->pitch_recognition = !gui->pitch_recognition; + /* always turn rhythm mode on with pitch recognition, since otherwise the + cursor just bobs about uselessly, while the accidentals in the notes affect + the previous note */ + + GtkWidget *widget = gtk_ui_manager_get_widget (gui->ui_manager, "/MainMenu/EntryMenu/ToggleRhythmToolbar"); + GtkWidget *toolbar = gtk_ui_manager_get_widget (gui->ui_manager, "/RhythmToolBar"); + if (!GTK_WIDGET_VISIBLE (toolbar)) + g_signal_emit_by_name(widget, "activate", action, gui); + +} + + +/** + * Function to toggle whether rhythm toolbar is visible + * + */ +static void toggle_rhythm_toolbar (GtkAction * action, DenemoGUI * gui) { + static keymap *rhythm_keymap;// special keymap in rhythm submode GtkWidget *widget; widget = gtk_ui_manager_get_widget (gui->ui_manager, "/RhythmToolBar"); - if (GTK_WIDGET_VISIBLE (widget) && gui->prefs->rhythm_palette == TRUE) - { - gtk_widget_hide (widget); - } - else if (GTK_WIDGET_VISIBLE (widget) - && gui->prefs->rhythm_palette == FALSE) + if (GTK_WIDGET_VISIBLE (widget)) { + if(gui->prefs->standard_keymap) + gui->prefs->the_keymap = gui->prefs->standard_keymap; + gui->si->rhythmicsubmode = FALSE; gtk_widget_hide (widget); } else { + if(rhythm_keymap==NULL){ + + rhythm_keymap = create_keymap ("RhythmKeymaprc"); + //printf("CREATED keymap\n"); + } + gui->prefs->the_keymap = rhythm_keymap; gtk_widget_show (widget); - gui->si->rhythmicsubmode = gui->si->rhythms; /*FIXME provide a button to set this */ + gui->si->rhythmicsubmode = TRUE;/*(gboolean)gui->si->rhythms; FIXME provide a button to set this */ } } /** - * entries for View menu + * Toggle entries for the menus */ GtkToggleActionEntry toggle_menu_entries[] = { {"ToggleNotationToolbar", NULL, N_("_Notation Toolbar"), NULL, NULL, @@ -899,6 +924,9 @@ {"ToggleRhythmToolbar", NULL, N_("_Rhythmic Patterns"), NULL, NULL, G_CALLBACK (toggle_rhythm_toolbar), FALSE} , + {"TogglePitchRecognition", NULL, N_("_Pitch Recognition"), NULL, NULL, + G_CALLBACK (toggle_pitch_recognition), FALSE} + , {"ToggleArticulationPalette", NULL, N_("_Articulation Palette"), NULL, NULL, G_CALLBACK (toggle_articulation_palette), FALSE} @@ -952,7 +980,7 @@ * Top-Level function to populate the History menu * with elements read from the denemohistory file */ -void +static void populate_opened_recent (DenemoGUI * gui) { GtkWidget *item = @@ -1035,7 +1063,7 @@ gtk_window_add_accel_group (GTK_WINDOW (gui->window), accel_group); data_dir = g_build_filename ( -#ifdef USE_LOCAL_DENEMOUI +#ifndef USE_LOCAL_DENEMOUI get_data_dir (), #endif "denemoui.xml", NULL); @@ -1081,17 +1109,7 @@ gtk_box_pack_start (GTK_BOX (main_vbox), toolbar, FALSE, TRUE, 0); /* GTK_WIDGET_UNSET_FLAGS(toolbar, GTK_CAN_FOCUS); */ -#if 0 -/* could not get this to work */ - widget = gtk_check_button_new_with_label("Rhythm Entry"); - GtkToolItem *item = gtk_tool_item_new(); - gtk_container_add(item, widget); - gtk_toolbar_insert(toolbar, item, -1); - gtk_widget_show_all(item); - g_signal_connect(G_OBJECT (widget), "clicked", - G_CALLBACK (toggle_rhythmicsubmode), (gpointer)gui) ; - gtk_widget_show (toolbar); -#endif + score_and_scroll_hbox = gtk_hbox_new (FALSE, 1); gtk_box_pack_start (GTK_BOX (main_vbox), score_and_scroll_hbox, TRUE, TRUE, @@ -1168,11 +1186,13 @@ gcs_init (gui->window->window); if (gui->prefs->articulation_palette) toggle_articulation_palette (NULL, gui); + toggle_rhythm_toolbar (NULL, gui); +#if 0 if (!gui->prefs->rhythm_palette) toggle_rhythm_toolbar (NULL, gui); else - gui->si->rhythmicsubmode = gui->si->rhythms; - + gui->si->rhythmicsubmode = (gboolean)gui->si->rhythms; +#endif if (!gui->prefs->notation_palette) { g_print ("Notation palette %d\n", gui->prefs->notation_palette); @@ -1181,12 +1201,13 @@ /* Similarly, the keymap should be initialized after the only once si->window is shown, as it may pop up an advisory dialog. */ - gui->prefs->the_keymap = init_keymap (); + gui->prefs->standard_keymap = gui->prefs->the_keymap = init_keymap (); displays = g_list_append (displays, gui); g_print ("No of Displays %d\n", g_list_length (displays)); if (gui->prefs->autosave) g_timeout_add (gui->prefs->autosave_timeout * 1000 * 60, (GSourceFunc) auto_save_document_timeout, gui->si); - g_free (error); + + g_free (error); }