Mercurial > repos > blastem
changeset 2100:539450d905b3
Fix CDD PLAY command and CDD fader sample alignment
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 09 Feb 2022 23:39:03 -0800 |
parents | b92c998c6742 |
children | 17ecd28ddc8a |
files | cdd_mcu.c |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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;