psphawk: sound, except it doesn't work. i will figure it out later
This commit is contained in:
parent
c8577fc361
commit
1de395ca2a
|
@ -25,5 +25,8 @@ namespace BizHawk.Emulation.Consoles.Sony.PSP
|
|||
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern void advance();
|
||||
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int mixsound(short[] buff, int nsamp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,12 @@ namespace BizHawk.Emulation.Consoles.Sony.PSP
|
|||
public void FrameAdvance(bool render, bool rendersound = true)
|
||||
{
|
||||
PPSSPPDll.advance();
|
||||
// problem 1: audio can be 48khz, if a particular core parameter is set. we're not accounting for that.
|
||||
// problem 2: we seem to be getting approximately the right amount of output, but with
|
||||
// a lot of jitter on the per-frame buffer size
|
||||
nsampavail = PPSSPPDll.mixsound(audiobuffer, audiobuffer.Length / 2);
|
||||
LogFlush();
|
||||
//Console.WriteLine("Audio Service: {0}", nsampavail);
|
||||
}
|
||||
|
||||
public int Frame
|
||||
|
@ -184,11 +189,12 @@ namespace BizHawk.Emulation.Consoles.Sony.PSP
|
|||
public int BufferHeight { get { return screenheight; } }
|
||||
public int BackgroundColor { get { return unchecked((int)0xff000000); } }
|
||||
|
||||
readonly short[] audiobuffer = new short[735 * 2];
|
||||
readonly short[] audiobuffer = new short[2048 * 2];
|
||||
int nsampavail = 0;
|
||||
public void GetSamples(out short[] samples, out int nsamp)
|
||||
{
|
||||
samples = audiobuffer;
|
||||
nsamp = 735;
|
||||
samples = audiobuffer;
|
||||
nsamp = nsampavail;
|
||||
}
|
||||
public void DiscardSamples()
|
||||
{
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -27,7 +27,7 @@
|
|||
int PSPMixer::Mix(short *stereoout, int numSamples)
|
||||
{
|
||||
int numFrames = __AudioMix(stereoout, numSamples);
|
||||
#ifdef _WIN32
|
||||
#if 0 //def _WIN32
|
||||
if (numFrames < numSamples) {
|
||||
// Our dsound backend will not stop playing, let's just feed it zeroes if we miss data.
|
||||
memset(stereoout + 2 * 2 * numFrames, 0, 2 * 2 * (numSamples - numFrames));
|
||||
|
|
|
@ -167,7 +167,7 @@ BZEXPORT int BZAPI init(const char *fn, void (BZAPI* logcallback)(char, const ch
|
|||
CoreParameter coreParameter;
|
||||
coreParameter.cpuCore = CPU_JIT;
|
||||
coreParameter.gpuCore = GPU_GLES;
|
||||
coreParameter.enableSound = false;
|
||||
coreParameter.enableSound = true;
|
||||
coreParameter.fileToStart = fn;
|
||||
coreParameter.mountIso = "";
|
||||
coreParameter.startPaused = true;
|
||||
|
@ -182,7 +182,7 @@ BZEXPORT int BZAPI init(const char *fn, void (BZAPI* logcallback)(char, const ch
|
|||
coreParameter.pixelHeight = 272;
|
||||
coreParameter.unthrottle = true;
|
||||
|
||||
g_Config.bEnableSound = false;
|
||||
g_Config.bEnableSound = true;
|
||||
g_Config.bFirstRun = false;
|
||||
g_Config.bIgnoreBadMemAccess = true;
|
||||
// Never report from tests.
|
||||
|
@ -240,6 +240,11 @@ BZEXPORT void BZAPI die()
|
|||
logger = NULL;
|
||||
}
|
||||
|
||||
BZEXPORT int BZAPI mixsound(short *buff, int nsamp)
|
||||
{
|
||||
return headlessHost->SendSound(buff, nsamp);
|
||||
}
|
||||
|
||||
BZEXPORT void BZAPI advance()
|
||||
{
|
||||
coreState = CORE_RUNNING;
|
||||
|
|
|
@ -69,6 +69,25 @@ void SetVSync(int value)
|
|||
wglSwapIntervalEXT(value);
|
||||
}
|
||||
|
||||
void WindowsHeadlessHost::InitSound(PMixer *mixer)
|
||||
{
|
||||
gmixer = mixer;
|
||||
}
|
||||
void WindowsHeadlessHost::UpdateSound()
|
||||
{
|
||||
}
|
||||
void WindowsHeadlessHost::ShutdownSound()
|
||||
{
|
||||
gmixer = NULL;
|
||||
}
|
||||
|
||||
int WindowsHeadlessHost::SendSound(short *buff, int n)
|
||||
{
|
||||
if (!gmixer)
|
||||
return 0;
|
||||
return gmixer->Mix(buff, n);
|
||||
}
|
||||
|
||||
// TODO: also fix up GetSysDirectories
|
||||
void WindowsHeadlessHost::LoadNativeAssets()
|
||||
{
|
||||
|
|
|
@ -38,10 +38,18 @@ public:
|
|||
virtual void SetComparisonScreenshot(const std::string &filename);
|
||||
virtual void SendBackBuffer(void *dest);
|
||||
|
||||
virtual void WindowsHeadlessHost::InitSound(PMixer *mixer);
|
||||
virtual void WindowsHeadlessHost::UpdateSound();
|
||||
virtual void WindowsHeadlessHost::ShutdownSound();
|
||||
|
||||
virtual int SendSound(short *buff, int n);
|
||||
|
||||
private:
|
||||
bool ResizeGL();
|
||||
void LoadNativeAssets();
|
||||
|
||||
PMixer *gmixer;
|
||||
|
||||
HWND hWnd;
|
||||
HDC hDC;
|
||||
HGLRC hRC;
|
||||
|
|
Loading…
Reference in New Issue