notaz.gp2x.de
/
picodrive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
start new makefile, migrate to libpicofe
[picodrive.git]
/
pico
/
sound
/
sound.c
diff --git
a/pico/sound/sound.c
b/pico/sound/sound.c
index
6e0db26
..
48ad409
100644
(file)
--- a/
pico/sound/sound.c
+++ b/
pico/sound/sound.c
@@
-247,7
+247,7
@@
PICO_INTERNAL void cdda_start_play(void)
lba_offset += Pico_mcd->TOC.Tracks[index].Offset;
\r
\r
// find the actual file for this track
\r
lba_offset += Pico_mcd->TOC.Tracks[index].Offset;
\r
\r
// find the actual file for this track
\r
- for (i = index; i >
=
0; i--)
\r
+ for (i = index; i > 0; i--)
\r
if (Pico_mcd->TOC.Tracks[i].F != NULL) break;
\r
\r
if (Pico_mcd->TOC.Tracks[i].F == NULL) {
\r
if (Pico_mcd->TOC.Tracks[i].F != NULL) break;
\r
\r
if (Pico_mcd->TOC.Tracks[i].F == NULL) {
\r
@@
-291,7
+291,7
@@
PICO_INTERNAL void PsndClear(void)
memset32((int *) PsndOut, 0, len); // assume PsndOut to be aligned
\r
else {
\r
short *out = PsndOut;
\r
memset32((int *) PsndOut, 0, len); // assume PsndOut to be aligned
\r
else {
\r
short *out = PsndOut;
\r
- if ((
int
)out & 2) { *out++ = 0; len--; }
\r
+ if ((
long
)out & 2) { *out++ = 0; len--; }
\r
memset32((int *) out, 0, len/2);
\r
if (len & 1) out[len-1] = 0;
\r
}
\r
memset32((int *) out, 0, len/2);
\r
if (len & 1) out[len-1] = 0;
\r
}
\r
@@
-308,6
+308,8
@@
static int PsndRender(int offset, int length)
(Pico_mcd->pcm.control & 0x80) && Pico_mcd->pcm.enabled;
\r
offset <<= stereo;
\r
\r
(Pico_mcd->pcm.control & 0x80) && Pico_mcd->pcm.enabled;
\r
offset <<= stereo;
\r
\r
+ pprof_start(sound);
\r
+
\r
#if !SIMPLE_WRITE_SOUND
\r
if (offset == 0) { // should happen once per frame
\r
// compensate for float part of PsndLen
\r
#if !SIMPLE_WRITE_SOUND
\r
if (offset == 0) { // should happen once per frame
\r
// compensate for float part of PsndLen
\r
@@
-335,6
+337,7
@@
static int PsndRender(int offset, int length)
memset32(buf32, 0, length<<stereo);
\r
\r
//printf("active_chs: %02x\n", buf32_updated);
\r
memset32(buf32, 0, length<<stereo);
\r
\r
//printf("active_chs: %02x\n", buf32_updated);
\r
+ (void)buf32_updated;
\r
\r
// CD: PCM sound
\r
if (do_pcm) {
\r
\r
// CD: PCM sound
\r
if (do_pcm) {
\r
@@
-356,9
+359,14
@@
static int PsndRender(int offset, int length)
cdda_raw_update(buf32, length);
\r
}
\r
\r
cdda_raw_update(buf32, length);
\r
}
\r
\r
+ if ((PicoAHW & PAHW_32X) && (PicoOpt & POPT_EN_PWM))
\r
+ p32x_pwm_update(buf32, length, stereo);
\r
+
\r
// convert + limit to normal 16bit output
\r
PsndMix_32_to_16l(PsndOut+offset, buf32, length);
\r
\r
// convert + limit to normal 16bit output
\r
PsndMix_32_to_16l(PsndOut+offset, buf32, length);
\r
\r
+ pprof_end(sound);
\r
+
\r
return length;
\r
}
\r
\r
return length;
\r
}
\r
\r
@@
-368,7
+376,8
@@
PICO_INTERNAL void PsndGetSamples(int y)
#if SIMPLE_WRITE_SOUND
\r
if (y != 224) return;
\r
PsndRender(0, PsndLen);
\r
#if SIMPLE_WRITE_SOUND
\r
if (y != 224) return;
\r
PsndRender(0, PsndLen);
\r
- if (PicoWriteSound) PicoWriteSound(PsndLen);
\r
+ if (PicoWriteSound)
\r
+ PicoWriteSound(PsndLen * ((PicoOpt & POPT_EN_STEREO) ? 4 : 2));
\r
PsndClear();
\r
#else
\r
static int curr_pos = 0;
\r
PsndClear();
\r
#else
\r
static int curr_pos = 0;
\r
@@
-378,8
+387,11
@@
PICO_INTERNAL void PsndGetSamples(int y)
if (emustatus & 2)
\r
curr_pos += PsndRender(curr_pos, PsndLen-PsndLen/2);
\r
else curr_pos = PsndRender(0, PsndLen);
\r
if (emustatus & 2)
\r
curr_pos += PsndRender(curr_pos, PsndLen-PsndLen/2);
\r
else curr_pos = PsndRender(0, PsndLen);
\r
- if (emustatus&1) emustatus|=2; else emustatus&=~2;
\r
- if (PicoWriteSound) PicoWriteSound(curr_pos);
\r
+ if (emustatus & 1)
\r
+ emustatus |= 2;
\r
+ else emustatus &= ~2;
\r
+ if (PicoWriteSound)
\r
+ PicoWriteSound(curr_pos * ((PicoOpt & POPT_EN_STEREO) ? 4 : 2));
\r
// clear sound buffer
\r
PsndClear();
\r
}
\r
// clear sound buffer
\r
PsndClear();
\r
}
\r
@@
-417,7
+429,7
@@
PICO_INTERNAL void PsndGetSamplesMS(void)
}
\r
\r
if (PicoWriteSound != NULL)
\r
}
\r
\r
if (PicoWriteSound != NULL)
\r
- PicoWriteSound(length);
\r
+ PicoWriteSound(length
* ((PicoOpt & POPT_EN_STEREO) ? 4 : 2)
);
\r
PsndClear();
\r
}
\r
\r
PsndClear();
\r
}
\r
\r