From a75e85aa3cb7137f8f4735f8ac878911cbbb7c8e Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Tue, 22 Jan 2013 20:27:42 +0100 Subject: [PATCH] Hacky implementation of sceVaudio, whatever the point of that API is... --- Core/HLE/sceAudio.cpp | 1 - Core/HLE/sceVaudio.cpp | 27 ++++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Core/HLE/sceAudio.cpp b/Core/HLE/sceAudio.cpp index 9ce7f2cf89..8276439e2e 100644 --- a/Core/HLE/sceAudio.cpp +++ b/Core/HLE/sceAudio.cpp @@ -27,7 +27,6 @@ // There's a second Audio api called Audio2 that only has one channel, I guess the 8 channel api was overkill. // We simply map it to the first of the 8 channels. - AudioChannel chans[8]; // Enqueues the buffer pointer on the channel. If channel buffer queue is full (2 items?) will block until it isn't. diff --git a/Core/HLE/sceVaudio.cpp b/Core/HLE/sceVaudio.cpp index 68493f583d..59cb5be303 100644 --- a/Core/HLE/sceVaudio.cpp +++ b/Core/HLE/sceVaudio.cpp @@ -18,20 +18,33 @@ #include "HLE.h" #include "FunctionWrappers.h" #include "sceVaudio.h" +#include "sceAudio.h" +#include "__sceAudio.h" -u32 sceVaudioOutputBlocking(int vol, u32 buffer) { - ERROR_LOG(HLE, "UNIMPL sceVaudioOutputBlocking(%i, %08x)", vol, buffer); - return 0; -} +// Ultra hacky Vaudio implementation. Not sure what the point of this API is. u32 sceVaudioChReserve(int sampleCount, int freq, int format) { - ERROR_LOG(HLE, "UNIMPL sceVaudioChReserve(%i, %i, %i)", sampleCount, freq, format); + WARN_LOG(HLE, "HACK sceVaudioChReserve(%i, %i, %i)", sampleCount, freq, format); + chans[0].reserved = true; + chans[0].sampleCount = sampleCount; + chans[0].format = format; + __AudioSetOutputFrequency(freq); return 0; } u32 sceVaudioChRelease() { - ERROR_LOG(HLE, "UNIMPL sceVaudioChRelease(...)"); - return 0; + WARN_LOG(HLE, "HACK sceVaudioChRelease(...)"); + if (!chans[0].reserved) { + return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; + } else { + chans[0].reserved = false; + return 0; + } +} + +u32 sceVaudioOutputBlocking(int vol, u32 buffer) { + WARN_LOG(HLE, "HACK sceVaudioOutputBlocking(%i, %08x)", vol, buffer); + return __AudioEnqueue(chans[0], 0, true); } u32 sceVaudioSetEffectType(int effectType, int vol) {