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
+
+
+
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 @@
+
+
+
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 @@
-
-