mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-04 23:07:46 -04:00
debug bgm player, sound code refactoring
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@598 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
40644bfedd
commit
7b3f44c6b6
12 changed files with 161 additions and 86 deletions
|
@ -297,7 +297,7 @@ PICO_INTERNAL void PsndClear(void)
|
|||
}
|
||||
|
||||
|
||||
PICO_INTERNAL int PsndRender(int offset, int length)
|
||||
static int PsndRender(int offset, int length)
|
||||
{
|
||||
int buf32_updated = 0;
|
||||
int *buf32 = PsndBuffer+offset;
|
||||
|
@ -361,6 +361,35 @@ PICO_INTERNAL int PsndRender(int offset, int length)
|
|||
return length;
|
||||
}
|
||||
|
||||
// to be called on 224 or line_sample scanlines only
|
||||
PICO_INTERNAL void PsndGetSamples(int y)
|
||||
{
|
||||
#if SIMPLE_WRITE_SOUND
|
||||
if (y != 224) return;
|
||||
PsndRender(0, PsndLen);
|
||||
if (PicoWriteSound) PicoWriteSound(PsndLen);
|
||||
PsndClear();
|
||||
#else
|
||||
static int curr_pos = 0;
|
||||
|
||||
if (y == 224)
|
||||
{
|
||||
if (emustatus & 2)
|
||||
curr_pos += PsndRender(curr_pos, PsndLen-PsndLen/2);
|
||||
else curr_pos = PsndRender(0, PsndLen);
|
||||
if (emustatus&1) emustatus|=2; else emustatus&=~2;
|
||||
if (PicoWriteSound) PicoWriteSound(curr_pos);
|
||||
// clear sound buffer
|
||||
PsndClear();
|
||||
}
|
||||
else if (emustatus & 3) {
|
||||
emustatus|= 2;
|
||||
emustatus&=~1;
|
||||
curr_pos = PsndRender(0, PsndLen/2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// z80 stuff
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue