diff --git a/pcsx2/SPU2/SndOut.cpp b/pcsx2/SPU2/SndOut.cpp index de76481c86..107fb6493e 100644 --- a/pcsx2/SPU2/SndOut.cpp +++ b/pcsx2/SPU2/SndOut.cpp @@ -49,10 +49,8 @@ StereoOut32 StereoOut16::UpSample() const class NullOutModule : public SndOutModule { public: - s32 Init() override { return 0; } + bool Init() override { return true; } void Close() override {} - s32 Test() const override { return 0; } - void Configure(uptr parent) override {} int GetEmptySampleCount() override { return 0; } const wchar_t* GetIdent() const override @@ -64,19 +62,6 @@ public: { return L"No Sound (Emulate SPU2 only)"; } - - void ReadSettings() override - { - } - - void SetApiSettings(wxString api) override - { - } - - void WriteSettings() const override - { - } - }; static NullOutModule s_NullOut; @@ -410,7 +395,7 @@ void SndBuffer::Init() soundtouchInit(); // initializes the timestretching // initialize module - if (mods[OutputModule]->Init() == -1) + if (!mods[OutputModule]->Init()) _InitFail(); } @@ -506,11 +491,3 @@ void SndBuffer::Write(const StereoOut32& Sample) _WriteSamples(sndTempBuffer, SndOutPacketSize); } } - -s32 SndBuffer::Test() -{ - if (mods[OutputModule] == nullptr) - return -1; - - return mods[OutputModule]->Test(); -} diff --git a/pcsx2/SPU2/SndOut.h b/pcsx2/SPU2/SndOut.h index 09377b765e..d0bc3ac8b1 100644 --- a/pcsx2/SPU2/SndOut.h +++ b/pcsx2/SPU2/SndOut.h @@ -617,7 +617,6 @@ public: static void Init(); static void Cleanup(); static void Write(const StereoOut32& Sample); - static s32 Test(); static void ClearContents(); // Note: When using with 32 bit output buffers, the user of this function is responsible @@ -642,21 +641,8 @@ public: // (for use in configuration screen) virtual const wchar_t* GetLongName() const = 0; - virtual s32 Init() = 0; + virtual bool Init() = 0; virtual void Close() = 0; - virtual s32 Test() const = 0; - - // Gui function: Used to open the configuration box for this driver. - virtual void Configure(uptr parent) = 0; - - // Loads settings from the INI file for this driver - virtual void ReadSettings() = 0; - - // Set output API for this driver - virtual void SetApiSettings(wxString api) = 0; - - // Saves settings to the INI file for this driver - virtual void WriteSettings() const = 0; // Returns the number of empty samples in the output buffer. // (which is effectively the amount of data played since the last update) diff --git a/pcsx2/SPU2/SndOut_Cubeb.cpp b/pcsx2/SPU2/SndOut_Cubeb.cpp index 7069976402..51681b3719 100644 --- a/pcsx2/SPU2/SndOut_Cubeb.cpp +++ b/pcsx2/SPU2/SndOut_Cubeb.cpp @@ -134,7 +134,7 @@ public: DestroyContextAndStream(); } - s32 Init() override + bool Init() override { ReadSettings(); @@ -145,8 +145,8 @@ public: m_COMInitializedByUs = SUCCEEDED(hr); if (FAILED(hr) && hr != RPC_E_CHANGED_MODE) { - Console.Error("Failed to initialize COM"); - return -1; + Console.Error("(Cubeb) Failed to initialize COM"); + return false; } #endif @@ -157,8 +157,8 @@ public: int rv = cubeb_init(&m_context, "PCSX2", m_Backend.empty() ? nullptr : m_Backend.c_str()); if (rv != CUBEB_OK) { - Console.Error("Could not initialize cubeb context: %d", rv); - return -1; + Console.Error("(Cubeb) Could not initialize cubeb context: %d", rv); + return false; } switch (numSpeakers) // speakers = (numSpeakers + 1) *2; ? @@ -255,9 +255,9 @@ public: { if (rv != CUBEB_OK) { - Console.Error("Could not get minimum latency: %d", rv); + Console.Error("(Cubeb) Could not get minimum latency: %d", rv); DestroyContextAndStream(); - return -1; + return false; } const float minimum_latency_ms = static_cast(latency_frames * 1000u) / static_cast(SampleRate); @@ -283,20 +283,20 @@ public: latency_frames, &Cubeb::DataCallback, &Cubeb::StateCallback, this); if (rv != CUBEB_OK) { - Console.Error("Could not create stream: %d", rv); + Console.Error("(Cubeb) Could not create stream: %d", rv); DestroyContextAndStream(); - return -1; + return false; } rv = cubeb_stream_start(stream); if (rv != CUBEB_OK) { - Console.Error("Could not start stream: %d", rv); + Console.Error("(Cubeb) Could not start stream: %d", rv); DestroyContextAndStream(); - return -1; + return false; } - return 0; + return true; } void Close() override @@ -314,16 +314,6 @@ public: return nframes; } - - void Configure(uptr parent) override - { - } - - s32 Test() const override - { - return 0; - } - int GetEmptySampleCount() override { u64 pos; @@ -346,7 +336,7 @@ public: return L"Cubeb (Cross-platform)"; } - void ReadSettings() override + void ReadSettings() { m_SuggestedLatencyMinimal = CfgReadBool(L"Cubeb", L"MinimalSuggestedLatency", false); m_SuggestedLatencyMS = std::clamp(CfgReadInt(L"Cubeb", L"ManualSuggestedLatencyMS", MINIMUM_LATENCY_MS), MINIMUM_LATENCY_MS, MAXIMUM_LATENCY_MS); @@ -356,14 +346,6 @@ public: CfgReadStr(L"Cubeb", L"BackendName", backend, L""); m_Backend = StringUtil::wxStringToUTF8String(backend); } - - void SetApiSettings(wxString api) override - { - } - - void WriteSettings() const override - { - } }; static Cubeb s_Cubeb; diff --git a/pcsx2/SPU2/Windows/SndOut_XAudio2.cpp b/pcsx2/SPU2/Windows/SndOut_XAudio2.cpp index 2eb14e60bd..b8d413351d 100644 --- a/pcsx2/SPU2/Windows/SndOut_XAudio2.cpp +++ b/pcsx2/SPU2/Windows/SndOut_XAudio2.cpp @@ -218,7 +218,7 @@ private: std::unique_ptr m_voiceContext; public: - s32 Init() override + bool Init() override { xaudio2CoInitialize = wil::CoInitializeEx_failfast(COINIT_MULTITHREADED); @@ -321,10 +321,10 @@ public: { SysMessage(ex.what()); Close(); - return -1; + return false; } - return 0; + return true; } void Close() override @@ -342,15 +342,6 @@ public: xaudio2CoInitialize.reset(); } - void Configure(uptr parent) override - { - } - - s32 Test() const override - { - return 0; - } - int GetEmptySampleCount() override { if (m_voiceContext == nullptr) @@ -368,18 +359,6 @@ public: return L"XAudio 2 (Recommended)"; } - void ReadSettings() override - { - } - - void SetApiSettings(wxString api) override - { - } - - void WriteSettings() const override - { - } - } static XA2; SndOutModule* XAudio2Out = &XA2;