OSDN Git Service

Interlock interfaces with -K and -T command options
authorShoichi Tamuki <tamuki@linet.gr.jp>
Wed, 30 Jun 2004 14:33:01 +0000 (14:33 +0000)
committerShoichi Tamuki <tamuki@linet.gr.jp>
Wed, 30 Jun 2004 14:33:01 +0000 (14:33 +0000)
Hack up force keysig calculation
Change the base of measure (bar) as 1 (was 0)

ChangeLog
interface/alsaseq_c.c
interface/rtsyn_common.c
timidity/playmidi.c
timidity/readmidi.c

index 5e1e68c..21f8c9b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,11 @@
 2004-06-30  TAMUKI Shoichi <tamuki@linet.gr.jp>
 
        * interface/alsaseq_c.c, interface/rtsyn_common.c,
-         timidity/playmidi.[ch], timidity/timidity.[ch]:
+         timidity/playmidi.[ch], timidity/readmidi.c,
+         timidity/timidity.[ch]:
          Interlock interfaces with -K and -T command options
+         Hack up force keysig calculation
+         Change the base of measure (bar) as 1 (was 0)
 
 2004-06-14  TAMUKI Shoichi <tamuki@linet.gr.jp>
 
index 0133b9e..b1b4262 100644 (file)
@@ -383,13 +383,10 @@ static void ctl_pass_playing_list(int n, char *args[])
        signal(SIGHUP, sig_reset);
 
        if (opt_force_keysig != 8) {
-               i = current_keysig + ((current_keysig < 8) ? 7 : -6);
-               j = opt_force_keysig + ((current_keysig < 8) ? 7 : 10);
-               while (i != j && i != j + 12) {
-                       if (++note_key_offset > 6)
-                               note_key_offset -= 12;
-                       i += (i > 10) ? -5 : 7;
-               }
+               i = current_keysig - ((current_keysig < 8) ? 0 : 16), j = 0;
+               while (i != opt_force_keysig)
+                       i += (i > 0) ? -5 : 7, j++;
+               note_key_offset = (j != 0 && opt_force_keysig < 0) ? j - 12 : j;
        }
        i = current_keysig + ((current_keysig < 8) ? 7 : -9), j = 0;
        while (i != 7)
index 5c0eda6..6f576de 100644 (file)
@@ -275,13 +275,10 @@ void rtsyn_init(void){
                time_advance >>= 1;
 
        if (opt_force_keysig != 8) {
-               i = current_keysig + ((current_keysig < 8) ? 7 : -6);
-               j = opt_force_keysig + ((current_keysig < 8) ? 7 : 10);
-               while (i != j && i != j + 12) {
-                       if (++note_key_offset > 6)
-                               note_key_offset -= 12;
-                       i += (i > 10) ? -5 : 7;
-               }
+               i = current_keysig - ((current_keysig < 8) ? 0 : 16), j = 0;
+               while (i != opt_force_keysig)
+                       i += (i > 0) ? -5 : 7, j++;
+               note_key_offset = (j != 0 && opt_force_keysig < 0) ? j - 12 : j;
        }
        i = current_keysig + ((current_keysig < 8) ? 7 : -9), j = 0;
        while (i != 7)
index b350278..731e44f 100644 (file)
@@ -7916,16 +7916,10 @@ int play_event(MidiEvent *ev)
                current_keysig = current_event->a + current_event->b * 16;
                ctl_mode_event(CTLE_KEYSIG, 1, current_keysig, 0);
                if (opt_force_keysig != 8) {
-                       i = current_keysig + ((current_keysig < 8) ? 7 : -6);
-                       note_key_offset -= floor(note_key_offset / 12.0) * 12;
-                       for (j = 0; j < note_key_offset; j++)
-                               i += (i > 10) ? -5 : 7;
-                       j = opt_force_keysig + ((current_keysig < 8) ? 7 : 10);
-                       while (i != j && i != j + 12) {
-                               if (++note_key_offset > 6)
-                                       note_key_offset -= 12;
-                               i += (i > 10) ? -5 : 7;
-                       }
+                       i = current_keysig - ((current_keysig < 8) ? 0 : 16), j = 0;
+                       while (i != opt_force_keysig)
+                               i += (i > 0) ? -5 : 7, j++;
+                       note_key_offset = (j != 0 && opt_force_keysig < 0) ? j - 12 : j;
                        kill_all_voices();
                        ctl_mode_event(CTLE_KEY_OFFSET, 1, note_key_offset, 0);
                }
@@ -7956,7 +7950,7 @@ int play_event(MidiEvent *ev)
                ctl_mode_event(CTLE_TEMPER_KEYSIG, 1, current_event->a, 0);
                i = current_temper_keysig + ((current_temper_keysig < 8) ? 7 : -9);
                j = 0;
-               while (i != 7 && i != 19)
+               while (i != 7)
                        i += (i < 7) ? 5 : -7, j++;
                j += note_key_offset, j -= floor(j / 12.0) * 12;
                current_temper_freq_table = j;
@@ -8488,13 +8482,10 @@ int play_midi_file(char *fn)
        ctl_mode_event(CTLE_KEYSIG, 0, current_keysig, 0);
        ctl_mode_event(CTLE_TEMPER_KEYSIG, 0, 0, 0);
        if (opt_force_keysig != 8) {
-               i = current_keysig + ((current_keysig < 8) ? 7 : -6);
-               j = opt_force_keysig + ((current_keysig < 8) ? 7 : 10);
-               while (i != j && i != j + 12) {
-                       if (++note_key_offset > 6)
-                               note_key_offset -= 12;
-                       i += (i > 10) ? -5 : 7;
-               }
+               i = current_keysig - ((current_keysig < 8) ? 0 : 16), j = 0;
+               while (i != opt_force_keysig)
+                       i += (i > 0) ? -5 : 7, j++;
+               note_key_offset = (j != 0 && opt_force_keysig < 0) ? j - 12 : j;
        }
        ctl_mode_event(CTLE_KEY_OFFSET, 0, note_key_offset, 0);
        i = current_keysig + ((current_keysig < 8) ? 7 : -9), j = 0;
index be267e0..f4db81b 100644 (file)
@@ -5202,8 +5202,8 @@ static void insert_note_steps(void)
                                meas++, beat = 0;
                        num = timesig[n].a, denom = timesig[n].b, n++;
                }
-               a = meas & 0xff;
-               b = ((meas >> 8) & 0x0f) + ((beat + 1) << 4);
+               a = (meas + 1) & 0xff;
+               b = (((meas + 1) >> 8) & 0x0f) + ((beat + 1) << 4);
                MIDIEVENT(at, ME_NOTE_STEP, 0, a, b);
                if (++beat == num)
                        meas++, beat = 0;