Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Van Ta committed May 29, 2013
0 parents commit 5a536da
Show file tree
Hide file tree
Showing 8 changed files with 1,134 additions and 0 deletions.
899 changes: 899 additions & 0 deletions PS3toSyphon.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions Project.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT.
//THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED
OF_PATH = ../../..

//THIS HAS ALL THE HEADER AND LIBS FOR OF CORE
#include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig"

OTHER_LDFLAGS = $(OF_CORE_LIBS)
HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS)
3 changes: 3 additions & 0 deletions addons.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ofxGui
ofxMacamPs3Eye
ofxXmlSettings
11 changes: 11 additions & 0 deletions bin/data/ps3eye.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Auto_Gain_ />
<Auto_Gain_ />
<Auto_Gain_&_Shutter>0</Auto_Gain_&_Shutter>
<Gain>0.865</Gain>
<Shutter>0.5</Shutter>
<Gamma>0.5</Gamma>
<Brightness>0.5</Brightness>
<Contrast>0.5</Contrast>
<Hue>0.5</Hue>
<LED>1</LED>
<Flicker>0</Flicker>
20 changes: 20 additions & 0 deletions openFrameworks-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.thomasvanta.openFrameworks</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
</dict>
</plist>
16 changes: 16 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "ofMain.h"
#include "testApp.h"
#include "ofAppGlutWindow.h"

//========================================================================
int main( ){

ofAppGlutWindow window;
ofSetupOpenGL(&window, 640,480, OF_WINDOW); // <-------- setup the GL context

// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp( new testApp());

}
146 changes: 146 additions & 0 deletions src/testApp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#include "testApp.h"

//--------------------------------------------------------------
void testApp::setup(){
ofSetVerticalSync(true);
ofSetWindowShape(640, 480);

ps3eye.initGrabber(640, 480);

ofSetWindowTitle("PS3 to Syphon");

mainOutputSyphonServer.setName("PS3");

gui.setup("PS3Eye");
gui.setPosition(20,40);

ofxToggle * autoGainAndShutter = new ofxToggle("Auto Gain & Shutter", false);
autoGainAndShutter->addListener(this, &testApp::onAutoGainAndShutterChange);
gui.add(autoGainAndShutter);

ofxFloatSlider * gain = new ofxFloatSlider("Gain", 0.5, 0.0, 1.0);
gain->addListener(this, &testApp::onGainChange);
gui.add(gain);

ofxFloatSlider * shutter = new ofxFloatSlider("Shutter", 0.5, 0.0, 1.0);
shutter->addListener(this, &testApp::onShutterChange);
gui.add(shutter);

ofxFloatSlider * gamma = new ofxFloatSlider("Gamma", 0.5, 0.0, 1.0);
gamma->addListener(this, &testApp::onGammaChange);
gui.add(gamma);

ofxFloatSlider * brightness = new ofxFloatSlider("Brightness", 0.5, 0.0, 1.0);
brightness->addListener(this, &testApp::onBrightnessChange);
gui.add(brightness);

ofxFloatSlider * contrast = new ofxFloatSlider("Contrast", 0.5, 0.0, 1.0);
contrast->addListener(this, &testApp::onContrastChange);
gui.add(contrast);

ofxFloatSlider * hue = new ofxFloatSlider("Hue", 0.5, 0.0, 1.0);
hue->addListener(this, &testApp::onHueChange);
gui.add(hue);

ofxIntSlider * flicker = new ofxIntSlider("Flicker Type", 0, 0, 2);
flicker->addListener(this, &testApp::onFlickerChange);
gui.add(flicker);

ofxIntSlider * wb = new ofxIntSlider("White Balance Mode", 4, 1, 4);
wb->addListener(this, &testApp::onFlickerChange);
gui.add(wb);

ofxToggle * led = new ofxToggle("LED", true);
led->addListener(this, &testApp::onLedChange);
gui.add(led);

// Load initial values
onAutoGainAndShutterChange(gui.getToggle("Auto Gain & Shutter"));
onGainChange(gui.getFloatSlider("Gain"));
onShutterChange(gui.getFloatSlider("Shutter"));
onGammaChange(gui.getFloatSlider("Gamma"));
onBrightnessChange(gui.getFloatSlider("Brightness"));
onContrastChange(gui.getFloatSlider("Contrast"));
onHueChange(gui.getFloatSlider("Hue"));
onLedChange(gui.getToggle("LED"));
onFlickerChange(gui.getIntSlider("Flicker"));
onWhiteBalanceChange(gui.getIntSlider("White Balance"));


}

//--------------------------------------------------------------
void testApp::update(){
ps3eye.update();
}

//--------------------------------------------------------------
void testApp::draw(){
ps3eye.draw(0, 0);

// Syphon Stuff
ofPushStyle();
ofSetColor(255, 255, 255);
ofEnableAlphaBlending();
mainOutputSyphonServer.publishScreen();
ofPopStyle();

ofDrawBitmapString("FPS "+ofToString(ps3eye.getRealFrameRate()), 20, 20);
gui.draw();
}

//--------------------------------------------------------------
void testApp::onAutoGainAndShutterChange(bool & value){
ps3eye.setAutoGainAndShutter(value);
}

//--------------------------------------------------------------
void testApp::onGainChange(float & value){
// Only set if auto gain & shutter is off
if(!gui.getToggle("Auto Gain & Shutter")){
ps3eye.setGain(value);
}
}

//--------------------------------------------------------------
void testApp::onShutterChange(float & value){
// Only set if auto gain & shutter is off
if(!gui.getToggle("Auto Gain & Shutter")){
ps3eye.setShutter(value);
}
}

//--------------------------------------------------------------
void testApp::onGammaChange(float & value){
ps3eye.setGamma(value);
}

//--------------------------------------------------------------
void testApp::onBrightnessChange(float & value){
ps3eye.setBrightness(value);
}

//--------------------------------------------------------------
void testApp::onContrastChange(float & value){
ps3eye.setContrast(value);
}

//--------------------------------------------------------------
void testApp::onHueChange(float & value){
ps3eye.setHue(value);
}

//--------------------------------------------------------------
void testApp::onLedChange(bool & value){
ps3eye.setLed(value);
}

//--------------------------------------------------------------
void testApp::onFlickerChange(int & value){
ps3eye.setFlicker(value);
}

//--------------------------------------------------------------
void testApp::onWhiteBalanceChange(int & value){
ps3eye.setWhiteBalance(value);
}
30 changes: 30 additions & 0 deletions src/testApp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

#include "ofMain.h"
#include "ofxGui.h"
#include "ofxMacamPs3Eye.h"
#include "ofxSyphon.h"


class testApp : public ofBaseApp{

public:
void setup();
void update();
void draw();

void onAutoGainAndShutterChange(bool & value);
void onGainChange(float & value);
void onShutterChange(float & value);
void onGammaChange(float & value);
void onBrightnessChange(float & value);
void onContrastChange(float & value);
void onHueChange(float & value);
void onLedChange(bool & value);
void onFlickerChange(int & value);
void onWhiteBalanceChange(int & value);

ofxPanel gui;
ofxMacamPs3Eye ps3eye;
ofxSyphonServer mainOutputSyphonServer;
};

0 comments on commit 5a536da

Please sign in to comment.