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;
/// 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.
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();
void SetDspToInterrupt(std::shared_ptr<DSP_DSP> dsp);
void SetServiceToInterrupt(std::weak_ptr<DSP_DSP> dsp);
private:
void ResetPipes();
@ -65,7 +65,7 @@ private:
DspHle& parent;
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_) {
@ -193,7 +193,7 @@ std::array<u8, Memory::DSP_RAM_SIZE>& DspHle::Impl::GetDspMemory() {
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);
}
@ -241,8 +241,9 @@ void DspHle::Impl::AudioPipeWriteStructAddresses() {
WriteU16(DspPipe::Audio, addr);
}
// Signal that we have data on this pipe.
if (dsp_dsp)
dsp_dsp->SignalInterrupt(InterruptType::Pipe, DspPipe::Audio);
if (auto service = dsp_dsp.lock()) {
service->SignalInterrupt(InterruptType::Pipe, DspPipe::Audio);
}
}
size_t DspHle::Impl::CurrentRegionIndex() const {
@ -318,10 +319,10 @@ bool DspHle::Impl::Tick() {
void DspHle::Impl::AudioTickCallback(int cycles_late) {
if (Tick()) {
// TODO(merry): Signal all the other interrupts as appropriate.
if (dsp_dsp) {
dsp_dsp->SignalInterrupt(InterruptType::Pipe, DspPipe::Audio);
if (auto service = dsp_dsp.lock()) {
service->SignalInterrupt(InterruptType::Pipe, DspPipe::Audio);
// 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();
}
void DspHle::SetDspToInterrupt(std::shared_ptr<DSP_DSP> dsp) {
impl->SetDspToInterrupt(std::move(dsp));
void DspHle::SetServiceToInterrupt(std::weak_ptr<DSP_DSP> dsp) {
impl->SetServiceToInterrupt(std::move(dsp));
}
} // namespace AudioCore

View file

@ -28,7 +28,7 @@ public:
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:
struct Impl;

View file

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