diff --git a/pedalboard/plugins/AddLatency.h b/pedalboard/plugins/AddLatency.h index 15df4fcc..e2101c53 100644 --- a/pedalboard/plugins/AddLatency.h +++ b/pedalboard/plugins/AddLatency.h @@ -57,7 +57,7 @@ inline void init_add_latency(py::module &m) { "Pedalboard's automatic latency compensation. Probably not useful as a " "real effect.") .def(py::init([](int samples) { - auto al = new AddLatency(); + auto al = std::make_unique(); al->getDSP().setMaximumDelayInSamples(samples); al->getDSP().setDelay(samples); return al; diff --git a/pedalboard/plugins/Chorus.h b/pedalboard/plugins/Chorus.h index aba1346d..bee74387 100644 --- a/pedalboard/plugins/Chorus.h +++ b/pedalboard/plugins/Chorus.h @@ -49,7 +49,7 @@ inline void init_chorus(py::module &m) { "lot of feedback, and as a vibrato effect if the mix value is 1.") .def(py::init([](float rateHz, float depth, float centreDelayMs, float feedback, float mix) { - auto plugin = new Chorus(); + auto plugin = std::make_unique>(); plugin->setRate(rateHz); plugin->setDepth(depth); plugin->setCentreDelay(centreDelayMs); diff --git a/pedalboard/plugins/Compressor.h b/pedalboard/plugins/Compressor.h index 75618ba4..41ccb633 100644 --- a/pedalboard/plugins/Compressor.h +++ b/pedalboard/plugins/Compressor.h @@ -42,7 +42,7 @@ inline void init_compressor(py::module &m) { "volume of loud sounds.") .def(py::init([](float thresholddB, float ratio, float attackMs, float releaseMs) { - auto plugin = new Compressor(); + auto plugin = std::make_unique>(); plugin->setThreshold(thresholddB); plugin->setRatio(ratio); plugin->setAttack(attackMs); diff --git a/pedalboard/plugins/Delay.h b/pedalboard/plugins/Delay.h index 4fe60a12..6b25162b 100644 --- a/pedalboard/plugins/Delay.h +++ b/pedalboard/plugins/Delay.h @@ -105,7 +105,7 @@ inline void init_delay(py::module &m) { "A digital delay plugin with controllable delay time, feedback " "percentage, and dry/wet mix.") .def(py::init([](float delaySeconds, float feedback, float mix) { - auto delay = new Delay(); + auto delay = std::make_unique>(); delay->setDelaySeconds(delaySeconds); delay->setFeedback(feedback); delay->setMix(mix); diff --git a/pedalboard/plugins/Distortion.h b/pedalboard/plugins/Distortion.h index 2baa0c44..9f22bc90 100644 --- a/pedalboard/plugins/Distortion.h +++ b/pedalboard/plugins/Distortion.h @@ -51,7 +51,7 @@ inline void init_distortion(py::module &m) { py::class_, Plugin>( m, "Distortion", "Apply soft distortion with a tanh waveshaper.") .def(py::init([](float drive_db) { - auto plugin = new Distortion(); + auto plugin = std::make_unique>(); plugin->setDriveDecibels(drive_db); return plugin; }), diff --git a/pedalboard/plugins/Gain.h b/pedalboard/plugins/Gain.h index d2781dd9..079fdff3 100644 --- a/pedalboard/plugins/Gain.h +++ b/pedalboard/plugins/Gain.h @@ -34,7 +34,7 @@ inline void init_gain(py::module &m) { "Increase or decrease the volume of a signal by applying a gain value " "(in decibels). No distortion or other effects are applied.") .def(py::init([](float gaindB) { - auto plugin = new Gain(); + auto plugin = std::make_unique>(); plugin->setGainDecibels(gaindB); return plugin; }), diff --git a/pedalboard/plugins/HighpassFilter.h b/pedalboard/plugins/HighpassFilter.h index 4a2f650d..6065f2e7 100644 --- a/pedalboard/plugins/HighpassFilter.h +++ b/pedalboard/plugins/HighpassFilter.h @@ -47,7 +47,7 @@ inline void init_highpass(py::module &m) { "The cutoff frequency will be attenuated by -3dB (i.e.: 0.707x as " "loud).") .def(py::init([](float cutoff_frequency_hz) { - auto plugin = new HighpassFilter(); + auto plugin = std::make_unique>(); plugin->setCutoffFrequencyHz(cutoff_frequency_hz); return plugin; }), diff --git a/pedalboard/plugins/Invert.h b/pedalboard/plugins/Invert.h index 3fa2f473..f830cae0 100644 --- a/pedalboard/plugins/Invert.h +++ b/pedalboard/plugins/Invert.h @@ -37,7 +37,7 @@ inline void init_invert(py::module &m) { py::class_, Plugin>( m, "Invert", "Flip the polarity of the signal. This effect is not audible on its own.") - .def(py::init([]() { return new Invert(); })) + .def(py::init([]() { return std::make_unique>(); })) .def("__repr__", [](const Invert &plugin) { std::ostringstream ss; ss << "(); + auto plugin = std::make_unique>(); plugin->setMode(mode); plugin->setCutoffFrequencyHz(cutoffHz); plugin->setResonance(resonance); diff --git a/pedalboard/plugins/Limiter.h b/pedalboard/plugins/Limiter.h index 703f7a51..e7229125 100644 --- a/pedalboard/plugins/Limiter.h +++ b/pedalboard/plugins/Limiter.h @@ -35,7 +35,7 @@ inline void init_limiter(py::module &m) { "A simple limiter with standard threshold and release time controls, " "featuring two compressors and a hard clipper at 0 dB.") .def(py::init([](float thresholdDb, float releaseMs) { - auto plugin = new Limiter(); + auto plugin = std::make_unique>(); plugin->setThreshold(thresholdDb); plugin->setRelease(releaseMs); return plugin; diff --git a/pedalboard/plugins/LowpassFilter.h b/pedalboard/plugins/LowpassFilter.h index dcf7c58d..d22afa14 100644 --- a/pedalboard/plugins/LowpassFilter.h +++ b/pedalboard/plugins/LowpassFilter.h @@ -47,7 +47,7 @@ inline void init_lowpass(py::module &m) { "The cutoff frequency will be attenuated by -3dB (i.e.: 0.707x as " "loud).") .def(py::init([](float cutoff_frequency_hz) { - auto plugin = new LowpassFilter(); + auto plugin = std::make_unique>(); plugin->setCutoffFrequencyHz(cutoff_frequency_hz); return plugin; }), diff --git a/pedalboard/plugins/MP3Compressor.h b/pedalboard/plugins/MP3Compressor.h index 6c640ef7..133bb8d6 100644 --- a/pedalboard/plugins/MP3Compressor.h +++ b/pedalboard/plugins/MP3Compressor.h @@ -364,7 +364,7 @@ inline void init_mp3_compressor(py::module &m) { m, "MP3Compressor", "Apply an MP3 compressor to the audio to reduce its quality.") .def(py::init([](float vbr_quality) { - auto plugin = new MP3Compressor(); + auto plugin = std::make_unique(); plugin->setVBRQuality(vbr_quality); return plugin; }), diff --git a/pedalboard/plugins/NoiseGate.h b/pedalboard/plugins/NoiseGate.h index 4b0a8565..e8492737 100644 --- a/pedalboard/plugins/NoiseGate.h +++ b/pedalboard/plugins/NoiseGate.h @@ -39,7 +39,7 @@ inline void init_noisegate(py::module &m) { "release time controls. Can be used as an expander if the ratio is low.") .def(py::init([](float thresholddB, float ratio, float attackMs, float releaseMs) { - auto plugin = new NoiseGate(); + auto plugin = std::make_unique>(); plugin->getDSP().setThreshold(thresholddB); plugin->getDSP().setRatio(ratio); plugin->getDSP().setAttack(attackMs); diff --git a/pedalboard/plugins/Phaser.h b/pedalboard/plugins/Phaser.h index becd4db7..c65226fb 100644 --- a/pedalboard/plugins/Phaser.h +++ b/pedalboard/plugins/Phaser.h @@ -43,7 +43,7 @@ inline void init_phaser(py::module &m) { "feedback control, and the centre frequency of the modulation.") .def(py::init([](float rateHz, float depth, float centreFrequency, float feedback, float mix) { - auto plugin = new Phaser(); + auto plugin = std::make_unique>(); plugin->setRate(rateHz); plugin->setDepth(depth); plugin->setCentreFrequency(centreFrequency); diff --git a/pedalboard/plugins/PitchShift.h b/pedalboard/plugins/PitchShift.h index 836c0f9e..ed97e0de 100644 --- a/pedalboard/plugins/PitchShift.h +++ b/pedalboard/plugins/PitchShift.h @@ -64,7 +64,7 @@ inline void init_pitch_shift(py::module &m) { py::class_( m, "PitchShift", "Shift pitch without affecting audio duration.") .def(py::init([](double scale) { - auto plugin = new PitchShift(); + auto plugin = std::make_unique(); plugin->setSemitones(scale); return plugin; }), diff --git a/pedalboard/plugins/Reverb.h b/pedalboard/plugins/Reverb.h index 52588b06..be735be7 100644 --- a/pedalboard/plugins/Reverb.h +++ b/pedalboard/plugins/Reverb.h @@ -84,7 +84,7 @@ inline void init_reverb(py::module &m) { "FreeVerb.") .def(py::init([](float roomSize, float damping, float wetLevel, float dryLevel, float width, float freezeMode) { - auto plugin = new Reverb(); + auto plugin = std::make_unique(); plugin->setRoomSize(roomSize); plugin->setDamping(damping); plugin->setWetLevel(wetLevel);