Skip to content

Commit

Permalink
Attempt at improving MDEC playback
Browse files Browse the repository at this point in the history
  • Loading branch information
luksamuk committed Nov 13, 2024
1 parent 999f303 commit 8531196
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/mdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,12 @@ mdec_start(const char *filepath)
str_ctx->sector_pending = 0;
str_ctx->frame_ready = 0;

CdSync(0, 0);

// Read at 2x speed to play any XA-ADPCM sectors that could be
// interleaved with the data
// Start reading in real-time mode (doesn't retry in case of errors).
uint8_t mode = CdlModeRT | CdlModeSpeed;
uint8_t mode = CdlModeRT | CdlModeSpeed | CdlModeAP;
CdControl(CdlSetmode, (const uint8_t *)&mode, 0);
CdControl(CdlReadS, (const void *)&file.pos, 0);
CdControlF(CdlReadS, (const void *)&file.pos);

// Wait for first frame to be buffered.
_mdec_get_next_frame();
Expand All @@ -118,7 +116,7 @@ mdec_stop()
// Force playback end on context
cd_detach_callbacks();
str_ctx->frame_ready = -1;
CdControlB(CdlPause, 0, 0);
CdControl(CdlPause, 0, 0);

if(str_ctx) {
str_ctx = NULL;
Expand Down

0 comments on commit 8531196

Please sign in to comment.