Skip to content

Commit

Permalink
Fix for DAC noise.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fujix1 committed Dec 4, 2024
1 parent 06fc500 commit 362cf0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
16 changes: 2 additions & 14 deletions lib/fm/fm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,11 @@ void FMChip::writeRaw(byte data, byte chipno, si5351Freq_t freq) {
switch (chipno) {
case 0:
CS0_LOW;
CS1_HIGH;
CS2_HIGH;
break;
case 1:
CS0_HIGH;
CS1_LOW;
CS2_HIGH;
break;
case 2:
CS0_HIGH;
CS1_HIGH;
CS2_LOW;
break;
}
Expand All @@ -135,7 +129,7 @@ void FMChip::writeRaw(byte data, byte chipno, si5351Freq_t freq) {
// 3.579MHz : 0.2794us * 32 = 8.94 us
// 1.5MHz : 0.66us * 32 = 21.3 us
WR_LOW;
ets_delay_us((32000000 / freq) + 1);
ets_delay_us((32000000 / freq));

WR_HIGH;
switch (chipno) {
Expand All @@ -156,16 +150,10 @@ void FMChip::setYM2612(byte bank, byte addr, byte data, uint8_t chipno) {
switch (chipno) {
case 0:
CS0_LOW;
CS1_HIGH;
CS2_HIGH;
break;
case 1:
CS0_HIGH;
CS1_LOW;
CS2_HIGH;
case 2:
CS0_HIGH;
CS1_HIGH;
CS2_LOW;
break;
}
Expand Down Expand Up @@ -249,7 +237,7 @@ void FMChip::setYM2612DAC(byte data, uint8_t chipno) {
A0_HIGH;
// アドレスライト後の待ちサイクル
// アドレス$21-$B6 待ちサイクル 17 = 2.21us
ets_delay_us(3);
ets_delay_us(4);
}

// data
Expand Down
3 changes: 2 additions & 1 deletion src/vgm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,8 @@ void VGM::vgmProcessMain() {
break;

case 0x80 ... 0x8f:
FM.setYM2612DAC(vgmData[_pcmpos++], 0);
// FM.setYM2612DAC(vgmData[_pcmpos++], 0);
FM.setYM2612(0, 0x2a, vgmData[_pcmpos++], 0);
//_vgmDelay += (command & 15) * ONE_CYCLE;
_vgmSamples += (command & 15);
break;
Expand Down

0 comments on commit 362cf0d

Please sign in to comment.