diff --git a/src/pcm/PcmDsd.cxx b/src/pcm/PcmDsd.cxx index e742ed1fa..7348c5f61 100644 --- a/src/pcm/PcmDsd.cxx +++ b/src/pcm/PcmDsd.cxx @@ -23,23 +23,11 @@ #include -PcmDsd::PcmDsd() noexcept -{ - dsd2pcm.fill(nullptr); -} - -PcmDsd::~PcmDsd() noexcept -{ - for (auto i : dsd2pcm) - delete i; -} - void PcmDsd::Reset() noexcept { - for (auto i : dsd2pcm) - if (i != nullptr) - i->Reset(); + for (auto &i : dsd2pcm) + i.Reset(); } ConstBuffer @@ -56,12 +44,9 @@ PcmDsd::ToFloat(unsigned channels, ConstBuffer src) noexcept float *dest = buffer.GetT(num_samples); for (unsigned c = 0; c < channels; ++c) { - if (dsd2pcm[c] == nullptr) - dsd2pcm[c] = new Dsd2Pcm(); - - dsd2pcm[c]->Translate(num_frames, - src.data + c, channels, - dest + c, channels); + dsd2pcm[c].Translate(num_frames, + src.data + c, channels, + dest + c, channels); } return { dest, num_samples }; diff --git a/src/pcm/PcmDsd.hxx b/src/pcm/PcmDsd.hxx index cf6365297..6b36944b1 100644 --- a/src/pcm/PcmDsd.hxx +++ b/src/pcm/PcmDsd.hxx @@ -22,13 +22,13 @@ #include "Buffer.hxx" #include "ChannelDefs.hxx" +#include "Dsd2Pcm.hxx" #include #include template struct ConstBuffer; -class Dsd2Pcm; /** * Wrapper for the dsd2pcm library. @@ -36,12 +36,9 @@ class Dsd2Pcm; class PcmDsd { PcmBuffer buffer; - std::array dsd2pcm; + std::array dsd2pcm; public: - PcmDsd() noexcept; - ~PcmDsd() noexcept; - void Reset() noexcept; ConstBuffer ToFloat(unsigned channels,