X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=pico%2Fsound%2Fsound.c;h=b12afc3c25265e87d201269e0662674da5f6ef87;hb=3f23709ef37c5b3511c1445cbed7b447b56a37e0;hp=1f23e1aaebee33b1bd5fc69f053bed78f7bdd5fe;hpb=9b5713af95da3f72cb659d4d8017559aca593a31;p=picodrive.git diff --git a/pico/sound/sound.c b/pico/sound/sound.c index 1f23e1a..b12afc3 100644 --- a/pico/sound/sound.c +++ b/pico/sound/sound.c @@ -11,9 +11,11 @@ #include "ym2612.h" #include "sn76496.h" #include "../pico_int.h" -#include "../cd/pcm.h" +#include "../cd/cue.h" #include "mix.h" +#define SIMPLE_WRITE_SOUND 0 + void (*PsndMix_32_to_16l)(short *dest, int *src, int count) = mix_32_to_16l_stereo; // master int buffer to mix to @@ -119,15 +121,6 @@ void PsndRerate(int preserve_state) void *state = NULL; int target_fps = Pico.m.pal ? 50 : 60; - // not all rates are supported in MCD mode due to mp3 decoder limitations - if (PicoAHW & PAHW_MCD) { - if (!(11025-100 <= PsndRate && PsndRate <= 11025+100) && - !(22050-100 <= PsndRate && PsndRate <= 22050+100) && - !(44100-100 <= PsndRate && PsndRate <= 44100+100)) - PsndRate = 22050; - PicoOpt |= POPT_EN_STEREO; // force stereo - } - if (preserve_state) { state = malloc(0x204); if (state == NULL) return; @@ -158,9 +151,6 @@ void PsndRerate(int preserve_state) // recalculate dac info dac_recalculate(); - if (PicoAHW & PAHW_MCD) - pcm_set_rate(PsndRate); - // clear all buffers memset32(PsndBuffer, 0, sizeof(PsndBuffer)/4); memset(cdda_out_buffer, 0, sizeof(cdda_out_buffer)); @@ -198,14 +188,6 @@ PICO_INTERNAL void PsndDoDAC(int line_to) short *d = PsndOut + pos; for (; len > 0; len--, d++) *d = dout; } - -#if 0 - if (do_pcm) { - int *d = PsndBuffer; - d += (PicoOpt&8) ? pos*2 : pos; - pcm_update(d, len, 1); - } -#endif } // cdda @@ -258,7 +240,7 @@ PICO_INTERNAL void cdda_start_play(void) return; } - if (Pico_mcd->TOC.Tracks[i].ftype == TYPE_MP3) + if (Pico_mcd->TOC.Tracks[i].ftype == CT_MP3) { int pos1024 = 0; @@ -278,7 +260,7 @@ PICO_INTERNAL void cdda_start_play(void) cdda_stream = Pico_mcd->TOC.Tracks[i].F; PicoCDBufferFlush(); // buffering relies on fp not being touched pm_seek(cdda_stream, lba_offset * 2352, SEEK_SET); - if (Pico_mcd->TOC.Tracks[i].ftype == TYPE_WAV) + if (Pico_mcd->TOC.Tracks[i].ftype == CT_WAV) { // skip headers, assume it's 44kHz stereo uncompressed pm_seek(cdda_stream, 44, SEEK_CUR); @@ -306,9 +288,7 @@ static int PsndRender(int offset, int length) int buf32_updated = 0; int *buf32 = PsndBuffer+offset; int stereo = (PicoOpt & 8) >> 3; - // emulating CD && PCM option enabled && PCM chip on && have enabled channels - int do_pcm = (PicoAHW & PAHW_MCD) && (PicoOpt&POPT_EN_MCD_PCM) && - (Pico_mcd->pcm.control & 0x80) && Pico_mcd->pcm.enabled; + offset <<= stereo; pprof_start(sound); @@ -343,8 +323,8 @@ static int PsndRender(int offset, int length) (void)buf32_updated; // CD: PCM sound - if (do_pcm) { - pcm_update(buf32, length, stereo); + if (PicoAHW & PAHW_MCD) { + pcd_pcm_update(buf32, length, stereo); //buf32_updated = 1; } @@ -356,7 +336,7 @@ static int PsndRender(int offset, int length) // note: only 44, 22 and 11 kHz supported, with forced stereo int index = Pico_mcd->scd.Cur_Track - 1; - if (Pico_mcd->TOC.Tracks[index].ftype == TYPE_MP3) + if (Pico_mcd->TOC.Tracks[index].ftype == CT_MP3) mp3_update(buf32, length, stereo); else cdda_raw_update(buf32, length);