MIDI: Scale each instrument by a calibration value, since not all patches are at the same base volume.

This should make some files sound more natural, without some instruments overpowering others. 
Ultimately, these values need to be moved to the config file, and the table should probably be put in 
IRAM or something.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15161 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Stepan Moskovchenko 2007-10-17 05:06:57 +00:00
parent d33645ba13
commit c3584c0d63

View file

@ -25,13 +25,36 @@ extern struct plugin_api * rb;
long tempo=375000;
/* From the old patch config.... each patch is scaled.
* Should be moved into patchset.cfg
* But everyone would need a new config file.
*
* While this really does need to go into the patch config,
* I doubt anyone has made their own custom rockbox patchset
* (if you have, please send a copy my way :) )
*/
static const unsigned char patchScale[]=
{
125,115,115,100,100,80,115,100,100,100,100,80,100,100,100,100,
100,100,100,100,60,100,100,100,150,155,145,100,125,86,125,85,
161,160,133,160,135,133,100,128,150,100,100,150,100,130,100,200,
100,100,125,125,100,100,100,100,124,110,111,100,139,113,115,115,
125,115,95,140,100,100,105,100,90,100,80,80,100,125,100,80,
100,100,100,250,130,100,100,100,115,100,100,120,200,100,100,80,
130,100,100,150,100,100,100,100,100,100,200,100,100,100,100,100,
100,100,113,100,200,100,100,100,30,100,100,100,100,100,100,100
};
/* Sets the volume scaling by channel volume and note volume */
/* This way we can do the multiplication/indexing once per */
/* MIDI event at the most, instead of once per sample. */
static inline void setVolScale(int a)
{
struct SynthObject * so = &voices[a];
so->volscale = ((signed short int)so->vol*(signed short int)chVol[so->ch]);
int ch = so->ch;
so->volscale = so->vol * chVol[ch]*patchScale[chPat[ch]] / 100;
//((signed short int)so->vol*(signed short int)chVol[ch])*patchScale[chPat[ch]];
}
static inline void setVol(int ch, int vol)