Really no need to call clear() in the constructor for AudioChannel.

However if this helps #13271, something is very wrong...
This commit is contained in:
Henrik Rydgård 2020-08-12 00:22:11 +02:00
parent f617bfce29
commit 27c059bf9e
2 changed files with 12 additions and 22 deletions

View File

@ -38,6 +38,9 @@ int defaultRoutingVolMode = AUDIO_ROUTING_SPEAKER_ON;
extern FixedSizeQueue<s16, 32768 * 8> chanSampleQueues[PSP_AUDIO_CHANNEL_MAX + 1];
// The extra channel is for SRC/Output2/Vaudio.
AudioChannel chans[PSP_AUDIO_CHANNEL_MAX + 1];
void AudioChannel::DoState(PointerWrap &p)
{
auto s = p.Section("AudioChannel", 1, 2);
@ -76,18 +79,11 @@ void AudioChannel::clear()
waitingThreads.clear();
}
// 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 an extra channel after the 8 channels, since they can be used concurrently.
// The extra channel is for SRC/Output2/Vaudio.
AudioChannel chans[PSP_AUDIO_CHANNEL_MAX + 1];
// Enqueues the buffer pointer on the channel. If channel buffer queue is full (2 items?) will block until it isn't.
// For solid audio output we'll need a queue length of 2 buffers at least, we'll try that first.
// Enqueues the buffer pointed to on the channel. If channel buffer queue is full (2 items?) will block until it isn't.
// For solid audio output we'll need a queue length of 2 buffers at least.
// Not sure about the range of volume, I often see 0x800 so that might be either
// max or 50%?
static u32 sceAudioOutputBlocking(u32 chan, int vol, u32 samplePtr) {
if (vol > 0xFFFF) {
ERROR_LOG(SCEAUDIO, "sceAudioOutputBlocking() - invalid volume");

View File

@ -47,27 +47,21 @@ const int PSP_AUDIO_CHANNEL_SRC = 8;
const int PSP_AUDIO_CHANNEL_OUTPUT2 = 8;
const int PSP_AUDIO_CHANNEL_VAUDIO = 8;
struct AudioChannelWaitInfo
{
struct AudioChannelWaitInfo {
SceUID threadID;
int numSamples;
};
struct AudioChannel
{
AudioChannel() {
clear();
}
struct AudioChannel {
int index = 0;
bool reserved = false;
// last sample address
u32 sampleAddress;
u32 sampleCount; // Number of samples written in each OutputBlocking
u32 leftVolume;
u32 rightVolume;
u32 format;
u32 sampleAddress = 0;
u32 sampleCount = 0; // Number of samples written in each OutputBlocking
u32 leftVolume = 0;
u32 rightVolume = 0;
u32 format = 0;
std::vector<AudioChannelWaitInfo> waitingThreads;