Skip to content

Commit

Permalink
Moved OSC objects in App to protected section so they can be accessed…
Browse files Browse the repository at this point in the history
… by subclasses. Made allosphere app connect to device server by default.
  • Loading branch information
AlloLab committed Jun 3, 2016
1 parent 10d0c19 commit 781c7d6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
6 changes: 4 additions & 2 deletions allocore/allocore/io/al_App.hpp
Expand Up @@ -355,6 +355,10 @@ class App {
// i.e. use mouse xy
Rayd getPickRay(const ViewpointWindow& w, int screenX, int screenY);

protected:
osc::Recv mOSCRecv;
osc::Send mOSCSend;

private:

typedef std::vector<Viewpoint *> Viewpoints;
Expand All @@ -379,8 +383,6 @@ class App {

// control
NavInputControl mNavControl;
osc::Recv mOSCRecv;
osc::Send mOSCSend;

std::string mName;
void * mClockAnimate;
Expand Down
4 changes: 3 additions & 1 deletion allocore/src/io/al_App.cpp
Expand Up @@ -231,7 +231,9 @@ bool SceneWindowHandler::onFrame(){
App::App()
: mName(""),
mNavControl(mNav),
mClockAnimate(0), mClockNav(0)
mClockAnimate(0), mClockNav(0),
mOSCRecv(12001, "", 0.001),
mOSCSend(12000, "bossanova.mat.ucsb.edu", 0)
{}


Expand Down
12 changes: 9 additions & 3 deletions allosphere/allosphere/al_AlloSphereApp.hpp
Expand Up @@ -128,17 +128,17 @@ class AudioRendererBase : public AudioRendererBaseNoState {
template<typename State = DummyState, typename AudioState = DummyState,
unsigned GRAPHICSPORT = ALLOAPP_GRAPHICS_PORT,
unsigned AUDIOPORT = ALLOAPP_AUDIO_PORT>
class SimulatorBase : public App {
class SimulatorBase : public App, public osc::PacketHandler {
public:
explicit SimulatorBase(const Window::Dim& dims = Window::Dim(320, 240),
const std::string title="",
double fps=60,
Window::DisplayMode mode = Window::DEFAULT_BUF,
int flags=0,
const char *broadcastIP = "127.0.0.1") :
const char *broadcastIP = "127.0.0.1") :
mDims(dims), mTitle(title), mFps(fps), mMode(mode), mFlags(flags),
mMakerAudio(broadcastIP),
mMakerGraphics(broadcastIP)
mMakerGraphics(broadcastIP)
{
mMakerGraphics.start();
mMakerAudio.start();
Expand All @@ -157,6 +157,12 @@ class SimulatorBase : public App {
///
virtual void onAnimate(double dt) override{}

///
/// \brief onMessage will recieve the messages from Device Server
/// \param m
///
virtual void onMessage(osc::Message &m) override {};

///
/// \brief Send the state to the graphics renderers
///
Expand Down

0 comments on commit 781c7d6

Please sign in to comment.