mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
MIDI: Fix ringing/beeks in music caused by improper parsing of some pitch bend events.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15252 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
6fac8fcc93
commit
47d8323deb
4 changed files with 47 additions and 6 deletions
|
@ -28,7 +28,8 @@ int chPW[16] IBSS_ATTR; /* Channel pitch wheel, MSB only */
|
||||||
int chPBDepth[16] IBSS_ATTR; /* Channel pitch bend depth */
|
int chPBDepth[16] IBSS_ATTR; /* Channel pitch bend depth */
|
||||||
int chPBNoteOffset[16] IBSS_ATTR; /* Pre-computed whole semitone offset */
|
int chPBNoteOffset[16] IBSS_ATTR; /* Pre-computed whole semitone offset */
|
||||||
int chPBFractBend[16] IBSS_ATTR; /* Fractional bend applied to delta */
|
int chPBFractBend[16] IBSS_ATTR; /* Fractional bend applied to delta */
|
||||||
|
unsigned char chLastCtrlMSB[16]; /* MIDI regs, used for Controller 6. */
|
||||||
|
unsigned char chLastCtrlLSB[16]; /* The non-registered ones are ignored */
|
||||||
|
|
||||||
struct GPatch * gusload(char *);
|
struct GPatch * gusload(char *);
|
||||||
struct GPatch * patchSet[128];
|
struct GPatch * patchSet[128];
|
||||||
|
|
|
@ -62,10 +62,19 @@
|
||||||
#define MIDI_PITCHW 224
|
#define MIDI_PITCHW 224
|
||||||
|
|
||||||
/* MIDI Controllers */
|
/* MIDI Controllers */
|
||||||
#define CTRL_PWDEPTH 6
|
#define CTRL_DATAENT_MSB 6
|
||||||
#define CTRL_VOLUME 7
|
#define CTRL_VOLUME 7
|
||||||
#define CTRL_BALANCE 8
|
#define CTRL_BALANCE 8
|
||||||
#define CTRL_PANNING 10
|
#define CTRL_PANNING 10
|
||||||
|
#define CTRL_NONREG_LSB 98
|
||||||
|
#define CTRL_NONREG_MSB 99
|
||||||
|
#define CTRL_REG_LSB 100
|
||||||
|
#define CTRL_REG_MSB 101
|
||||||
|
|
||||||
|
#define REG_PITCHBEND_MSB 0
|
||||||
|
#define REG_PITCHBEND_LSB 0
|
||||||
|
|
||||||
|
|
||||||
#define CHANNEL 1
|
#define CHANNEL 1
|
||||||
|
|
||||||
/* Most of these are deprecated.. rampdown is used, maybe one other one too */
|
/* 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 */
|
||||||
extern int chPBDepth[16]; /* Channel pitch bend depth (Controller 6 */
|
extern int chPBDepth[16]; /* Channel pitch bend depth (Controller 6 */
|
||||||
extern int chPBNoteOffset[16] IBSS_ATTR; /* Pre-computed whole semitone offset */
|
extern int chPBNoteOffset[16] IBSS_ATTR; /* Pre-computed whole semitone offset */
|
||||||
extern int chPBFractBend[16] IBSS_ATTR; /* Fractional bend applied to delta */
|
extern int chPBFractBend[16] IBSS_ATTR; /* Fractional bend applied to delta */
|
||||||
|
extern unsigned char chLastCtrlMSB[16]; /* MIDI regs, used for Controller 6. */
|
||||||
|
extern unsigned char chLastCtrlLSB[16]; /* The non-registered ones are ignored */
|
||||||
|
|
||||||
extern struct GPatch * gusload(char *);
|
extern struct GPatch * gusload(char *);
|
||||||
extern struct GPatch * patchSet[128];
|
extern struct GPatch * patchSet[128];
|
||||||
|
|
|
@ -299,10 +299,39 @@ static void sendEvent(struct Event * ev)
|
||||||
chPan[status_low]=d2;
|
chPan[status_low]=d2;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case CTRL_PWDEPTH:
|
case CTRL_DATAENT_MSB:
|
||||||
{
|
{
|
||||||
/* TODO: Update all deltas. Is this really needed? */
|
/* TODO: Update all deltas. Is this really needed? */
|
||||||
chPBDepth[status_low] = d2;
|
if(chLastCtrlMSB[status_low] == REG_PITCHBEND_MSB &&
|
||||||
|
chLastCtrlLSB[status_low] == REG_PITCHBEND_LSB)
|
||||||
|
{
|
||||||
|
// printf("Pitch bend depth set to %d\n", d2);
|
||||||
|
chPBDepth[status_low] = d2;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case CTRL_NONREG_LSB:
|
||||||
|
{
|
||||||
|
chLastCtrlLSB[status_low] = 0xFF; /* Ignore nonregistered writes */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case CTRL_NONREG_MSB:
|
||||||
|
{
|
||||||
|
chLastCtrlMSB[status_low] = 0xFF; /* Ignore nonregistered writes */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case CTRL_REG_LSB:
|
||||||
|
{
|
||||||
|
chLastCtrlLSB[status_low] = d2;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case CTRL_REG_MSB:
|
||||||
|
{
|
||||||
|
chLastCtrlMSB[status_low] = d2;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,8 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
|
||||||
chPBDepth[a]=2; /* Default bend value is 2 */
|
chPBDepth[a]=2; /* Default bend value is 2 */
|
||||||
chPBNoteOffset[a]=0; /* No offset */
|
chPBNoteOffset[a]=0; /* No offset */
|
||||||
chPBFractBend[a]=65536; /* Center.. no bend */
|
chPBFractBend[a]=65536; /* Center.. no bend */
|
||||||
|
chLastCtrlMSB[a]=0; /* Set to pitch bend depth */
|
||||||
|
chLastCtrlLSB[a]=0; /* Set to pitch bend depth */
|
||||||
}
|
}
|
||||||
for(a=0; a<128; a++)
|
for(a=0; a<128; a++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue