summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/midi/midiutil.c3
-rw-r--r--apps/plugins/midi/midiutil.h15
-rw-r--r--apps/plugins/midi/sequencer.c33
-rw-r--r--apps/plugins/midi/synth.c2
4 files changed, 47 insertions, 6 deletions
diff --git a/apps/plugins/midi/midiutil.c b/apps/plugins/midi/midiutil.c
index 92ab8db8d6..65ba9c8989 100644
--- a/apps/plugins/midi/midiutil.c
+++ b/apps/plugins/midi/midiutil.c
@@ -28,7 +28,8 @@ int chPW[16] IBSS_ATTR; /* Channel pitch wheel, MSB only */
28int chPBDepth[16] IBSS_ATTR; /* Channel pitch bend depth */ 28int chPBDepth[16] IBSS_ATTR; /* Channel pitch bend depth */
29int chPBNoteOffset[16] IBSS_ATTR; /* Pre-computed whole semitone offset */ 29int chPBNoteOffset[16] IBSS_ATTR; /* Pre-computed whole semitone offset */
30int chPBFractBend[16] IBSS_ATTR; /* Fractional bend applied to delta */ 30int chPBFractBend[16] IBSS_ATTR; /* Fractional bend applied to delta */
31 31unsigned char chLastCtrlMSB[16]; /* MIDI regs, used for Controller 6. */
32unsigned char chLastCtrlLSB[16]; /* The non-registered ones are ignored */
32 33
33struct GPatch * gusload(char *); 34struct GPatch * gusload(char *);
34struct GPatch * patchSet[128]; 35struct GPatch * patchSet[128];
diff --git a/apps/plugins/midi/midiutil.h b/apps/plugins/midi/midiutil.h
index cb89e004aa..dfffe39dd6 100644
--- a/apps/plugins/midi/midiutil.h
+++ b/apps/plugins/midi/midiutil.h
@@ -62,10 +62,19 @@
62#define MIDI_PITCHW 224 62#define MIDI_PITCHW 224
63 63
64/* MIDI Controllers */ 64/* MIDI Controllers */
65#define CTRL_PWDEPTH 6 65#define CTRL_DATAENT_MSB 6
66#define CTRL_VOLUME 7 66#define CTRL_VOLUME 7
67#define CTRL_BALANCE 8 67#define CTRL_BALANCE 8
68#define CTRL_PANNING 10 68#define CTRL_PANNING 10
69#define CTRL_NONREG_LSB 98
70#define CTRL_NONREG_MSB 99
71#define CTRL_REG_LSB 100
72#define CTRL_REG_MSB 101
73
74#define REG_PITCHBEND_MSB 0
75#define REG_PITCHBEND_LSB 0
76
77
69#define CHANNEL 1 78#define CHANNEL 1
70 79
71/* Most of these are deprecated.. rampdown is used, maybe one other one too */ 80/* Most of these are deprecated.. rampdown is used, maybe one other one too */
@@ -145,8 +154,8 @@ extern int chPW[16]; /* Channel pitch wheel, MSB only */
145extern int chPBDepth[16]; /* Channel pitch bend depth (Controller 6 */ 154extern int chPBDepth[16]; /* Channel pitch bend depth (Controller 6 */
146extern int chPBNoteOffset[16] IBSS_ATTR; /* Pre-computed whole semitone offset */ 155extern int chPBNoteOffset[16] IBSS_ATTR; /* Pre-computed whole semitone offset */
147extern int chPBFractBend[16] IBSS_ATTR; /* Fractional bend applied to delta */ 156extern int chPBFractBend[16] IBSS_ATTR; /* Fractional bend applied to delta */
148 157extern unsigned char chLastCtrlMSB[16]; /* MIDI regs, used for Controller 6. */
149 158extern unsigned char chLastCtrlLSB[16]; /* The non-registered ones are ignored */
150 159
151extern struct GPatch * gusload(char *); 160extern struct GPatch * gusload(char *);
152extern struct GPatch * patchSet[128]; 161extern struct GPatch * patchSet[128];
diff --git a/apps/plugins/midi/sequencer.c b/apps/plugins/midi/sequencer.c
index 536d411902..c4ddfcf95a 100644
--- a/apps/plugins/midi/sequencer.c
+++ b/apps/plugins/midi/sequencer.c
@@ -299,10 +299,39 @@ static void sendEvent(struct Event * ev)
299 chPan[status_low]=d2; 299 chPan[status_low]=d2;
300 return; 300 return;
301 } 301 }
302 case CTRL_PWDEPTH: 302 case CTRL_DATAENT_MSB:
303 { 303 {
304 /* TODO: Update all deltas. Is this really needed? */ 304 /* TODO: Update all deltas. Is this really needed? */
305 chPBDepth[status_low] = d2; 305 if(chLastCtrlMSB[status_low] == REG_PITCHBEND_MSB &&
306 chLastCtrlLSB[status_low] == REG_PITCHBEND_LSB)
307 {
308// printf("Pitch bend depth set to %d\n", d2);
309 chPBDepth[status_low] = d2;
310 }
311 return;
312 }
313
314 case CTRL_NONREG_LSB:
315 {
316 chLastCtrlLSB[status_low] = 0xFF; /* Ignore nonregistered writes */
317 return;
318 }
319
320 case CTRL_NONREG_MSB:
321 {
322 chLastCtrlMSB[status_low] = 0xFF; /* Ignore nonregistered writes */
323 return;
324 }
325
326 case CTRL_REG_LSB:
327 {
328 chLastCtrlLSB[status_low] = d2;
329 return;
330 }
331
332 case CTRL_REG_MSB:
333 {
334 chLastCtrlMSB[status_low] = d2;
306 return; 335 return;
307 } 336 }
308 337
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c
index 7ae7a78583..3c60d9bd82 100644
--- a/apps/plugins/midi/synth.c
+++ b/apps/plugins/midi/synth.c
@@ -68,6 +68,8 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
68 chPBDepth[a]=2; /* Default bend value is 2 */ 68 chPBDepth[a]=2; /* Default bend value is 2 */
69 chPBNoteOffset[a]=0; /* No offset */ 69 chPBNoteOffset[a]=0; /* No offset */
70 chPBFractBend[a]=65536; /* Center.. no bend */ 70 chPBFractBend[a]=65536; /* Center.. no bend */
71 chLastCtrlMSB[a]=0; /* Set to pitch bend depth */
72 chLastCtrlLSB[a]=0; /* Set to pitch bend depth */
71 } 73 }
72 for(a=0; a<128; a++) 74 for(a=0; a<128; a++)
73 { 75 {