Skip to content

Commit

Permalink
prepare for pre-calculated pitch table
Browse files Browse the repository at this point in the history
  • Loading branch information
tildearrow committed Oct 11, 2023
1 parent f1145a1 commit 4346865
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/asm/spc700/player.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
; command stream player code for SPC700 architecture.

csTick:
ret

csInit:
ret
1 change: 1 addition & 0 deletions src/asm/spc700/snes.s
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; SNES DivDispatch code.
29 changes: 29 additions & 0 deletions src/engine/dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,29 @@ struct DivCommand {
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 {
int ticks;
DivCommand cmd;
Expand Down Expand Up @@ -692,6 +715,11 @@ class DivDispatch {
*/
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.
* @param parent the parent DivEngine.
Expand All @@ -718,6 +746,7 @@ class DivDispatch {
if (chipClock<getClockRangeMin()) chipClock=getClockRangeMin(); \
}

// NOTE: these definitions may be deprecated in the future. see DivPitchTable.
// pitch calculation:
// - a DivDispatch usually contains four variables per channel:
// - baseFreq: this changes on new notes, legato, arpeggio and slides.
Expand Down
3 changes: 3 additions & 0 deletions src/engine/platform/abstract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ void DivDispatch::renderSamples(int sysID) {

}

void DivDispatch::notifyPitchTable() {
}

int DivDispatch::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3364,7 +3364,7 @@ void FurnaceGUI::drawSettings() {
// ok, so you decided to read the code.
// these are the cheat codes:
// "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
// "4-bit FDS" - enables partial pitch linearity option
// "Power of the Chip" - enables options for multi-threaded audio
Expand Down

0 comments on commit 4346865

Please sign in to comment.