Checkpoint

Addressing reviews, Fix GCC/Clang builds, Core updates
This commit is contained in:
cam900 2022-04-27 14:29:53 +09:00
parent 7fbd239b85
commit 482dbf8dd5
15 changed files with 49 additions and 46 deletions

View File

@ -1476,7 +1476,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
sample->loopMode=DIV_SAMPLE_LOOPMODE_ONESHOT;
sample->loopStart=0;
} else {
sample->loopMode=DIV_SAMPLE_LOOPMODE_FOWARD;
sample->loopMode=DIV_SAMPLE_LOOPMODE_FORWARD;
}
} else {
reader.readI();
@ -1714,7 +1714,7 @@ bool DivEngine::loadMod(unsigned char* file, size_t len) {
sample->loopMode=DIV_SAMPLE_LOOPMODE_ONESHOT;
sample->loopStart=0;
} else {
sample->loopMode=DIV_SAMPLE_LOOPMODE_FOWARD;
sample->loopMode=DIV_SAMPLE_LOOPMODE_FORWARD;
}
}
sample->init(slen);

View File

@ -168,7 +168,7 @@ void DivPlatformES5506::acquire(short* bufL, short* bufR, size_t start, size_t l
}
}
void DivPlatformES5506::e(bool state)
void DivPlatformES5506::e_pin(bool state)
{
if (es5506.e_rising_edge()) {
if (cycle) { // wait until delay
@ -292,6 +292,7 @@ void DivPlatformES5506::tick(bool sysTick) {
chan[i].k1Offs=chan[i].std.ex1.val;
chan[i].filterChanged.k1=1;
}
break;
case 1: // absolute
if (chan[i].filter.k1!=(chan[i].std.ex1.val&0xffff)) {
chan[i].filter.k1=chan[i].std.ex1.val&0xffff;
@ -317,6 +318,7 @@ void DivPlatformES5506::tick(bool sysTick) {
chan[i].k2Offs=chan[i].std.ex1.val;
chan[i].filterChanged.k2=1;
}
break;
case 1: // absolute
if (chan[i].filter.k2!=(chan[i].std.ex2.val&0xffff)) {
chan[i].filter.k2=chan[i].std.ex2.val&0xffff;
@ -472,7 +474,7 @@ void DivPlatformES5506::tick(bool sysTick) {
case DIV_SAMPLE_LOOPMODE_ONESHOT: // One shot (no loop)
default:
break;
case DIV_SAMPLE_LOOPMODE_FOWARD: // Foward loop
case DIV_SAMPLE_LOOPMODE_FORWARD: // Foward loop
loopFlag|=0x0008;
break;
case DIV_SAMPLE_LOOPMODE_BACKWARD: // Backward loop: IRQ enable
@ -728,8 +730,8 @@ void DivPlatformES5506::forceIns() {
chan[i].insChanged=true;
chan[i].freqChanged=true;
chan[i].volChanged=true;
chan[i].filterChanged.changed=(unsigned char)(~0);
chan[i].envChanged.changed=(unsigned char)(~0);
chan[i].filterChanged.changed=0xff;
chan[i].envChanged.changed=0xff;
chan[i].sample=-1;
}
}

View File

@ -165,7 +165,7 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf {
friend void putDispatchChan(void*,int,int);
public:
virtual void e(bool state) override; // E output
virtual void e_pin(bool state) override; // E output
virtual void irqb(bool state) override; // IRQB output
virtual s16 read_sample(u8 voice, u8 bank, u32 address) override {

View File

@ -32,7 +32,7 @@ void es5504_core::tick()
{
if (m_e.tick())
{
m_intf.e(m_e.current_edge());
m_intf.e_pin(m_e.current_edge());
if (m_e.rising_edge()) // Host access
{
m_host_intf.m_rw = m_host_intf.m_rw_strobe;
@ -77,24 +77,24 @@ void es5504_core::tick_perf()
// update
// falling edge
m_e.m_edge.set(false);
m_intf.e(false);
m_intf.e_pin(false);
m_host_intf.m_host_access = m_host_intf.m_host_access_strobe = false;
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
voice_tick();
// rising edge
m_e.m_edge.set(true);
m_intf.e(true);
m_intf.e_pin(true);
m_host_intf.m_rw = m_host_intf.m_rw_strobe;
m_host_intf.m_host_access = m_host_intf.m_host_access_strobe;
// falling edge
m_e.m_edge.set(false);
m_intf.e(false);
m_intf.e_pin(false);
m_host_intf.m_host_access = m_host_intf.m_host_access_strobe = false;
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
voice_tick();
// rising edge
m_e.m_edge.set(true);
m_intf.e(true);
m_intf.e_pin(true);
m_host_intf.m_rw = m_host_intf.m_rw_strobe;
m_host_intf.m_host_access = m_host_intf.m_host_access_strobe;
}

View File

@ -63,7 +63,7 @@ void es5505_core::tick()
for (int i = 0; i < 4; i++)
{
if (m_wclk_lr) // Right output
m_output_temp[i].m_right = (m_output_temp[i].m_left << 1) | bitfield(m_output_latch[i].m_right, output_bit);
m_output_temp[i].m_right = (m_output_temp[i].m_right << 1) | bitfield(m_output_latch[i].m_right, output_bit);
else // Left output
m_output_temp[i].m_left = (m_output_temp[i].m_left << 1) | bitfield(m_output_latch[i].m_left, output_bit);
}
@ -89,7 +89,7 @@ void es5505_core::tick()
// E
if (m_e.tick())
{
m_intf.e(m_e.current_edge());
m_intf.e_pin(m_e.current_edge());
if (m_e.rising_edge()) // Host access
{
m_host_intf.m_rw = m_host_intf.m_rw_strobe;
@ -141,24 +141,24 @@ void es5505_core::tick_perf()
// update
// falling edge
m_e.m_edge.set(false);
m_intf.e(false);
m_intf.e_pin(false);
m_host_intf.m_host_access = m_host_intf.m_host_access_strobe = false;
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
voice_tick();
// rising edge
m_e.m_edge.set(true);
m_intf.e(true);
m_intf.e_pin(true);
m_host_intf.m_rw = m_host_intf.m_rw_strobe;
m_host_intf.m_host_access = m_host_intf.m_host_access_strobe;
// falling edge
m_e.m_edge.set(false);
m_intf.e(false);
m_intf.e_pin(false);
m_host_intf.m_host_access = m_host_intf.m_host_access_strobe = false;
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
voice_tick();
// rising edge
m_e.m_edge.set(true);
m_intf.e(true);
m_intf.e_pin(true);
m_host_intf.m_rw = m_host_intf.m_rw_strobe;
m_host_intf.m_host_access = m_host_intf.m_host_access_strobe;
}

View File

@ -131,7 +131,7 @@ private:
clock_pulse_t<s8, 16, 1> m_lrclk; // LRCLK
s16 m_wclk = 0; // WCLK
bool m_wclk_lr = false; // WCLK, L/R output select
u8 m_output_bit = 0; // Bit position in output
s8 m_output_bit = 0; // Bit position in output
output_t m_ch[4]; // 4 stereo output channels
output_t m_output[4]; // Serial outputs
output_t m_output_temp[4]; // temporary signal for serial output

View File

@ -83,7 +83,7 @@ void es5506_core::tick()
for (int i = 0; i < 6; i++)
{
if (m_wclk_lr) // Right output
m_output_temp[i].m_right = (m_output_temp[i].m_left << 1) | bitfield(m_output_latch[i].m_right, output_bit);
m_output_temp[i].m_right = (m_output_temp[i].m_right << 1) | bitfield(m_output_latch[i].m_right, output_bit);
else // Left output
m_output_temp[i].m_left = (m_output_temp[i].m_left << 1) | bitfield(m_output_latch[i].m_left, output_bit);
}
@ -124,7 +124,7 @@ void es5506_core::tick()
// E
if (m_e.tick())
{
m_intf.e(m_e.current_edge());
m_intf.e_pin(m_e.current_edge());
if (m_e.rising_edge())
{
m_host_intf.m_rw = m_host_intf.m_rw_strobe;
@ -190,24 +190,24 @@ void es5506_core::tick_perf()
// update
// falling edge
m_e.m_edge.set(false);
m_intf.e(false);
m_intf.e_pin(false);
m_host_intf.m_host_access = m_host_intf.m_host_access_strobe = false;
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
voice_tick();
// rising edge
m_e.m_edge.set(true);
m_intf.e(true);
m_intf.e_pin(true);
m_host_intf.m_rw = m_host_intf.m_rw_strobe;
m_host_intf.m_host_access = m_host_intf.m_host_access_strobe;
// falling edge
m_e.m_edge.set(false);
m_intf.e(false);
m_intf.e_pin(false);
m_host_intf.m_host_access = m_host_intf.m_host_access_strobe = false;
m_voice[m_voice_cycle].fetch(m_voice_cycle, m_voice_fetch);
voice_tick();
// rising edge
m_e.m_edge.set(true);
m_intf.e(true);
m_intf.e_pin(true);
m_host_intf.m_rw = m_host_intf.m_rw_strobe;
m_host_intf.m_host_access = m_host_intf.m_host_access_strobe;
}

View File

@ -169,7 +169,7 @@ private:
clock_pulse_t<s8, 32, 1> m_lrclk; // LRCLK
s16 m_wclk = 0; // WCLK
bool m_wclk_lr = false; // WCLK, L/R output select
u8 m_output_bit = 0; // Bit position in output
s8 m_output_bit = 0; // Bit position in output
output_t m_ch[6]; // 6 stereo output channels
output_t m_output[6]; // Serial outputs
output_t m_output_temp[6]; // temporary signal for serial output

View File

@ -146,7 +146,7 @@ using namespace es550x;
class es550x_intf
{
public:
virtual void e(bool state) {} // E output
virtual void e_pin(bool state) {} // E output
virtual void bclk(bool state) {} // BCLK output (serial specific)
virtual void lrclk(bool state) {} // LRCLK output (serial specific)
virtual void wclk(bool state) {} // WCLK output (serial specific)

View File

@ -26,8 +26,8 @@ void es550x_shared_core::es550x_filter_t::reset()
void es550x_shared_core::es550x_filter_t::tick(s32 in)
{
s32 coeff_k1 = s32(bitfield(m_k1,4,12)); // 12 MSB used
s32 coeff_k2 = s32(bitfield(m_k2,4,12)); // 12 MSB used
s32 coeff_k1 = s32(bitfield(m_k1, 4, 12)); // 12 MSB used
s32 coeff_k2 = s32(bitfield(m_k2, 4, 12)); // 12 MSB used
// Store previous filter data
m_o2_2 = m_o2_1;
m_o3_2 = m_o3_1;
@ -43,16 +43,16 @@ void es550x_shared_core::es550x_filter_t::tick(s32 in)
m_o4_1 = hp_exec(coeff_k2, m_o3_1, m_o4_1, m_o3_2);
break;
case 1: // LP3 = 0, LP4 = 1: HP/K2, LP/K1
m_o4_1 = lp_exec(coeff_k1, m_o2_1, m_o3_1);
m_o3_1 = hp_exec(coeff_k2, m_o3_1, m_o4_1, m_o3_2);
m_o3_1 = lp_exec(coeff_k1, m_o2_1, m_o3_1);
m_o4_1 = hp_exec(coeff_k2, m_o3_1, m_o4_1, m_o3_2);
break;
case 2: // LP3 = 1, LP4 = 0: LP/K2, LP/K2
m_o3_1 = lp_exec(coeff_k2, m_o2_1, m_o3_1);
m_o4_1 = lp_exec(coeff_k2, m_o3_1, m_o4_1);
break;
case 3: // LP3 = 1, LP4 = 1: LP/K2, LP/K1
m_o4_1 = lp_exec(coeff_k1, m_o2_1, m_o3_1);
m_o3_1 = lp_exec(coeff_k2, m_o3_1, m_o4_1);
m_o3_1 = lp_exec(coeff_k1, m_o2_1, m_o3_1);
m_o4_1 = lp_exec(coeff_k2, m_o3_1, m_o4_1);
break;
}
}
@ -66,5 +66,5 @@ s32 es550x_shared_core::es550x_filter_t::lp_exec(s32 coeff, s32 in, s32 prev_out
s32 es550x_shared_core::es550x_filter_t::hp_exec(s32 coeff, s32 in, s32 prev_out, s32 prev_in)
{
// Yn = Xn - Xn-1 + K*Yn-1
return in - prev_in + ((coeff * prev_out) / 8192) * (prev_out / 2);
return in - prev_in + ((coeff * prev_out) / 8192) + (prev_out / 2);
}

View File

@ -1808,7 +1808,7 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
if (sPreview.dir) {
if (s->isLoopable() && ((int)sPreview.pos)<s->loopStart) {
switch (s->loopMode) {
case DIV_SAMPLE_LOOPMODE_FOWARD:
case DIV_SAMPLE_LOOPMODE_FORWARD:
sPreview.dir=false;
sPreview.pos=s->loopStart+1;
break;
@ -1828,7 +1828,7 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
} else {
if (s->isLoopable() && sPreview.pos>=s->loopEnd) {
switch (s->loopMode) {
case DIV_SAMPLE_LOOPMODE_FOWARD:
case DIV_SAMPLE_LOOPMODE_FORWARD:
sPreview.dir=false;
sPreview.pos=s->loopStart;
break;
@ -1851,7 +1851,7 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
if (sPreview.dir) {
if (s->isLoopable() && ((int)sPreview.pos)<s->loopStart) {
switch (s->loopMode) {
case DIV_SAMPLE_LOOPMODE_FOWARD:
case DIV_SAMPLE_LOOPMODE_FORWARD:
sPreview.dir=false;
sPreview.pos=s->loopStart+1;
break;
@ -1865,18 +1865,18 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
break;
case DIV_SAMPLE_LOOPMODE_ONESHOT:
default:
if (sPreview.pos<0) {
if (((int)sPreview.pos)<0) {
sPreview.sample=-1;
}
break;
}
} else if (sPreview.pos<0) {
} else if (((int)sPreview.pos)<0) {
sPreview.sample=-1;
}
} else {
if (s->isLoopable() && sPreview.pos>=s->loopEnd) {
switch (s->loopMode) {
case DIV_SAMPLE_LOOPMODE_FOWARD:
case DIV_SAMPLE_LOOPMODE_FORWARD:
sPreview.dir=false;
sPreview.pos=s->loopStart;
break;

View File

@ -330,10 +330,11 @@ bool DivSample::insert(unsigned int pos, unsigned int length) {
#define RESAMPLE_END \
if (loopStart>=0) loopStart=(double)loopStart*(r/(double)rate); \
if (loopEnd>=0) loopEnd=(double)loopEnd*(r/(double)rate); \
if (loopEnd<samples) loopEnd=(double)loopEnd*(r/(double)rate); \
centerRate=(int)((double)centerRate*(r/(double)rate)); \
rate=r; \
samples=finalCount; \
if (loopEnd>samples) loopEnd=samples; \
if (depth==DIV_SAMPLE_DEPTH_16BIT) { \
delete[] oldData16; \
} else if (depth==DIV_SAMPLE_DEPTH_8BIT) { \

View File

@ -51,7 +51,7 @@ enum DivSampleDepth: unsigned char {
enum DivSampleLoopMode: unsigned char {
DIV_SAMPLE_LOOPMODE_ONESHOT=0,
DIV_SAMPLE_LOOPMODE_FOWARD,
DIV_SAMPLE_LOOPMODE_FORWARD,
DIV_SAMPLE_LOOPMODE_BACKWARD,
DIV_SAMPLE_LOOPMODE_PINGPONG,
DIV_SAMPLE_LOOPMODE_MAX // for identify boundary

View File

@ -1111,7 +1111,7 @@ void FurnaceGUI::drawGBEnv(unsigned char vol, unsigned char len, unsigned char s
if (macro.len>127) macro.len=127; \
} \
if (macroMode && macroModeMax>0) { \
for (int m=0; m<=macroModeMax; m++) { \
for (unsigned int m=0; m<=macroModeMax; m++) { \
if (ImGui::RadioButton(displayModeName[m],macro.mode==m)) { \
macro.mode=m; \
} \
@ -1206,7 +1206,7 @@ void FurnaceGUI::drawGBEnv(unsigned char vol, unsigned char len, unsigned char s
if (macro.len>127) macro.len=127; \
} \
if (macroMode && macroModeMax>0) { \
for (int m=0; m<=macroModeMax; m++) { \
for (unsigned int m=0; m<=macroModeMax; m++) { \
if (ImGui::RadioButton(displayModeName[m],macro.mode==m)) { \
macro.mode=m; \
} \

View File

@ -137,8 +137,8 @@ void FurnaceGUI::drawSampleEdit() {
if (end<sample->loopStart) {
end=sample->loopStart;
}
if (end>sample->samples) {
end=sample->samples;
if (end>(int)sample->samples) {
end=(int)sample->samples;
}
sample->loopEnd=end;
updateSampleTex=true;