mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-12-05 00:44:19 +01:00
65984b9102
- added: option to disable AA filtering (snes graphics 'crisper', AA now default OFF) - added: mapped zooming and turbo mode to classic controller - added: preliminary usb support (loading) - changed: sram and freezes now saved by filename, not internal romname. If you have multiple versions of the same game, you can now have srams and freezes for each version. A prompt to convert to the new naming is provided for sram only. - changed: by default, autoload/save sram and freeze enabled
105 lines
2.0 KiB
C++
105 lines
2.0 KiB
C++
/****************************************************************************
|
|
* Snes9x 1.50
|
|
*
|
|
* Nintendo Gamecube Audio
|
|
*
|
|
* Audio is fixed to 32Khz/16bit/Stereo
|
|
*
|
|
* softdev July 2006
|
|
****************************************************************************/
|
|
#include <gccore.h>
|
|
#include <ogcsys.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "snes9x.h"
|
|
#include "memmap.h"
|
|
#include "debug.h"
|
|
#include "cpuexec.h"
|
|
#include "ppu.h"
|
|
#include "apu.h"
|
|
#include "display.h"
|
|
#include "gfx.h"
|
|
#include "soundux.h"
|
|
#include "spc700.h"
|
|
#include "spc7110.h"
|
|
#include "controls.h"
|
|
|
|
#include "video.h"
|
|
#include "ftfont.h"
|
|
|
|
/*** Double buffered audio ***/
|
|
#define AUDIOBUFFER 2048
|
|
static unsigned char soundbuffer[2][AUDIOBUFFER]
|
|
__attribute__ ((__aligned__ (32)));
|
|
static int whichab = 0; /*** Audio buffer flip switch ***/
|
|
extern int ConfigRequested;
|
|
|
|
#define AUDIOSTACK 16384
|
|
lwpq_t audioqueue;
|
|
lwp_t athread;
|
|
static uint8 astack[AUDIOSTACK];
|
|
|
|
/**
|
|
* Audio Threading
|
|
*/
|
|
static void *
|
|
AudioThread (void *arg)
|
|
{
|
|
LWP_InitQueue (&audioqueue);
|
|
|
|
while (1)
|
|
{
|
|
whichab ^= 1;
|
|
if (ConfigRequested)
|
|
memset (soundbuffer[whichab], 0, AUDIOBUFFER);
|
|
else
|
|
{
|
|
so.samples_mixed_so_far = so.play_position = 0;
|
|
S9xMixSamples (soundbuffer[whichab], AUDIOBUFFER >> 1);
|
|
}
|
|
LWP_ThreadSleep (audioqueue);
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
/**
|
|
* MixSamples
|
|
* This continually calls S9xMixSamples On each DMA Completion
|
|
*/
|
|
static void
|
|
GCMixSamples ()
|
|
{
|
|
AUDIO_StopDMA ();
|
|
|
|
DCFlushRange (soundbuffer[whichab], AUDIOBUFFER);
|
|
AUDIO_InitDMA ((u32) soundbuffer[whichab], AUDIOBUFFER);
|
|
AUDIO_StartDMA ();
|
|
|
|
LWP_ThreadSignal (audioqueue);
|
|
}
|
|
|
|
/**
|
|
* InitGCAudio
|
|
*/
|
|
void
|
|
InitGCAudio ()
|
|
{
|
|
AUDIO_SetDSPSampleRate (AI_SAMPLERATE_32KHZ);
|
|
AUDIO_RegisterDMACallback (GCMixSamples);
|
|
|
|
LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 80);
|
|
}
|
|
|
|
/**
|
|
* AudioStart
|
|
*
|
|
* Called to kick off the Audio Queue
|
|
*/
|
|
void
|
|
AudioStart ()
|
|
{
|
|
GCMixSamples ();
|
|
}
|