From ea76e82c18731fbf6e0aa2f75e8b8e1630a98c8d Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 5 Nov 2023 21:19:06 +0400 Subject: [PATCH] Addedd std:: were ever needed --- src/Renderers/ofx2DCanvas.cpp | 2 +- src/Renderers/ofxSlidersGrid.cpp | 2 +- src/SoundObjects/VUMeter.cpp | 16 ++++++++-------- src/ofxMultiSoundPlayer.cpp | 6 +++--- src/ofxMultiSoundPlayer.h | 2 +- src/ofxSingleSoundPlayer.cpp | 14 +++++++------- src/ofxSingleSoundPlayer.h | 22 +++++++++++----------- src/ofxSoundMatrixMixer.cpp | 2 +- src/ofxSoundMatrixMixer.h | 2 +- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/Renderers/ofx2DCanvas.cpp b/src/Renderers/ofx2DCanvas.cpp index 2b52d8b..43c7e71 100644 --- a/src/Renderers/ofx2DCanvas.cpp +++ b/src/Renderers/ofx2DCanvas.cpp @@ -51,7 +51,7 @@ string ofx2DCanvas::getDebugInfo(){ ss << "pressPos" << pressPos << "\n"; ss << "cam pos: " << cam.getPosition() << "\n"; ss << "cam scale: " << cam.getScale() << "\n"; - ss << "bTranslate: " << boolalpha << bTranslate << "\n"; + ss << "bTranslate: " << std::boolalpha << bTranslate << "\n"; ss << "viewport: " << viewport << "\n"; ss << "canvasConstraint: " << canvasConstraint << "\n"; diff --git a/src/Renderers/ofxSlidersGrid.cpp b/src/Renderers/ofxSlidersGrid.cpp index 6aa1cae..95cd673 100644 --- a/src/Renderers/ofxSlidersGrid.cpp +++ b/src/Renderers/ofxSlidersGrid.cpp @@ -209,7 +209,7 @@ void ofxSlidersGrid::setGridSize(size_t _x, size_t _y){ parameters[y].clear(); parameters[y].resize(xSize); for(size_t x = 0; x < parameters[y].size(); x++){ - parameters[y][x] = make_unique(); + parameters[y][x] = std::make_unique(); } } buildMeshes(); diff --git a/src/SoundObjects/VUMeter.cpp b/src/SoundObjects/VUMeter.cpp index fe6334c..84008fe 100644 --- a/src/SoundObjects/VUMeter.cpp +++ b/src/SoundObjects/VUMeter.cpp @@ -245,41 +245,41 @@ float VUMeter::getPeakForChannel(size_t channel) const{ } //-------------------------------------------------------------- ofColor& VUMeter::getRmsColor(){ - static std::unique_ptr i = make_unique(150); + static std::unique_ptr i = std::make_unique(150); return *i; } //-------------------------------------------------------------- ofColor& VUMeter::getPeakColor(){ - static std::unique_ptr i = make_unique(ofColor::yellow); + static std::unique_ptr i = std::make_unique(ofColor::yellow); return *i; } //-------------------------------------------------------------- ofColor& VUMeter::getPeakHoldColor(){ - static std::unique_ptr i = make_unique(ofColor::white); + static std::unique_ptr i = std::make_unique(ofColor::white); return *i; } //-------------------------------------------------------------- ofColor& VUMeter::getBorderColor(){ - static std::unique_ptr i = make_unique(70); + static std::unique_ptr i = std:: make_unique(70); return *i; } //-------------------------------------------------------------- ofColor& VUMeter::getClippingColor(){ - static std::unique_ptr i = make_unique(ofColor::red); + static std::unique_ptr i = std::make_unique(ofColor::red); return *i; } //-------------------------------------------------------------- uint64_t& VUMeter::getPeakHoldTime(){ - static std::unique_ptr i = make_unique(5000); + static std::unique_ptr i = std::make_unique(5000); return *i; } //-------------------------------------------------------------- uint64_t& VUMeter::getPeakReleaseTime(){ - static std::unique_ptr i = make_unique(1000); + static std::unique_ptr i = std::make_unique(1000); return *i; } //-------------------------------------------------------------- bool& VUMeter::getForceRebuild(){ - static std::unique_ptr i = make_unique(false); + static std::unique_ptr i = std::make_unique(false); return *i; } diff --git a/src/ofxMultiSoundPlayer.cpp b/src/ofxMultiSoundPlayer.cpp index 5f8c4aa..c3d2198 100755 --- a/src/ofxMultiSoundPlayer.cpp +++ b/src/ofxMultiSoundPlayer.cpp @@ -41,14 +41,14 @@ bool ofxMultiSoundPlayer::loadAsync(std::filesystem::path filePath, bool bAutopl setNumInstances(1); bool ret = instances[0]->loadAsync(filePath, bAutoplay); - ofLogVerbose("ofxMultiSoundPlayer::loadAsync" ) << filePath << " success: " << boolalpha << ret; + ofLogVerbose("ofxMultiSoundPlayer::loadAsync" ) << filePath << " success: " << std::boolalpha << ret; return ret; } //-------------------------------------------------------------- bool ofxMultiSoundPlayer::load(std::filesystem::path filePath, bool _stream){ setNumInstances(1); bool ret = instances[0]->load(filePath, _stream); - ofLogVerbose("ofxMultiSoundPlayer::load" ) << filePath << " success: " << boolalpha << ret; + ofLogVerbose("ofxMultiSoundPlayer::load" ) << filePath << " success: " << std::boolalpha << ret; return ret; } //-------------------------------------------------------------- @@ -206,7 +206,7 @@ void ofxMultiSoundPlayer::setNumInstances(const size_t & num){ /// the instances will get automatically disconnected from the mixer upon their destruction. instances.resize(num); for(size_t i = prevSize; i < instances.size(); i++){ - instances[i] = make_unique(); + instances[i] = std::make_unique(); instances[i]->setId(i); instances[i]->setLoop(bDefaultlLooping); instances[i]->connectTo(_mixer); diff --git a/src/ofxMultiSoundPlayer.h b/src/ofxMultiSoundPlayer.h index 70dfce7..6100b96 100755 --- a/src/ofxMultiSoundPlayer.h +++ b/src/ofxMultiSoundPlayer.h @@ -101,7 +101,7 @@ class ofxMultiSoundPlayer: public ofxBaseSoundPlayer { private: - vector> instances; + vector> instances; diff --git a/src/ofxSingleSoundPlayer.cpp b/src/ofxSingleSoundPlayer.cpp index bca5846..c2461ef 100644 --- a/src/ofxSingleSoundPlayer.cpp +++ b/src/ofxSingleSoundPlayer.cpp @@ -17,9 +17,9 @@ ofSoundBuffer ofxSingleSoundPlayer::_dummyBuffer = ofSoundBuffer(); ofxSoundFile ofxSingleSoundPlayer::_dummySoundFile = {}; size_t makeUniqueId(){ - static unique_ptr count; + static std::unique_ptr count; if(!count){ - count = make_unique(0); + count = std::make_unique(0); } (*count.get())++; return *count.get(); @@ -329,7 +329,7 @@ void ofxSingleSoundPlayer::audioOut(ofSoundBuffer& outputBuffer){ else { #ifdef USE_OFX_SAMPLE_RATE if(sampleRateConverter == nullptr){ - sampleRateConverter = make_unique() ; + sampleRateConverter = std::make_unique() ; } auto resamplingResults = sampleRateConverter->changeSpeed(sourceBuffer, outputBuffer, relativeSpeed.load(), position,loop); nFrames = resamplingResults.inputFramesUsed; @@ -452,7 +452,7 @@ bool ofxSingleSoundPlayer::preprocessBuffer(){ bNeedsPreprocessBuffer = true; if(isLoaded() && !bNeedsRelativeSpeedUpdate && outputSampleRate != 0 && sourceSampleRate != 0){ setState(RESAMPLING); - preprocessedBuffer = make_unique(); + preprocessedBuffer = std::make_unique(); if(buffer != nullptr){ (*preprocessedBuffer) = (*buffer); @@ -678,7 +678,7 @@ void ofxSingleSoundPlayer::_makeSoundFile(){ //-------------------------------------------------------------- void ofxSingleSoundPlayer::_makeSoundBuffer(){ if(!buffer){ - buffer = make_unique(); + buffer = std::make_unique(); } } @@ -699,12 +699,12 @@ std::string ofxSingleSoundPlayer::getPlaybackInfo() const { stringstream ss; ss << "Position: " << getPosition() << endl; ss << "PositionMS: " << getPositionMS() << endl; - ss << "Playing: " << boolalpha << isPlaying() << endl; + ss << "Playing: " << std::boolalpha << isPlaying() << endl; ss << "Speed: " << getSpeed() << endl; ss << "Rel. Speed: " << getRelativeSpeed() << endl; ss << "Pan: " << getPan() << endl; ss << "Volume: " << getVolume() << endl; - ss << "IsLooping: " << boolalpha << isLooping() << endl; + ss << "IsLooping: " << std::boolalpha << isLooping() << endl; return ss.str(); diff --git a/src/ofxSingleSoundPlayer.h b/src/ofxSingleSoundPlayer.h index ba6ee24..2381f25 100644 --- a/src/ofxSingleSoundPlayer.h +++ b/src/ofxSingleSoundPlayer.h @@ -191,8 +191,8 @@ class ofxSingleSoundPlayer: public ofxBaseSoundPlayer { size_t id = 0; - atomic bNeedsFade = {false}; - atomic bFadeIn = {true}; + std::atomic bNeedsFade = {false}; + std::atomic bFadeIn = {true}; enum State{ UNLOADED = 0, @@ -219,11 +219,11 @@ class ofxSingleSoundPlayer: public ofxBaseSoundPlayer { - atomic sourceSampleRate; - atomic sourceNumFrames; - atomic sourceNumChannels; + std::atomic sourceSampleRate; + std::atomic sourceNumFrames; + std::atomic sourceNumChannels; size_t sourceDuration; - atomic outputSampleRate; + std::atomic outputSampleRate; std::atomic bIsPlaying; @@ -235,14 +235,14 @@ class ofxSingleSoundPlayer: public ofxBaseSoundPlayer { std::atomic volumeLeft, volumeRight; void updateRelativeSpeed(); - atomic bNeedsRelativeSpeedUpdate; + std::atomic bNeedsRelativeSpeedUpdate; void volumeChanged(float&); - unique_ptr buffer = nullptr; - unique_ptr preprocessedBuffer = nullptr; - shared_ptr soundFile = nullptr; + std::unique_ptr buffer = nullptr; + std::unique_ptr preprocessedBuffer = nullptr; + std::shared_ptr soundFile = nullptr; std::atomic bStreaming; @@ -272,7 +272,7 @@ class ofxSingleSoundPlayer: public ofxBaseSoundPlayer { size_t _id = 0; #ifdef USE_OFX_SAMPLE_RATE - unique_ptr sampleRateConverter = nullptr; + std::unique_ptr sampleRateConverter = nullptr; #endif }; diff --git a/src/ofxSoundMatrixMixer.cpp b/src/ofxSoundMatrixMixer.cpp index b1b72a6..6d75d14 100644 --- a/src/ofxSoundMatrixMixer.cpp +++ b/src/ofxSoundMatrixMixer.cpp @@ -100,7 +100,7 @@ ofxSoundMatrixMixer::ofxSoundMatrixMixer():ofxSoundObject(OFX_SOUND_OBJECT_PROCE ofParameter& ofxSoundMatrixMixer::getComputeRMSandPeak(){ static std::unique_ptr> i; if(!i){ - i = make_unique>(); + i = std::make_unique>(); i->set("Compute RMS / Peak", true); } return *i; diff --git a/src/ofxSoundMatrixMixer.h b/src/ofxSoundMatrixMixer.h index f80a594..7541aa9 100644 --- a/src/ofxSoundMatrixMixer.h +++ b/src/ofxSoundMatrixMixer.h @@ -213,7 +213,7 @@ class ofxSoundMatrixMixer: public ofxSoundObject{ #endif - atomic defaultOutputVol = {0.0f}; + std::atomic defaultOutputVol = {0.0f}; private: