# HG changeset patch # User Michael Pavone # Date 1644478743 28800 # Node ID 539450d905b3e9b31ce813d21f9eafad12ae5d64 # Parent b92c998c67420f139411da0abe047ee466aadecb Fix CDD PLAY command and CDD fader sample alignment diff -r b92c998c6742 -r 539450d905b3 cdd_mcu.c --- a/cdd_mcu.c Wed Feb 09 00:47:20 2022 -0800 +++ b/cdd_mcu.c Wed Feb 09 23:39:03 2022 -0800 @@ -485,11 +485,12 @@ } if (context->status == DS_STOP || context->status == DS_TOC_READ) { context->seeking = 1; - context->seek_pba = LEADIN_SECTORS + context->media->tracks[0].fake_pregap + context->media->tracks[0].start_lba; - printf("CDD CMD: PAUSE, seeking to %u\n", context->seek_pba); + context->seek_pba = LEADIN_SECTORS + context->media->tracks[0].fake_pregap + context->media->tracks[0].start_lba - 4; + printf("CDD CMD: PLAY, seeking to %u\n", context->seek_pba); } else { - puts("CDD CMD: PAUSE"); + puts("CDD CMD: PLAY"); } + context->status = DS_PLAY; break; //TODO: CMD_FFWD, CMD_RWD case CMD_TRACK_SKIP: @@ -600,12 +601,16 @@ } } if (context->cycle >= context->next_byte_cycle) { - if (context->current_sector_byte >= 0) { + if (context->current_sector_byte >= 0 && (!fader->byte_counter || context->current_sector_byte)) { uint8_t byte = context->media->read(context->media, context->current_sector_byte); lc8951_write_byte(cdc, cd_block_to_mclks(context->cycle), context->current_sector_byte++, byte); cdd_fader_data(fader, gate_array[GAO_CDD_CTRL] & BIT_MUTE ? 0 : byte); } else { cdd_fader_data(fader, 0); + if (context->current_sector_byte >= 0) { + next_subcode += BYTE_CLOCKS; + context->last_subcode_cycle += BYTE_CLOCKS; + } } if (context->current_sector_byte == 2352) { context->current_sector_byte = -1;