Skip to content

Commit

Permalink
flying fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
obviousjim committed Apr 17, 2016
1 parent 121dea8 commit 5333fc5
Show file tree
Hide file tree
Showing 6 changed files with 284 additions and 230 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//
// CloudsVisualSystemFlying.cpp
//

#ifdef TONIC_SOUNDS
#include "ofxAudioDecoderTonic.h"
#endif

#include "CloudsVisualSystemFlying.h"
#include "CloudsRGBDVideoPlayer.h"
Expand All @@ -12,7 +13,9 @@
//const string CloudsVisualSystemFlying::RULES_FILES[] = { "rules/tree_flying2.xml" };
const float CloudsVisualSystemFlying::CAM_DAMPING = .08f;

#ifdef TONIC_SOUNDS
using namespace Tonic;
#endif

CloudsVisualSystemFlying::CloudsVisualSystemFlying() :
numPlantMeshes(100), floorW(2000), floorD(2000), floorHalfW(.5f * floorW), floorHalfD(.5f * floorD),
Expand All @@ -36,11 +39,12 @@ CloudsVisualSystemFlying::CloudsVisualSystemFlying() :
// geometry should be loaded here
void CloudsVisualSystemFlying::selfSetup()
{

#ifdef TONIC_SOUNDS
tonicSamples.push_back(TonicSample("SriLankaForest.mp3"));
tonicSamples.push_back(TonicSample("FOREST.mp3"));
tonicSamples.push_back(TonicSample("organ_slower.mp3"));

#endif

//MA: changed ofGetWidth() to getCanvasWidth() and ofGetHeight() to getCanvasHeight()
post.init(getCanvasWidth(), getCanvasHeight(), true);
//post.createPass<EdgePass>();
Expand Down Expand Up @@ -166,22 +170,25 @@ void CloudsVisualSystemFlying::generate()
void CloudsVisualSystemFlying::selfBegin()
{
getCameraRef().setPosition(0, 200, floorHalfD);

ofAddListener(GetCloudsAudioEvents()->diageticAudioRequested, this, &CloudsVisualSystemFlying::audioRequested);

#ifdef TONIC_SOUNDS
ofAddListener(GetCloudsAudioEvents()->diageticAudioRequested, this, &CloudsVisualSystemFlying::audioRequested);
for (int i=0; i<tonicSamples.size(); i++)
{
if (tonicSamples[i].playSample) {
tonicSamples[i].soundTrigger.trigger();
}
}
#endif
}

//normal update call
void CloudsVisualSystemFlying::selfUpdate()
{

#ifdef TONIC_SOUNDS
volumeControl.value(gain);
#endif
//MA: changed ofGetWidth() to getCanvasWidth() and ofGetHeight() to getCanvasHeight()
if (post.getWidth() != getCanvasWidth() || post.getHeight() != getCanvasHeight()) post.init(getCanvasWidth(), getCanvasHeight(), true);

Expand Down Expand Up @@ -322,6 +329,7 @@ void CloudsVisualSystemFlying::selfDraw()
void CloudsVisualSystemFlying::selfPostDraw()
{
//CloudsVisualSystem::selfPostDraw();

glPushAttrib(GL_ENABLE_BIT);
ofDisableLighting();
ofPushStyle();
Expand Down Expand Up @@ -365,10 +373,13 @@ void CloudsVisualSystemFlying::selfSetupRenderGui()
}

rdrGui->addSpacer();

#ifdef TONIC_SOUNDS
rdrGui->addToggle(tonicSamples[0].soundFile, &tonicSamples[0].playSample);
rdrGui->addToggle(tonicSamples[1].soundFile, &tonicSamples[1].playSample);
rdrGui->addToggle(tonicSamples[2].soundFile, &tonicSamples[2].playSample);
rdrGui->addSlider("Gain", 0, 1, &gain);
#endif
}

//events are called when the system is active
Expand All @@ -388,6 +399,7 @@ void CloudsVisualSystemFlying::selfKeyPressed(ofKeyEventArgs & args)

void CloudsVisualSystemFlying::guiRenderEvent(ofxUIEventArgs &e)
{
#ifdef TONIC_SOUNDS
for (int i=0; i<3; i++)
{
if (e.widget->getName() == tonicSamples[i].soundFile) {
Expand All @@ -398,6 +410,7 @@ void CloudsVisualSystemFlying::guiRenderEvent(ofxUIEventArgs &e)
}
}
}
#endif
}

// selfPresetLoaded is called whenever a new preset is triggered
Expand Down Expand Up @@ -446,8 +459,10 @@ void CloudsVisualSystemFlying::selfDrawBackground(){
// this is called when your system is no longer drawing.
// Right after this selfUpdate() and selfDraw() won't be called any more
void CloudsVisualSystemFlying::selfEnd(){
#ifdef TONIC_SOUNDS
volumeControl.value(0);
ofRemoveListener(GetCloudsAudioEvents()->diageticAudioRequested, this, &CloudsVisualSystemFlying::audioRequested);
#endif
}
// this is called when you should clear all the memory and delet anything you made in setup
void CloudsVisualSystemFlying::selfExit(){
Expand Down Expand Up @@ -495,12 +510,14 @@ Generator CloudsVisualSystemFlying::buildSynth()
}
#endif

#ifdef TONIC_SOUNDS
void CloudsVisualSystemFlying::audioRequested(ofAudioEventArgs& args)
{
#ifdef TONIC_SOUNDS
synth.fillBufferOfFloats(args.buffer, args.bufferSize, args.nChannels);
#endif
}
#endif



Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
//#include "ofxTonic.h"
#include "CloudsAudioEvents.h"
#include "CloudsGlobal.h"
#ifdef TONIC_SOUNDS
#include "TonicSample.h"
#endif

//using namespace Tonic;

Expand Down Expand Up @@ -165,10 +167,12 @@ class CloudsVisualSystemFlying : public CloudsVisualSystem
ofVboMesh simplePointcloud;*/

// Sound
#ifdef TONIC_SOUNDS
vector<TonicSample> tonicSamples;
Tonic::ofxTonicSynth synth;
Tonic::Generator buildSynth();
void audioRequested(ofAudioEventArgs& args);
Tonic::ControlParameter volumeControl;
float gain;
#endif
};
60 changes: 30 additions & 30 deletions VSFlying/VSFlying.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ofxUILib", "..\..\..\addons
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ofxTimelineLib", "..\..\..\addons\ofxTimeline\ofxTimelineLib\ofxTimelineLib.vcxproj", "{A72C4F16-CB16-4143-BA5C-5E4FA802D636}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VSFlying", "VSFlying.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ofxTonicLib", "..\..\..\addons\ofxTonic\ofxTonicLib\ofxTonicLib.vcxproj", "{E93BD96C-A459-499F-840D-29B0166CBFF7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ofxOculusDK2Lib", "..\..\..\addons\ofxOculusDK2\ofxOculusDK2Lib\ofxOculusDK2Lib.vcxproj", "{06DF4A39-7102-462B-8F20-FC26E9A93826}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VSFlying", "VSFlying.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug_Oculus|x64 = Debug_Oculus|x64
Expand All @@ -20,54 +20,54 @@ Global
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug_Oculus|x64.ActiveCfg = Debug_Oculus|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug_Oculus|x64.Build.0 = Debug_Oculus|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug_Oculus|x64.ActiveCfg = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug_Oculus|x64.Build.0 = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release_Oculus|x64.ActiveCfg = Release_Oculus|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release_Oculus|x64.Build.0 = Release_Oculus|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release_Oculus|x64.ActiveCfg = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release_Oculus|x64.Build.0 = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64
{641DB976-E775-4D72-86EB-897E2C4A0EEE}.Debug_Oculus|x64.ActiveCfg = Debug_Oculus|Win32
{641DB976-E775-4D72-86EB-897E2C4A0EEE}.Debug_Oculus|x64.Build.0 = Debug_Oculus|x64
{641DB976-E775-4D72-86EB-897E2C4A0EEE}.Debug_Oculus|x64.ActiveCfg = Debug|x64
{641DB976-E775-4D72-86EB-897E2C4A0EEE}.Debug_Oculus|x64.Build.0 = Debug|x64
{641DB976-E775-4D72-86EB-897E2C4A0EEE}.Debug|x64.ActiveCfg = Debug|x64
{641DB976-E775-4D72-86EB-897E2C4A0EEE}.Debug|x64.Build.0 = Debug|x64
{641DB976-E775-4D72-86EB-897E2C4A0EEE}.Release_Oculus|x64.ActiveCfg = Release_Oculus|Win32
{641DB976-E775-4D72-86EB-897E2C4A0EEE}.Release_Oculus|x64.Build.0 = Release_Oculus|x64
{641DB976-E775-4D72-86EB-897E2C4A0EEE}.Release_Oculus|x64.ActiveCfg = Release|x64
{641DB976-E775-4D72-86EB-897E2C4A0EEE}.Release_Oculus|x64.Build.0 = Release|x64
{641DB976-E775-4D72-86EB-897E2C4A0EEE}.Release|x64.ActiveCfg = Release|x64
{641DB976-E775-4D72-86EB-897E2C4A0EEE}.Release|x64.Build.0 = Release|x64
{A72C4F16-CB16-4143-BA5C-5E4FA802D636}.Debug_Oculus|x64.ActiveCfg = Debug_Oculus|Win32
{A72C4F16-CB16-4143-BA5C-5E4FA802D636}.Debug_Oculus|x64.Build.0 = Debug_Oculus|x64
{A72C4F16-CB16-4143-BA5C-5E4FA802D636}.Debug_Oculus|x64.ActiveCfg = Debug|x64
{A72C4F16-CB16-4143-BA5C-5E4FA802D636}.Debug_Oculus|x64.Build.0 = Debug|x64
{A72C4F16-CB16-4143-BA5C-5E4FA802D636}.Debug|x64.ActiveCfg = Debug|x64
{A72C4F16-CB16-4143-BA5C-5E4FA802D636}.Debug|x64.Build.0 = Debug|x64
{A72C4F16-CB16-4143-BA5C-5E4FA802D636}.Release_Oculus|x64.ActiveCfg = Release_Oculus|Win32
{A72C4F16-CB16-4143-BA5C-5E4FA802D636}.Release_Oculus|x64.Build.0 = Release_Oculus|x64
{A72C4F16-CB16-4143-BA5C-5E4FA802D636}.Release_Oculus|x64.ActiveCfg = Release|x64
{A72C4F16-CB16-4143-BA5C-5E4FA802D636}.Release_Oculus|x64.Build.0 = Release|x64
{A72C4F16-CB16-4143-BA5C-5E4FA802D636}.Release|x64.ActiveCfg = Release|x64
{A72C4F16-CB16-4143-BA5C-5E4FA802D636}.Release|x64.Build.0 = Release|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug_Oculus|x64.ActiveCfg = Debug_Oculus|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug_Oculus|x64.Build.0 = Debug_Oculus|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release_Oculus|x64.ActiveCfg = Release_Oculus|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release_Oculus|x64.Build.0 = Release_Oculus|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64
{E93BD96C-A459-499F-840D-29B0166CBFF7}.Debug_Oculus|x64.ActiveCfg = Debug_Oculus|Win32
{E93BD96C-A459-499F-840D-29B0166CBFF7}.Debug_Oculus|x64.Build.0 = Debug_Oculus|x64
{E93BD96C-A459-499F-840D-29B0166CBFF7}.Debug_Oculus|x64.ActiveCfg = Debug|x64
{E93BD96C-A459-499F-840D-29B0166CBFF7}.Debug_Oculus|x64.Build.0 = Debug|x64
{E93BD96C-A459-499F-840D-29B0166CBFF7}.Debug|x64.ActiveCfg = Debug|x64
{E93BD96C-A459-499F-840D-29B0166CBFF7}.Debug|x64.Build.0 = Debug|x64
{E93BD96C-A459-499F-840D-29B0166CBFF7}.Release_Oculus|x64.ActiveCfg = Release_Oculus|Win32
{E93BD96C-A459-499F-840D-29B0166CBFF7}.Release_Oculus|x64.Build.0 = Release_Oculus|x64
{E93BD96C-A459-499F-840D-29B0166CBFF7}.Release_Oculus|x64.ActiveCfg = Release|x64
{E93BD96C-A459-499F-840D-29B0166CBFF7}.Release_Oculus|x64.Build.0 = Release|x64
{E93BD96C-A459-499F-840D-29B0166CBFF7}.Release|x64.ActiveCfg = Release|x64
{E93BD96C-A459-499F-840D-29B0166CBFF7}.Release|x64.Build.0 = Release|x64
{06DF4A39-7102-462B-8F20-FC26E9A93826}.Debug_Oculus|x64.ActiveCfg = Debug_Oculus|Win32
{06DF4A39-7102-462B-8F20-FC26E9A93826}.Debug_Oculus|x64.Build.0 = Debug_Oculus|x64
{06DF4A39-7102-462B-8F20-FC26E9A93826}.Debug_Oculus|x64.ActiveCfg = Debug|x64
{06DF4A39-7102-462B-8F20-FC26E9A93826}.Debug_Oculus|x64.Build.0 = Debug|x64
{06DF4A39-7102-462B-8F20-FC26E9A93826}.Debug|x64.ActiveCfg = Debug|x64
{06DF4A39-7102-462B-8F20-FC26E9A93826}.Debug|x64.Build.0 = Debug|x64
{06DF4A39-7102-462B-8F20-FC26E9A93826}.Release_Oculus|x64.ActiveCfg = Release_Oculus|Win32
{06DF4A39-7102-462B-8F20-FC26E9A93826}.Release_Oculus|x64.Build.0 = Release_Oculus|x64
{06DF4A39-7102-462B-8F20-FC26E9A93826}.Release_Oculus|x64.ActiveCfg = Release|x64
{06DF4A39-7102-462B-8F20-FC26E9A93826}.Release_Oculus|x64.Build.0 = Release|x64
{06DF4A39-7102-462B-8F20-FC26E9A93826}.Release|x64.ActiveCfg = Release|x64
{06DF4A39-7102-462B-8F20-FC26E9A93826}.Release|x64.Build.0 = Release|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug_Oculus|x64.ActiveCfg = Debug_Oculus|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug_Oculus|x64.Build.0 = Debug_Oculus|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release_Oculus|x64.ActiveCfg = Release_Oculus|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release_Oculus|x64.Build.0 = Release_Oculus|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Loading

0 comments on commit 5333fc5

Please sign in to comment.