Skip to content

Instantly share code, notes, and snippets.

@prisonerjohn
prisonerjohn / gist:4b635baf3eb94830c162
Created May 26, 2015 19:21
ofxAudioDecoder to libsndfile
sfInfo.frames = audioDecoder.getNumFrames();
sfInfo.samplerate = audioDecoder.getSampleRate();
sfInfo.channels = audioDecoder.getChannels();
sfInfo.format = SF_FORMAT_WAV;
sfInfo.sections = 1;
sfInfo.seekable = SF_TRUE;
SNDFILE * f = sf_open(ofToDataPath("testies.wav", true).c_str(), SFM_WRITE, &sfInfo);
// int err = sf_error(f);
PImage shapes;
void settings() {
size(512, 512);
}
void setup()
{
shapes = loadImage("shapes.png");
}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
...
height="512"
width="512">
...
<g
transform="translate(0,-161.53332)"
id="layer1">
<circle
@prisonerjohn
prisonerjohn / main.cpp
Last active August 27, 2019 18:46
Get pixel color from an ofPixels object.
#include "ofMain.h"
#include "ofApp.h"
int main()
{
ofSetupOpenGL(512, 512, OF_WINDOW);
ofRunApp(new ofApp());
}
@prisonerjohn
prisonerjohn / main.cpp
Last active August 27, 2019 19:07
Empty OF app.
#include "ofMain.h"
#include "ofApp.h"
int main()
{
ofSetupOpenGL(1920, 1080, OF_WINDOW);
ofRunApp(new ofApp());
}
@prisonerjohn
prisonerjohn / main.cpp
Last active September 16, 2019 02:38
Sensing Machines OpenCV
#include "ofMain.h"
#include "ofApp.h"
int main()
{
ofSetupOpenGL(1280, 720, OF_WINDOW);
ofRunApp(new ofApp());
}
@prisonerjohn
prisonerjohn / main.cpp
Last active September 22, 2019 23:41
Object Tracking
#include "ofMain.h"
#include "ofApp.h"
int main()
{
ofSetupOpenGL(640, 480, OF_WINDOW);
ofRunApp(new ofApp());
}
@prisonerjohn
prisonerjohn / ofApp-logFile.cpp
Last active September 30, 2019 21:46
Logging
#include "ofApp.h"
void ofApp::setup()
{
//ofSetLogLevel(OF_LOG_VERBOSE);
//ofSetLogLevel(OF_LOG_NOTICE); // default
ofSetLogLevel(OF_LOG_WARNING);
//ofSetLogLevel(OF_LOG_ERROR);
//ofSetLogLevel(OF_LOG_FATAL_ERROR);
//ofSetLogLevel(OF_LOG_SILENT);
@prisonerjohn
prisonerjohn / ofApp-arrays.h
Last active October 6, 2019 02:28
Pointers
#pragma once
#include "ofMain.h"
class ofApp : public ofBaseApp
{
public:
void setup();
void update();
void draw();
@prisonerjohn
prisonerjohn / ofApp-basic.cpp
Last active October 9, 2019 04:34
RealSense
#include "ofApp.h"
void ofApp::setup()
{
// Default RS resolution.
ofSetWindowShape(640, 360);
// true parameter starts the camera automatically.
rsContext.setup(true);
}