mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Fixes and cleanup
This commit is contained in:
parent
74638ef4ae
commit
5e28df26b2
@ -19,7 +19,7 @@
|
||||
#include "sceAudio.h"
|
||||
#include "sceKernel.h"
|
||||
#include "sceKernelThread.h"
|
||||
#include "StdMutex.h"
|
||||
#include "base/mutex.h"
|
||||
#include "CommonTypes.h"
|
||||
#include "../CoreTiming.h"
|
||||
#include "../MemMap.h"
|
||||
@ -30,7 +30,7 @@
|
||||
#include "Common/Thread.h"
|
||||
|
||||
// Should be used to lock anything related to the outAudioQueue.
|
||||
std::recursive_mutex section;
|
||||
recursive_mutex section;
|
||||
|
||||
int eventAudioUpdate = -1;
|
||||
int eventHostAudioUpdate = -1;
|
||||
@ -84,9 +84,10 @@ void __AudioDoState(PointerWrap &p)
|
||||
|
||||
p.Do(mixFrequency);
|
||||
|
||||
section.lock();
|
||||
outAudioQueue.DoState(p);
|
||||
section.unlock();
|
||||
{
|
||||
lock_guard guard(section);
|
||||
outAudioQueue.DoState(p);
|
||||
}
|
||||
|
||||
int chanCount = ARRAY_SIZE(chans);
|
||||
p.Do(chanCount);
|
||||
@ -250,7 +251,7 @@ void __AudioUpdate()
|
||||
}
|
||||
|
||||
if (g_Config.bEnableSound) {
|
||||
section.lock();
|
||||
lock_guard guard(section);
|
||||
if (outAudioQueue.room() >= hwBlockSize * 2) {
|
||||
// Push the mixed samples onto the output audio queue.
|
||||
for (int i = 0; i < hwBlockSize; i++) {
|
||||
@ -265,7 +266,6 @@ void __AudioUpdate()
|
||||
// about the amount of audio we produce.
|
||||
DEBUG_LOG(HLE, "Audio outbuffer overrun! room = %i / %i", outAudioQueue.room(), (u32)outAudioQueue.capacity());
|
||||
}
|
||||
section.unlock();
|
||||
}
|
||||
|
||||
}
|
||||
@ -281,15 +281,13 @@ void __AudioSetOutputFrequency(int freq)
|
||||
int __AudioMix(short *outstereo, int numFrames)
|
||||
{
|
||||
// TODO: if mixFrequency != the actual output frequency, resample!
|
||||
|
||||
section.lock();
|
||||
lock_guard guard(section);
|
||||
int underrun = -1;
|
||||
s16 sampleL = 0;
|
||||
s16 sampleR = 0;
|
||||
bool anythingToPlay = false;
|
||||
for (int i = 0; i < numFrames; i++) {
|
||||
if (outAudioQueue.size() >= 2)
|
||||
{
|
||||
if (outAudioQueue.size() >= 2) {
|
||||
sampleL = outAudioQueue.pop_front();
|
||||
sampleR = outAudioQueue.pop_front();
|
||||
outstereo[i * 2 + 0] = sampleL;
|
||||
@ -306,6 +304,5 @@ int __AudioMix(short *outstereo, int numFrames)
|
||||
} else {
|
||||
// DEBUG_LOG(HLE, "No underrun, mixed %i samples fine", numFrames);
|
||||
}
|
||||
section.unlock();
|
||||
return underrun >= 0 ? underrun : numFrames;
|
||||
}
|
||||
|
@ -174,12 +174,14 @@ void NativeHost::ShutdownSound() {
|
||||
}
|
||||
|
||||
int NativeMix(short *audio, int num_samples) {
|
||||
// ILOG("Entering mixer");
|
||||
if (g_mixer) {
|
||||
return g_mixer->Mix(audio, num_samples);
|
||||
num_samples = g_mixer->Mix(audio, num_samples);
|
||||
} else {
|
||||
//memset(audio, 0, numSamples * 2);
|
||||
return 0;
|
||||
memset(audio, 0, num_samples * 2 * sizeof(short));
|
||||
}
|
||||
// ILOG("Leaving mixer");
|
||||
return num_samples;
|
||||
}
|
||||
|
||||
void NativeGetAppInfo(std::string *app_dir_name, std::string *app_nice_name, bool *landscape) {
|
||||
|
@ -71,11 +71,11 @@ void PluginScreen::CreateViews() {
|
||||
root_->Add(buttonBar);
|
||||
|
||||
buttonBack_ = new Button(c->T("Back"), new LinearLayoutParams(1.0));
|
||||
buttonBar->Add(buttonBack_)->OnClick.Add(std::bind(&UIScreen::OnBack, this, placeholder::_1));
|
||||
buttonBar->Add(buttonBack_)->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
||||
buttonDownload_ = new Button(c->T("Download"), new LinearLayoutParams(1.0));
|
||||
buttonDownload_->SetEnabled(false);
|
||||
buttonBar->Add(buttonDownload_)->OnClick.Add(std::bind(&PluginScreen::OnDownload, this, placeholder::_1));
|
||||
buttonBar->Add(new Button(c->T("More Information"), new LinearLayoutParams(1.0)))->OnClick.Add(std::bind(&PluginScreen::OnInformation, this, placeholder::_1));
|
||||
buttonBar->Add(buttonDownload_)->OnClick.Handle(this, &PluginScreen::OnDownload);
|
||||
buttonBar->Add(new Button(c->T("More Information"), new LinearLayoutParams(1.0)))->OnClick.Handle(this, &PluginScreen::OnInformation);
|
||||
}
|
||||
|
||||
void PluginScreen::update(InputState &input) {
|
||||
|
2
native
2
native
@ -1 +1 @@
|
||||
Subproject commit a509d38357c8ccff9efb4208957965c1aaf46e92
|
||||
Subproject commit 04f6a3503110d29aa41577a9e443a0ffd029067a
|
Loading…
Reference in New Issue
Block a user