service/dsp: Addressed comments about function name and pointer type

This commit is contained in:
NarcolepticK 2018-07-29 14:26:41 -04:00
parent b840c63386
commit 8f70e9a318
4 changed files with 14 additions and 13 deletions

View File

@ -67,7 +67,7 @@ public:
virtual std::array<u8, Memory::DSP_RAM_SIZE>& GetDspMemory() = 0; virtual std::array<u8, Memory::DSP_RAM_SIZE>& GetDspMemory() = 0;
/// Sets the dsp class that we trigger interrupts for /// Sets the dsp class that we trigger interrupts for
virtual void SetDspToInterrupt(std::shared_ptr<Service::DSP::DSP_DSP> dsp) = 0; virtual void SetServiceToInterrupt(std::weak_ptr<Service::DSP::DSP_DSP> dsp) = 0;
/// Select the sink to use based on sink id. /// Select the sink to use based on sink id.
void SetSink(const std::string& sink_id, const std::string& audio_device); void SetSink(const std::string& sink_id, const std::string& audio_device);

View File

@ -34,7 +34,7 @@ public:
std::array<u8, Memory::DSP_RAM_SIZE>& GetDspMemory(); std::array<u8, Memory::DSP_RAM_SIZE>& GetDspMemory();
void SetDspToInterrupt(std::shared_ptr<DSP_DSP> dsp); void SetServiceToInterrupt(std::weak_ptr<DSP_DSP> dsp);
private: private:
void ResetPipes(); void ResetPipes();
@ -65,7 +65,7 @@ private:
DspHle& parent; DspHle& parent;
CoreTiming::EventType* tick_event; CoreTiming::EventType* tick_event;
std::shared_ptr<DSP_DSP> dsp_dsp; std::weak_ptr<DSP_DSP> dsp_dsp;
}; };
DspHle::Impl::Impl(DspHle& parent_) : parent(parent_) { DspHle::Impl::Impl(DspHle& parent_) : parent(parent_) {
@ -193,7 +193,7 @@ std::array<u8, Memory::DSP_RAM_SIZE>& DspHle::Impl::GetDspMemory() {
return dsp_memory.raw_memory; return dsp_memory.raw_memory;
} }
void DspHle::Impl::SetDspToInterrupt(std::shared_ptr<DSP_DSP> dsp) { void DspHle::Impl::SetServiceToInterrupt(std::weak_ptr<DSP_DSP> dsp) {
dsp_dsp = std::move(dsp); dsp_dsp = std::move(dsp);
} }
@ -241,8 +241,9 @@ void DspHle::Impl::AudioPipeWriteStructAddresses() {
WriteU16(DspPipe::Audio, addr); WriteU16(DspPipe::Audio, addr);
} }
// Signal that we have data on this pipe. // Signal that we have data on this pipe.
if (dsp_dsp) if (auto service = dsp_dsp.lock()) {
dsp_dsp->SignalInterrupt(InterruptType::Pipe, DspPipe::Audio); service->SignalInterrupt(InterruptType::Pipe, DspPipe::Audio);
}
} }
size_t DspHle::Impl::CurrentRegionIndex() const { size_t DspHle::Impl::CurrentRegionIndex() const {
@ -318,10 +319,10 @@ bool DspHle::Impl::Tick() {
void DspHle::Impl::AudioTickCallback(int cycles_late) { void DspHle::Impl::AudioTickCallback(int cycles_late) {
if (Tick()) { if (Tick()) {
// TODO(merry): Signal all the other interrupts as appropriate. // TODO(merry): Signal all the other interrupts as appropriate.
if (dsp_dsp) { if (auto service = dsp_dsp.lock()) {
dsp_dsp->SignalInterrupt(InterruptType::Pipe, DspPipe::Audio); service->SignalInterrupt(InterruptType::Pipe, DspPipe::Audio);
// HACK(merry): Added to prevent regressions. Will remove soon. // HACK(merry): Added to prevent regressions. Will remove soon.
dsp_dsp->SignalInterrupt(InterruptType::Pipe, DspPipe::Binary); service->SignalInterrupt(InterruptType::Pipe, DspPipe::Binary);
} }
} }
@ -352,8 +353,8 @@ std::array<u8, Memory::DSP_RAM_SIZE>& DspHle::GetDspMemory() {
return impl->GetDspMemory(); return impl->GetDspMemory();
} }
void DspHle::SetDspToInterrupt(std::shared_ptr<DSP_DSP> dsp) { void DspHle::SetServiceToInterrupt(std::weak_ptr<DSP_DSP> dsp) {
impl->SetDspToInterrupt(std::move(dsp)); impl->SetServiceToInterrupt(std::move(dsp));
} }
} // namespace AudioCore } // namespace AudioCore

View File

@ -28,7 +28,7 @@ public:
std::array<u8, Memory::DSP_RAM_SIZE>& GetDspMemory() override; std::array<u8, Memory::DSP_RAM_SIZE>& GetDspMemory() override;
void SetDspToInterrupt(std::shared_ptr<Service::DSP::DSP_DSP> dsp) override; void SetServiceToInterrupt(std::weak_ptr<Service::DSP::DSP_DSP> dsp) override;
private: private:
struct Impl; struct Impl;

View File

@ -403,7 +403,7 @@ DSP_DSP::~DSP_DSP() {
void InstallInterfaces(SM::ServiceManager& service_manager) { void InstallInterfaces(SM::ServiceManager& service_manager) {
auto dsp = std::make_shared<DSP_DSP>(); auto dsp = std::make_shared<DSP_DSP>();
dsp->InstallAsService(service_manager); dsp->InstallAsService(service_manager);
Core::DSP().SetDspToInterrupt(std::move(dsp)); Core::DSP().SetServiceToInterrupt(std::move(dsp));
} }
} // namespace DSP } // namespace DSP