prepare for pre-calculated pitch table

This commit is contained in:
tildearrow 2023-10-10 20:15:58 -05:00
parent f1145a14ad
commit 43468653a0
5 changed files with 41 additions and 1 deletions

7
src/asm/spc700/player.s Normal file
View file

@ -0,0 +1,7 @@
; command stream player code for SPC700 architecture.
csTick:
ret
csInit:
ret

1
src/asm/spc700/snes.s Normal file
View file

@ -0,0 +1 @@
; SNES DivDispatch code.

View file

@ -267,6 +267,29 @@ struct DivCommand {
value2(0) {} value2(0) {}
}; };
struct DivPitchTable {
int pitch[(12*128)+1];
unsigned char linearity, blockBits;
bool period;
// get pitch
int get(int base, int pitch, int pitch2);
// linear: note
// non-linear: get(note,0,0)
int getBase(int note);
// calculate pitch table
void init(float tuning, double clock, double divider, int octave, unsigned char linear, bool isPeriod, unsigned char block=0);
DivPitchTable():
linearity(2),
blockBits(0),
period(false) {
memset(pitch,0,sizeof(pitch));
}
};
struct DivDelayedCommand { struct DivDelayedCommand {
int ticks; int ticks;
DivCommand cmd; DivCommand cmd;
@ -692,6 +715,11 @@ class DivDispatch {
*/ */
virtual void renderSamples(int sysID); virtual void renderSamples(int sysID);
/**
* tell this DivDispatch that the tuning and/or pitch linearity has changed, and therefore the pitch table must be regenerated.
*/
virtual void notifyPitchTable();
/** /**
* initialize this DivDispatch. * initialize this DivDispatch.
* @param parent the parent DivEngine. * @param parent the parent DivEngine.
@ -718,6 +746,7 @@ class DivDispatch {
if (chipClock<getClockRangeMin()) chipClock=getClockRangeMin(); \ if (chipClock<getClockRangeMin()) chipClock=getClockRangeMin(); \
} }
// NOTE: these definitions may be deprecated in the future. see DivPitchTable.
// pitch calculation: // pitch calculation:
// - a DivDispatch usually contains four variables per channel: // - a DivDispatch usually contains four variables per channel:
// - baseFreq: this changes on new notes, legato, arpeggio and slides. // - baseFreq: this changes on new notes, legato, arpeggio and slides.

View file

@ -199,6 +199,9 @@ void DivDispatch::renderSamples(int sysID) {
} }
void DivDispatch::notifyPitchTable() {
}
int DivDispatch::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { int DivDispatch::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
return 0; return 0;
} }

View file

@ -3364,7 +3364,7 @@ void FurnaceGUI::drawSettings() {
// ok, so you decided to read the code. // ok, so you decided to read the code.
// these are the cheat codes: // these are the cheat codes:
// "Debug" - toggles mobile UI // "Debug" - toggles mobile UI
// "Nice Amiga cover of the song!" - enables hidden systems (YMU759/SoundUnit/Dummy) // "Nice Amiga cover of the song!" - enables hidden systems (YMU759/Dummy)
// "42 63" - enables all instrument types // "42 63" - enables all instrument types
// "4-bit FDS" - enables partial pitch linearity option // "4-bit FDS" - enables partial pitch linearity option
// "Power of the Chip" - enables options for multi-threaded audio // "Power of the Chip" - enables options for multi-threaded audio