+2003-07-14 TAMUKI Shoichi <tamuki@linet.gr.jp>
+
+ * interface/alsaseq_c.c,
+ interface/rtsyn_common.c, interface/rtsyn_winmm.c,
+ timidity/playmidi.[ch], timidity/rcp.c, timidity/readmidi.c:
+ Support for bulk tuning dump
+
2003-07-10 TAMUKI Shoichi <tamuki@linet.gr.jp>
* timidity/playmidi.c: Fix around single-note tuning change
static int do_sequencer(struct seq_context *ctxp)
{
int n, ne, i;
- MidiEvent ev, evm[16];
+ MidiEvent ev, evm[260];
snd_seq_event_t *aevp;
n = snd_seq_event_input(ctxp->handle, &aevp);
-
/*
TiMidity++ -- MIDI to WAVE converter and player
Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
void rtsyn_play_one_sysex (char *sysexbuffer, int exlen ){
int i,j,chk,ne;
MidiEvent ev;
- MidiEvent evm[16];
+ MidiEvent evm[260];
if(sysexbuffer[exlen-1] == '\xf7'){ // I don't konw why this need
for(i=0;i<EX_RESET_NO;i++){
-
/*
TiMidity++ -- MIDI to WAVE converter and player
Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
DWORD dwParam1;
DWORD dwParam2;
MidiEvent ev;
- MidiEvent evm[16];
+ MidiEvent evm[260];
int port;
UINT evbpoint;
MIDIHDR *IIMidiHdr;
static void ctl_pause_event(int pause, int32 samples);
static void update_legato_controls(int ch);
static void update_channel_freq(int ch);
-static void set_single_note_tuning(int, int, int);
+static void set_single_note_tuning(int, int, int, int);
#define IS_SYSEX_EVENT_TYPE(type) ((type) == ME_NONE || (type) >= ME_RANDOM_PAN)
EVENT_NAME(ME_TIMESIG);
EVENT_NAME(ME_KEYSIG);
EVENT_NAME(ME_SCALE_TUNING);
+ EVENT_NAME(ME_BULK_TUNING_DUMP);
EVENT_NAME(ME_SINGLE_NOTE_TUNING);
EVENT_NAME(ME_TEMPER_KEYSIG);
EVENT_NAME(ME_TEMPER_TYPE);
channel[ch].scale_tuning[current_event->a] = current_event->b;
break;
+ case ME_BULK_TUNING_DUMP:
+ set_single_note_tuning(ch, current_event->a, current_event->b, 0);
+ break;
+
case ME_SINGLE_NOTE_TUNING:
- set_single_note_tuning(ch, current_event->a, current_event->b);
+ set_single_note_tuning(ch, current_event->a, current_event->b, 0);
break;
case ME_TEMPER_KEYSIG:
adjust_pitch(ch);
break;
+ case ME_BULK_TUNING_DUMP:
+ set_single_note_tuning(ch, current_event->a, current_event->b, 0);
+ break;
+
case ME_SINGLE_NOTE_TUNING:
- set_single_note_tuning(ch, current_event->a, current_event->b);
- for (i = 0; i < upper_voices; i++)
- if (voice[i].status != VOICE_FREE) {
- voice[i].temper_instant = 1;
- recompute_freq(i);
- }
+ set_single_note_tuning(ch, current_event->a, current_event->b, 1);
break;
case ME_TEMPER_KEYSIG:
return RC_NONE;
}
-static void set_single_note_tuning(int part, int a, int b)
+static void set_single_note_tuning(int part, int a, int b, int rt)
{
static int tp; /* tuning program number */
static int kn; /* MIDI key number */
static int st; /* the nearest equal-tempered semitone */
double f, fst; /* fraction of semitone */
+ int i;
switch (part) {
case 0:
f = 440 * pow(2.0, (st - 69) / 12.0);
fst = pow(2.0, (a << 7 | b) / 196608.0);
freq_table_tuning[tp][kn] = f * fst * 1000 + 0.5;
+ if (rt)
+ for (i = 0; i < upper_voices; i++)
+ if (voice[i].status != VOICE_FREE) {
+ voice[i].temper_instant = 1;
+ recompute_freq(i);
+ }
break;
}
}
ME_TIMESIG, /* Time signature */
ME_KEYSIG, /* Key signature */
ME_SCALE_TUNING, /* Scale tuning */
+ ME_BULK_TUNING_DUMP, /* Bulk tuning dump */
ME_SINGLE_NOTE_TUNING, /* Single-note tuning */
ME_TEMPER_KEYSIG, /* Temperament key signature */
ME_TEMPER_TYPE, /* Temperament type */
static int rcp_parse_sysex_event(int32 at, uint8 *val, int32 len)
{
- MidiEvent ev, evm[16];
+ MidiEvent ev, evm[260];
int ne, i;
if(len == 0) {return 0;}
break;
case 0x08: /* MIDI Tuning Standard */
switch (val[3]) {
+ case 0x01:
+ SETMIDIEVENT(evm[0], 0, ME_BULK_TUNING_DUMP,
+ 0, val[4], 0);
+ for (i = 0; i < 128; i++) {
+ SETMIDIEVENT(evm[i * 2 + 1], 0, ME_BULK_TUNING_DUMP,
+ 1, i, val[i * 3 + 21]);
+ SETMIDIEVENT(evm[i * 2 + 2], 0, ME_BULK_TUNING_DUMP,
+ 2, val[i * 3 + 22], val[i * 3 + 23]);
+ }
+ num_events += 257;
+ break;
case 0x02:
SETMIDIEVENT(evm[0], 0, ME_SINGLE_NOTE_TUNING,
0, val[4], 0);
SETMIDIEVENT(evm[i * 2 + 2], 0, ME_SINGLE_NOTE_TUNING,
2, val[8], val[9]);
}
- num_events = val[5] * 2 + 1;
+ num_events += val[5] * 2 + 1;
break;
case 0x0b:
channel_tt = val[4] << 14 | val[5] << 7 | val[6];
struct timidity_file *tf)
{
uint8 *val;
- MidiEvent ev, evm[63]; /* maximum number of XG bulk dump events */
+ MidiEvent ev, evm[260]; /* maximum number of XG bulk dump events */
int ne, i;
if(len == 0)