summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorStepan Moskovchenko <stevenm@rockbox.org>2007-10-17 05:06:57 +0000
committerStepan Moskovchenko <stevenm@rockbox.org>2007-10-17 05:06:57 +0000
commitc3584c0d636c8c9abbfd5ee6980c21e935bea512 (patch)
tree83887ec05fd61a4a56f64944faf4993d9d80e538 /apps/plugins
parentd33645ba137fc6566a953190dcf74c3841bc4d5d (diff)
downloadrockbox-c3584c0d636c8c9abbfd5ee6980c21e935bea512.zip
rockbox-c3584c0d636c8c9abbfd5ee6980c21e935bea512.tar.gz
rockbox-c3584c0d636c8c9abbfd5ee6980c21e935bea512.tar.bz2
rockbox-c3584c0d636c8c9abbfd5ee6980c21e935bea512.tar.xz
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
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/midi/sequencer.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/apps/plugins/midi/sequencer.c b/apps/plugins/midi/sequencer.c
index 4c9520f..e20047a 100644
--- a/apps/plugins/midi/sequencer.c
+++ b/apps/plugins/midi/sequencer.c
@@ -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)