Skip to content

Commit f85fa94

Browse files
committed
some more fixes
1 parent 66e7d57 commit f85fa94

File tree

5 files changed

+53
-10
lines changed

5 files changed

+53
-10
lines changed

src/objects/audio_analysis/RMSExtractor.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ void RMSExtractor::updateObjectContent(map<int,shared_ptr<PatchObject>> &patchOb
110110

111111
//--------------------------------------------------------------
112112
void RMSExtractor::drawObjectContent(ofTrueTypeFont *font, shared_ptr<ofBaseGLRenderer>& glRenderer){
113+
unusedArgs(font,glRenderer);
114+
113115
ofSetColor(255);
114116

115117
}
@@ -139,7 +141,7 @@ void RMSExtractor::drawObjectNodeGui( ImGuiEx::NodeCanvas& _nodeCanvas ){
139141
// Visualize (Object main view)
140142
if( _nodeCanvas.BeginNodeContent(ImGuiExNodeView_Visualise) ){
141143

142-
ImGuiEx::plotValue(*(float *)&_outletParams[0], 0.f, 1.f,IM_COL32(255,255,120,255), this->scaleFactor);
144+
ImGuiEx::plotValue(*(float *)&_outletParams[0], 0.f, 100.f,IM_COL32(255,255,120,255), this->scaleFactor);
143145

144146
_nodeCanvas.EndNodeContent();
145147
}
@@ -154,7 +156,7 @@ void RMSExtractor::drawObjectNodeConfig(){
154156

155157
//--------------------------------------------------------------
156158
void RMSExtractor::removeObjectContent(bool removeFileFromData){
157-
159+
unusedArgs(removeFileFromData);
158160
}
159161

160162
OBJECT_REGISTER( RMSExtractor , "rms extractor", OFXVP_OBJECT_CAT_AUDIOANALYSIS)

src/objects/sound/SoundfilePlayer.cpp

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ SoundfilePlayer::SoundfilePlayer() : PatchObject("soundfile player"){
8989

9090
this->width *= 2;
9191

92+
loaded = false;
93+
9294
}
9395

9496
//--------------------------------------------------------------
@@ -106,6 +108,12 @@ void SoundfilePlayer::newObject(){
106108
this->addOutlet(VP_LINK_AUDIO,"audioFileSignal");
107109
this->addOutlet(VP_LINK_ARRAY,"dataBuffer");
108110
this->addOutlet(VP_LINK_NUMERIC,"finish");
111+
112+
this->setCustomVar(static_cast<float>(loop),"LOOP");
113+
this->setCustomVar(static_cast<float>(speed),"SPEED");
114+
this->setCustomVar(static_cast<float>(volume),"VOLUME");
115+
this->setCustomVar(static_cast<float>(cueIN),"CUE_IN");
116+
this->setCustomVar(static_cast<float>(cueOUT),"CUE_OUT");
109117
}
110118

111119
//--------------------------------------------------------------
@@ -229,6 +237,24 @@ void SoundfilePlayer::updateObjectContent(map<int,shared_ptr<PatchObject>> &patc
229237

230238
}
231239

240+
if(!loaded){
241+
loaded = true;
242+
243+
loop = static_cast<bool>(this->getCustomVar("LOOP"));
244+
speed = static_cast<float>(this->getCustomVar("SPEED"));
245+
volume = static_cast<float>(this->getCustomVar("VOLUME"));
246+
cueIN = static_cast<double>(this->getCustomVar("CUE_IN"));
247+
cueOUT = static_cast<double>(this->getCustomVar("CUE_OUT"));
248+
249+
if(playhead < cueIN){
250+
playhead = cueIN;
251+
}
252+
253+
if(playhead > cueOUT){
254+
playhead = cueOUT;
255+
}
256+
}
257+
232258
}
233259

234260
//--------------------------------------------------------------
@@ -371,12 +397,18 @@ void SoundfilePlayer::drawObjectNodeConfig(){
371397

372398
ImGui::Spacing();
373399
ImGui::PushItemWidth(130*scaleFactor);
374-
ImGui::SliderFloat("SPEED",&speed,-1.0f, 1.0f);
375-
ImGui::SliderFloat("VOLUME",&volume,0.0f, 1.0f);
400+
if(ImGui::SliderFloat("SPEED",&speed,-1.0f, 1.0f)){
401+
this->setCustomVar(speed,"SPEED");
402+
}
403+
if(ImGui::SliderFloat("VOLUME",&volume,0.0f, 1.0f)){
404+
this->setCustomVar(volume,"VOLUME");
405+
}
376406
ImGui::PopItemWidth();
377407
ImGui::Spacing();
378408
ImGui::Spacing();
379-
ImGui::Checkbox("LOOP " ICON_FA_REDO,&loop);
409+
if(ImGui::Checkbox("LOOP " ICON_FA_REDO,&loop)){
410+
this->setCustomVar(static_cast<float>(loop),"LOOP");
411+
}
380412

381413
ImGui::Spacing();
382414
float tempcueIN = cueIN;
@@ -385,7 +417,7 @@ void SoundfilePlayer::drawObjectNodeConfig(){
385417
if(playhead < cueIN){
386418
playhead = cueIN;
387419
}
388-
420+
this->setCustomVar(static_cast<float>(cueIN),"CUE_IN");
389421
}
390422
ImGui::Spacing();
391423
float tempcueOUT = cueOUT;
@@ -394,6 +426,7 @@ void SoundfilePlayer::drawObjectNodeConfig(){
394426
if(playhead > cueOUT){
395427
playhead = cueOUT;
396428
}
429+
this->setCustomVar(static_cast<float>(cueOUT),"CUE_OUT");
397430
}
398431

399432
ImGuiEx::ObjectInfo(

src/objects/sound/SoundfilePlayer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ class SoundfilePlayer : public PatchObject {
105105
float scaledObjW, scaledObjH;
106106
float objOriginX, objOriginY;
107107

108+
bool loaded;
109+
108110
protected:
109111

110112

src/objects/video/VideoExporter.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ void VideoExporter::setupObjectContent(shared_ptr<ofAppGLFWWindow> &mainWindow){
9292

9393
//--------------------------------------------------------------
9494
void VideoExporter::updateObjectContent(map<int,shared_ptr<PatchObject>> &patchObjects){
95+
unusedArgs(patchObjects);
9596

9697
if(this->inletsConnected[1]){
9798
if(*(float *)&_inletParams[1] < 1.0){
@@ -119,6 +120,8 @@ void VideoExporter::updateObjectContent(map<int,shared_ptr<PatchObject>> &patchO
119120

120121
//--------------------------------------------------------------
121122
void VideoExporter::drawObjectContent(ofTrueTypeFont *font, shared_ptr<ofBaseGLRenderer>& glRenderer){
123+
unusedArgs(font,glRenderer);
124+
122125
ofSetColor(255);
123126

124127
if(this->inletsConnected[0]){
@@ -324,7 +327,7 @@ void VideoExporter::drawObjectNodeConfig(){
324327

325328
//--------------------------------------------------------------
326329
void VideoExporter::removeObjectContent(bool removeFileFromData){
327-
330+
unusedArgs(removeFileFromData);
328331
}
329332

330333

src/ofxVisualProgramming.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,11 +620,14 @@ void ofxVisualProgramming::audioProcess(float *input, int bufferSize, int nChann
620620
inputBuffer.copyFrom(input, bufferSize, nChannels, audioSampleRate);
621621

622622
// compute audio input
623-
for(map<int,shared_ptr<PatchObject>>::iterator it = patchObjects.begin(); it != patchObjects.end(); it++ ){
624-
it->second->audioIn(inputBuffer);
623+
if(!inputBuffer.getBuffer().empty()){
624+
for(map<int,shared_ptr<PatchObject>>::iterator it = patchObjects.begin(); it != patchObjects.end(); it++ ){
625+
it->second->audioIn(inputBuffer);
626+
}
627+
628+
lastInputBuffer = inputBuffer;
625629
}
626630

627-
lastInputBuffer = inputBuffer;
628631
}
629632
if(audioGUIOUTChannels > 0){
630633
// compute audio output

0 commit comments

Comments
 (0)