Merge branch 'master' of https://github.com/tildearrow/furnace into es5506_alt
* 'master' of https://github.com/tildearrow/furnace: dev94 - add a full linear pitch mode, part 1 YM2610(B): use f-num/block baseFreq calculation GUI: remove insLoadAlwaysReplace setting GUI: right click menu for open instrument GUI: add a threshold for macro right click OPZ: remove debug printf GUI: add macro right click menu GUI: prepare for macro right click menu update gitignore add something prepare for something did i fix macOS build? GUI: macro edit improvements
This commit is contained in:
commit
54e78699a7
84 changed files with 6364 additions and 337 deletions
|
|
@ -987,6 +987,9 @@ int DivEngine::calcBaseFreq(double clock, double divider, int note, bool period)
|
|||
}*/
|
||||
|
||||
double DivEngine::calcBaseFreq(double clock, double divider, int note, bool period) {
|
||||
if (song.linearPitch==2) { // full linear
|
||||
return (note<<7);
|
||||
}
|
||||
double base=(period?(song.tuning*0.0625):song.tuning)*pow(2.0,(float)(note+3)/12.0);
|
||||
return period?
|
||||
(clock/base)/divider:
|
||||
|
|
@ -994,19 +997,27 @@ double DivEngine::calcBaseFreq(double clock, double divider, int note, bool peri
|
|||
}
|
||||
|
||||
unsigned short DivEngine::calcBaseFreqFNumBlock(double clock, double divider, int note, int bits) {
|
||||
if (song.linearPitch==2) { // full linear
|
||||
return (note<<7);
|
||||
}
|
||||
double tuning=song.tuning;
|
||||
if (tuning<400.0) tuning=400.0;
|
||||
if (tuning>500.0) tuning=500.0;
|
||||
int bf=calcBaseFreq(clock,divider,note,false);
|
||||
int boundaryBottom=tuning*pow(2.0,0.25)*(divider/clock);
|
||||
int boundaryTop=2.0*tuning*pow(2.0,0.25)*(divider/clock);
|
||||
int block=note/12;
|
||||
if (block<0) block=0;
|
||||
if (block>7) block=7;
|
||||
bf>>=block;
|
||||
if (bf<0) bf=0;
|
||||
// octave boundaries
|
||||
while (bf>0 && bf<644 && block>0) {
|
||||
while (bf>0 && bf<boundaryBottom && block>0) {
|
||||
bf<<=1;
|
||||
block--;
|
||||
}
|
||||
if (bf>1288) {
|
||||
while (block<7) {
|
||||
if (bf>boundaryTop) {
|
||||
while (block<7 && bf>boundaryTop) {
|
||||
bf>>=1;
|
||||
block++;
|
||||
}
|
||||
|
|
@ -1014,11 +1025,19 @@ unsigned short DivEngine::calcBaseFreqFNumBlock(double clock, double divider, in
|
|||
bf=(1<<bits)-1;
|
||||
}
|
||||
}
|
||||
//logV("f-num: %d block: %d",bf,block);
|
||||
return bf|(block<<bits);
|
||||
}
|
||||
|
||||
int DivEngine::calcFreq(int base, int pitch, bool period, int octave, int pitch2) {
|
||||
if (song.linearPitch) {
|
||||
int DivEngine::calcFreq(int base, int pitch, bool period, int octave, int pitch2, double clock, double divider) {
|
||||
if (song.linearPitch==2) {
|
||||
// do frequency calculation here
|
||||
double fbase=(period?(song.tuning*0.0625):song.tuning)*pow(2.0,(float)(base+pitch+384)/(128.0*12.0));
|
||||
return period?
|
||||
(clock/fbase)/divider:
|
||||
fbase*(divider/clock);
|
||||
}
|
||||
if (song.linearPitch==1) {
|
||||
// global pitch multiplier
|
||||
int whatTheFuck=(1024+(globalPitch<<6)-(globalPitch<0?globalPitch-6:0));
|
||||
if (whatTheFuck<1) whatTheFuck=1; // avoids division by zero but please kill me
|
||||
|
|
@ -1213,7 +1232,7 @@ void DivEngine::reset() {
|
|||
chan[i]=DivChannelState();
|
||||
if (i<chans) chan[i].volMax=(disCont[dispatchOfChan[i]].dispatch->dispatch(DivCommand(DIV_CMD_GET_VOLMAX,dispatchChanOfChan[i]))<<8)|0xff;
|
||||
chan[i].volume=chan[i].volMax;
|
||||
if (!song.linearPitch) chan[i].vibratoFine=4;
|
||||
if (song.linearPitch==0) chan[i].vibratoFine=4;
|
||||
}
|
||||
extValue=0;
|
||||
extValuePresent=0;
|
||||
|
|
@ -2662,6 +2681,8 @@ bool DivEngine::init() {
|
|||
// init config
|
||||
#ifdef _WIN32
|
||||
configPath=getWinConfigPath();
|
||||
#elif defined(ANDROID)
|
||||
configPath=SDL_GetPrefPath("tildearrow","furnace");
|
||||
#else
|
||||
struct stat st;
|
||||
char* home=getenv("HOME");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue