X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2Fsound%2Fsound.c;h=6a45033284dfc98ae35373841f7747c878ef47f3;hb=83c093a48ab58670ea82d0ec81658daa9f9b950a;hp=28e6dc453a6c51de321a22c4c3d1b28972b6d8ca;hpb=85f8e92973ca60968cfb844d2119b669ce610c2d;p=picodrive.git diff --git a/Pico/sound/sound.c b/Pico/sound/sound.c index 28e6dc4..6a45033 100644 --- a/Pico/sound/sound.c +++ b/Pico/sound/sound.c @@ -8,14 +8,9 @@ #include -#include "sound.h" #include "ym2612.h" #include "sn76496.h" -#ifndef __GNUC__ -#pragma warning (disable:4244) -#endif - #if defined(_USE_MZ80) #include "../../cpu/mz80/mz80.h" #elif defined(_USE_DRZ80) @@ -29,11 +24,8 @@ // master int buffer to mix to static int PsndBuffer[2*44100/50]; -//int z80CycleAim = 0; - // dac -short *dac_out; -unsigned short dac_info[312]; // pppppppp ppppllll, p - pos in buff, l - length to write for this sample +static unsigned short dac_info[312]; // pppppppp ppppllll, p - pos in buff, l - length to write for this sample // for Pico int PsndRate=0; @@ -51,7 +43,7 @@ void YM2612TimerHandler(int c,int cnt); extern int *sn76496_regs; -static void dac_recalculate() +static void dac_recalculate(void) { int i, dac_cnt, pos, len, lines = Pico.m.pal ? 312 : 262, mid = Pico.m.pal ? 68 : 93; @@ -107,15 +99,16 @@ static void dac_recalculate() } -void sound_reset() +PICO_INTERNAL void sound_reset(void) { - extern int z80stopCycle; void *ym2612_regs; // also clear the internal registers+addr line ym2612_regs = YM2612GetRegs(); memset(ym2612_regs, 0, 0x200+4); - z80stopCycle = 0; + // setting these to 0 might confuse timing code, + // so better set to something like this instead + z80startCycle = z80stopCycle = 0x01000000; sound_rerate(0); } @@ -168,7 +161,7 @@ void sound_rerate(int preserve_state) // This is called once per raster (aka line), but not necessarily for every line -void sound_timers_and_dac(int raster) +PICO_INTERNAL void sound_timers_and_dac(int raster) { int pos, len; int do_dac = PsndOut && (PicoOpt&1) && *ym2612_dacen; @@ -216,7 +209,7 @@ void sound_timers_and_dac(int raster) } -void sound_clear(void) +PICO_INTERNAL void sound_clear(void) { int len = PsndLen; if (PsndLen_exc_add) len++; @@ -225,7 +218,7 @@ void sound_clear(void) } -int sound_render(int offset, int length) +PICO_INTERNAL int sound_render(int offset, int length) { int buf32_updated = 0; int *buf32 = PsndBuffer+offset; @@ -248,8 +241,10 @@ int sound_render(int offset, int length) SN76496Update(PsndOut+offset, length, stereo); // Add in the stereo FM buffer - if (PicoOpt & 1) + if (PicoOpt & 1) { buf32_updated = YM2612UpdateOne(buf32, length, stereo, 1); + } else + memset32(buf32, 0, length<