1
0
Fork 0
forked from len0rd/rockbox

midi: Recalculate (and rename) the note frequency table.

gustable[] contained plain note frequencies in milliHertz, but
was named and documented to appear like a table of magic numbers.
The values also seemed to be slightly inaccurate (up to about
0.01Hz, so probably irrelevant).

This changes the name to freqtable to make the purpose clearer, and
uses slightly better values.

Change-Id: I6b568d834c8c2c92161bed5290572a29733e28dc
This commit is contained in:
Frank Gevaerts 2013-06-16 19:11:03 +02:00 committed by Gerrit Rockbox
parent bc4c13ee8a
commit afd482f51b
3 changed files with 28 additions and 19 deletions

View file

@ -148,12 +148,12 @@ static void findDelta(struct SynthObject * so, int ch, int note)
/*
Old formula:
delta = (((gustable[note+chPBNoteOffset[ch]]<<FRACTSIZE) / (wf->rootFreq)) * wf->sampRate / (SAMPLE_RATE));
delta = (((freqtable[note+chPBNoteOffset[ch]]<<FRACTSIZE) / (wf->rootFreq)) * wf->sampRate / (SAMPLE_RATE));
Plus some pitch stuff. See old SVN for how it used to be
*/
delta = (((gustable[note+chPBNoteOffset[ch]]))); /* anywhere from 8000 to 8000000 */
delta = (((freqtable[note+chPBNoteOffset[ch]]))); /* anywhere from 8000 to 8000000 */
delta = delta * wf->sampRate; /* approx 20000 - 44000 but can vary with tuning */
delta = (delta * chPBFractBend[ch]); /* approx 60000 - 70000 */
delta = delta / (SAMPLE_RATE); /* 44100 or 22050 */
@ -263,7 +263,7 @@ static inline void pressNote(int ch, int note, int vol)
struct GWaveform * wf = drumSet[note]->waveforms[0];
voices[a].wf = wf;
voices[a].delta = (((gustable[note]<<FRACTSIZE) / wf->rootFreq) * wf->sampRate / SAMPLE_RATE);
voices[a].delta = (((freqtable[note]<<FRACTSIZE) / wf->rootFreq) * wf->sampRate / SAMPLE_RATE);
if (wf->mode & 28)
// midi_debug("\nWoah, a drum patch has a loop. Stripping the loop...");
wf->mode = wf->mode & (255-28);