Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
cleanup2
Browse files Browse the repository at this point in the history
  • Loading branch information
SachinVin committed Jan 14, 2024
1 parent c51198c commit f16eac5
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <catch2/catch_template_test_macros.hpp>
#include "audio_core/hle/shared_memory.h"
#include "merry_audio/merry_audio.h"
#include "common/settings.h"

TEST_CASE_METHOD(MerryAudio::MerryAudioFixture, "AudioTest-BiquadFilter",
"[audio_core][merryhime_3ds_audio]") {
Expand All @@ -21,13 +22,19 @@ TEST_CASE_METHOD(MerryAudio::MerryAudioFixture, "AudioTest-BiquadFilter",

MerryAudio::AudioState state;
{
// The test case assumes HLE AudioCore doesn't require a valid firmware
// Uncomment the below line if the test is using LLE audio
// auto dspfirm = loadDspFirmFromFile();
std::vector<u8> dspfirm = {0};
if (!dspfirm.size()) {
SKIP("Couldn't load firmware\n");
goto end;
std::vector<u8> dspfirm;
SECTION("HLE") {
// The test case assumes HLE AudioCore doesn't require a valid firmware
InitDspCore(Settings::AudioEmulation::HLE);
dspfirm = {};
}
SECTION("LLE") {
InitDspCore(Settings::AudioEmulation::LLE);
dspfirm = loadDspFirmFromFile();
if (!dspfirm.size()) {
SKIP("Couldn't load firmware\n");
goto end;
}
}
auto ret = audioInit(dspfirm);
if (!ret) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "audio_core/hle/hle.h"
#include "audio_core/lle/lle.h"
#include "common/settings.h"
#include "service_fixture.h"

// SVC
Expand Down Expand Up @@ -108,15 +109,25 @@ void* ServiceFixture::linearAlloc(size_t size) {
}

Result ServiceFixture::dspInit() {
// dsp = std::make_unique<AudioCore::DspLle>(system, memory, core_timing, false);
dsp = std::make_unique<AudioCore::DspHle>(system, memory, core_timing);
dsp->SetInterruptHandler([this](Service::DSP::InterruptType type, AudioCore::DspPipe pipe) {
interrupts_fired[static_cast<u32>(type)][static_cast<u32>(pipe)] = 1;
});
if (!dsp) {
dsp = std::make_unique<AudioCore::DspHle>(system, memory, core_timing);
dsp->SetInterruptHandler([this](Service::DSP::InterruptType type, AudioCore::DspPipe pipe) {
interrupts_fired[static_cast<u32>(type)][static_cast<u32>(pipe)] = 1;
});
}

return ResultSuccess;
}

Result ServiceFixture::dspExit() {
dsp.reset();
return ResultSuccess;
// Fixture
void ServiceFixture::InitDspCore(Settings::AudioEmulation dsp_core) {
if (dsp_core == Settings::AudioEmulation::HLE) {
dsp = std::make_unique<AudioCore::DspHle>(system, memory, core_timing);
} else {
dsp = std::make_unique<AudioCore::DspLle>(system, memory, core_timing,
dsp_core == Settings::AudioEmulation::LLEMultithreaded);
}
dsp->SetInterruptHandler([this](Service::DSP::InterruptType type, AudioCore::DspPipe pipe) {
interrupts_fired[static_cast<u32>(type)][static_cast<u32>(pipe)] = 1;
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#include "core/hle/result.h"
#include "core/memory.h"

namespace Settings {
enum class AudioEmulation : u32;
}

class ServiceFixture {
public:
typedef int Handle;
Expand Down Expand Up @@ -61,14 +65,18 @@ class ServiceFixture {

Result dspInit();

Result dspExit();
Result dspExit() {
return ResultSuccess;
}

std::unique_ptr<AudioCore::DspInterface> dsp{};
// Selects the DPS Emulation to use with the fixture
void InitDspCore(Settings::AudioEmulation dsp_core);

private:
Core::System system{};
Memory::MemorySystem memory{system};
Core::Timing core_timing{1, 100};
std::unique_ptr<AudioCore::DspInterface> dsp{};

std::array<std::array<bool, 3>, 4> interrupts_fired = {};

Expand Down

0 comments on commit f16eac5

Please sign in to comment.