Skip to content

Instantly share code, notes, and snippets.

@crecord
Created September 21, 2015 03:53
Show Gist options
  • Save crecord/4a4d78bf695580bfbbe3 to your computer and use it in GitHub Desktop.
Save crecord/4a4d78bf695580bfbbe3 to your computer and use it in GitHub Desktop.
C++ for Dub plate archive
//
// dub.cpp
// spiral
//
// Created by Caroline Record on 7/16/15.
//
//
#include "Dub.h"
#include <string>
ofRay Dub::mouseRay;
bool Dub::selectionAvailable;
bool Dub::playMode;
bool Dub::resetViewTrigger;
/*
std::vector<std::string> Dub::splitDouble(const std::string &s, string delim) {
std::vector<std::string> elems;
std::stringstream ss(s);
std::string item;
while (std::getline(ss, item, delim)) {
elems.push_back(item);
}
return elems;
}*/
bool Dub::setup(string fileName, ofBaseApp *app, Scheduler masterSched, ofTrueTypeFont font){
vector<string> dateTime = masterSched.split(fileName,'&');
if (dateTime.size()< 2){
return false;
ofLog()<<"this File Is A No Go";
}
fnt = font;
//masterSched.
fileNm =fileName;
vector <ScheduleUnit> allMatches = masterSched.compareDate(fileName);
if (allMatches.size() == 0){
return false;
}
vector<string> timing = masterSched.split(dateTime.at(1),'.');
string timeRecorded = cleanUpDate(dateTime.at(1), ofToInt(timing.at(0)));
// if the first element of the string i
sound.loadSound(fileName);
sound.setLoop(false);
durationMillis = fileToDuration(sound);
sound.unloadSound();
if (durationMillis < 10){
return false;
}
else {
for (int i =0;i < allMatches.size(); i++){
if (i == 0 ){
hoverText += allMatches.at(i).date + "\n";
playText += allMatches.at(i).date + "\n";
playText += timeRecorded + "\n\n";
playText += allMatches.at(i).name;
ofRectangle rct = fnt.getStringBoundingBox(allMatches.at(i).name, 0, 0);
if (rct.width > 150){
hoverText += addNewLines(masterSched.split(allMatches.at(i).name, ' '));
}
else{
hoverText += allMatches.at(i).name;
}
}
else if ( i == 1){
hoverText += "\n+\n";
playText += "\n+\n" + allMatches.at(i).name ;
ofRectangle rct = fnt.getStringBoundingBox(allMatches.at(i).name, 0, 0);
if (rct.width > 150){
hoverText += addNewLines(masterSched.split(allMatches.at(i).name, ' '));
}
else{
hoverText += allMatches.at(i).name;
}
}
}
textWidth = fnt.getStringBoundingBox(hoverText, 0, 0).width;
}
spiral = durationToSpiral(durationMillis);
spiralToPlay = spiral;
//spiralPoly.addVertices(spiralToPlay);
playHed.set(5,30);
playHed.rotate(90, 1.0, 0.0, 0.0);
plane.set(900, 900); ///dimensions for width and height in pixels
plane.setPosition(0, 0, 0); /// position in x y z
plane.setResolution(2, 2); /// this resolution (as columns and rows) is enough
isSelected =false;
isExitHover = false;
//spiralRandom = addJitter(spiralToPlay);
mesh.setMode(OF_PRIMITIVE_POINTS);
//meshCoating.setMode(OF_PRIMITIVE_POINTS);
spiralMesh.setMode(OF_PRIMITIVE_LINE_STRIP);
spiralMesh.addVertices(spiralToPlay);
meshCoating.setMode(OF_PRIMITIVE_POINTS);
meshCoating.addVertices(spiralToPlay);
//ofEnableDepthTest();
//glEnable(GL_POINT_SMOOTH); // use circular points instead of square points
//glPointSize(.5); // make the points bigger
return true;
}
int Dub::fileSizeToDuration(int sz){
// duration in millis
return sz/353;
}
string Dub::cleanUpDate(string date , int hour){
// get rid of trailing 0
string toRet= date;
if (toRet[0] == '0'){
toRet.erase(toRet.begin() );
}
// replace . with :
std::replace( toRet.begin(), toRet.end(), '.', ':');
// add a am or a pm ... would have to use split again..
if (hour < 12 & hour >= 9){
toRet += " am";
}
else{
toRet += " pm";
}
return toRet;
}
string Dub::addNewLines(vector<string> allWords){
string toReturn;
for (int i =0; i< allWords.size(); i++){
if( i == allWords.size()/2 ) {
toReturn += "\n";
}
toReturn += allWords.at(i) + " ";
}
return toReturn;
}
int Dub::fileToDuration(ofSoundPlayer file){
file.play();
file.setPosition(.5);
int dur= file.getPositionMS()*2;
file.stop();
return dur;
}
void Dub::updatePlaySpiral(float fft){
if(spiralToPlay.size()>0){
spiralPlayed.push_back(spiralToPlay.at(spiralToPlay.size()-1));
spiralToPlay.pop_back();
}
if (sound.getPosition() >=0.99){
//spiralPlayed.erase(spiralPlayed.begin(), spiralPlayed.end());
exitPlayMode();
}
else{
resetViewTrigger = false;
}
if(playMode){
playHed.setPosition(spiralPlayed.at(spiralPlayed.size()-1).x, spiralPlayed.at(spiralPlayed.size()-1).y, 15);
//ofLog()<<theDots.size();
int numThresh =(int) ofRandom( 0, 100);
int theSize = (int) theDots.size();
int scaledFft = ofMap(fft,0, 1, 0, 200);
if ( scaledFft > numThresh) {
//ofLog()<<"i am in";
theDots.push_back(ofVec3f(spiralPlayed.at(spiralPlayed.size()-1).x, spiralPlayed.at(spiralPlayed.size()-1).y, 0));
dustSpeed.push_back(1);
perlinSeed.push_back(0);
//allDots.push_back(FallingDot(spiralPlayed.at(spiralPlayed.size()-1).x, spiralPlayed.at(spiralPlayed.size()-1).y, 0));
}
// create a falling dot.
}
mesh.clear();
for (int i=0; i< theDots.size(); i++){
//allDots.at(i).update();
theDots.at(i).z-= 1*dustSpeed.at(i);
//theDots.at(i).y += ofMap(ofNoise( perlinSeed.at(i),30), 0,1,-1,1);
//theDots.at(i).x += ofMap(ofNoise( perlinSeed.at(i),60), 0,1,-1,1);
dustSpeed.at(i) += ofRandom( .02, 1);
perlinSeed.at(i)+=.3;
mesh.addVertex(ofPoint(theDots.at(i).x, theDots.at(i).y, theDots.at(i).z));
mesh.addColor(ofColor(0,ofMap(theDots.at(i).z,0,-201,255,0)));
//mesh.addColor(ofColor(0));
//mesh.addColor(ofColor(0,22,222,ofMap(perlinSeed.at(i),0,5,255,0)));
if(theDots.at(i).z < -200){
//allDots.erase(allDots.begin()+i);
theDots.erase(theDots.begin()+i);
dustSpeed.erase(dustSpeed.begin()+i);
}
//ofVec3f toAdd = ofVec3f(theDots.at(i).x, theDots.at(i).y, theDots.at(i).z);
//mesh.addColor(ofColor(0,ofMap(perlinSeed.at(i),0,5,255,0)));
}
}
void Dub::exitPlayMode(){
playMode = false;
spiralPlayed.erase(spiralPlayed.begin(), spiralPlayed.end());
spiralToPlay= spiral;
resetViewTrigger = true;
// somehow trigger going back to home position;
sound.stop();
sound.unloadSound();
}
void Dub::drawPlaySpiral(){
ofPushMatrix();
ofTranslate(ofGetWidth()/2, ofGetHeight()/2,0 );
if(spiralToPlay.size()>0){
//ofPolyline toPlay;
//toPlay.addVertices(spiralToPlay);
//matchSize(spiralToPlay);
meshCoating.clear();
meshCoating.addVertices(spiralToPlay);
//meshCoating.set
//meshCoating.addVertices(addJitter(spiralToPlay));
ofSetColor(0);
ofSetLineWidth(1.2);
meshCoating.draw();
//toPlay.draw();
}
ofPolyline played;
played.addVertices(spiralPlayed);
mesh.draw();
ofSetColor(193,193,193);
ofSetLineWidth(1);
played.draw();
ofSetColor(0);
playHed.drawWireframe();
ofPopMatrix();
}
void Dub::updateListSpiral(){
planeIntercept.setFrom(plane);
isHover = planeIntercept.intersect(mouseRay);
}
void Dub::drawListSpiral(int x, int y, int z){
plane.setPosition(x,y,z);
resetViewTrigger = false;
ofPushMatrix();
ofTranslate(x,y,z);
if (isHover & selectionAvailable){
selectionAvailable = false;
isSelected = true;
ofSetColor( 0);
ofSetLineWidth(1.5);
}
else if (isHover & isSelected){
ofSetColor( 0);
ofSetLineWidth(1.5);
}
else if (!isHover & isSelected){
isSelected =false;
selectionAvailable = true;
ofSetColor(193,193,193);
}
else{
ofSetColor(193,193,193);
ofSetLineWidth(1);
}
spiralMesh.draw();
ofPopMatrix();
}
//void drawHoverText(ofEasyCam camera);
void Dub::drawHoverText(ofEasyCam camera){
// need to get the screen cordinates of the top of the current plane.
//plane.getMesh().getVertex(0)
ofVec3f textPnt(plane.getPosition().x - (radius+50),plane.getPosition().y, plane.getPosition().z );
ofVec3f drawHoverText = camera.worldToScreen(textPnt);
ofSetColor(0);
fnt.drawString(hoverText, drawHoverText.x - textWidth , drawHoverText.y );
//fnt.drawString(dateRecorded, drawHoverText.x , drawHoverText.y + 15);
}
void Dub::drawPlayInfo(){
fnt.drawString( playText, ofGetHeight()/25 , ofGetHeight()/25 );
int crossWid = ofGetWidth()/50;
int xAnchor = ofGetWidth() - ofGetWidth()/25 - crossWid ;
int yAnchor = ofGetHeight()/25;
ofSetColor(0);
if (( ofGetMouseX() > xAnchor) & (ofGetMouseX() < xAnchor+ crossWid) & (ofGetMouseY() > yAnchor) &(ofGetMouseY()< yAnchor +crossWid)){
isExitHover = true;
ofSetLineWidth(3);
}
else{
isExitHover =false;
//ofSetColor(255,0,0);
ofSetLineWidth(1);
//ofSetColor(193,193,193);
}
ofLine(xAnchor,yAnchor,xAnchor + crossWid,yAnchor + crossWid);
ofLine(xAnchor + crossWid,yAnchor,xAnchor,yAnchor + crossWid);
ofSetLineWidth(1);
}
void Dub::checkClick(){
if(isSelected){
playMode = true;
sound.loadSound(fileNm);
sound.setLoop(false);
sound.play();
}
}
ofMesh spiralToCoating(){
}
vector<ofPoint> Dub::durationToSpiral(int duration){
// make Spiral
//--------------------------------------------------------------
// radius--- Distance from origin to outer arm.
ofVec2f center(0, 0);
radius = 600;
//int radius = 600;
ofPolyline tempLine;
// sides---- Number of points or sides along the spiral's arm.
int sides = 10;
// coils---- Number of coils or full rotations. (Positive numbers spin clockwise, negative numbers spin counter-clockwise)
int coils = 40;
// rotation- Overall rotation of the spiral. ('0'=no rotation, '1'=360 degrees, '180/360'=180 degrees)
int rotation =1;
// value of theta corresponding to end of last coil
double thetaMax = coils * 2 * M_PI;
double awayStep = radius / thetaMax;
//int awayStep = radius/thetaMax;
int chord = 20;
// How far to rotate around center for each side.
int aroundStep = coils/sides;// 0 to 1 based.
//
// Convert aroundStep to radians.
int aroundRadians = aroundStep * 2 * M_PI;
//
// Convert rotation to radians.
rotation *= 2 * M_PI;
// For every side, step around and away from center.
for ( double theta = chord / awayStep; theta <= thetaMax; ) {
//
// How far away from center
double away = awayStep * theta;
//
// How far around the center.
double around = theta + rotation;
//
// Convert 'around' and 'away' to X and Y.
double x = 0 + cos ( around ) * away;
double y = 0 + sin ( around ) * away;
//
// Now that you know it, do it.
ofVec2f pnt(x,y);
tempLine.curveTo(x,y);
// to a first approximation, the points are on a circle
// so the angle between them is chord/radius
theta += chord / away;
}
spiral = tempLine.getVertices();
// target Length
int targetLength = round(duration/(1000/ofGetFrameRate()));
// remove excess
spiral.erase(spiral.begin(), spiral.begin() + (spiral.size() - targetLength));
return spiral;
}
//
// dub.h
// spiral
//
// Created by Caroline Record on 7/16/15.
//
//
#include "ofMain.h"
#include "ofxRay.h"
#include "Scheduler.h"
class Dub{
public:
static ofRay mouseRay;
static bool selectionAvailable;
static bool playMode;
static bool resetViewTrigger;
bool setup(string fileName, ofBaseApp *app, Scheduler masterSched, ofTrueTypeFont font);
void loadSound();
void updatePlaySpiral(float fft);
void drawPlaySpiral();
void drawListSpiral(int x, int y, int z);
void updateListSpiral();
void checkClick();
void exitPlayMode();
int fileSizeToDuration(int fileSize);
// so that other functions can access the split function.
// if hovered over in list Mode
vector<ofPoint> spiral;
bool isSelected;
void drawHoverText(ofEasyCam camera);
void drawPlayInfo();
bool isExitHover;
private:
string fileNm;
ofMesh spiralMesh;
ofMesh meshCoating;
bool isHover;
ScheduleUnit thisSched;
int fileToDuration(ofSoundPlayer file);
vector<ofPoint> durationToSpiral(int duration);
vector<ofVec3f> theDots;
ofMesh theDust;
vector<int> dustSpeed;
vector<float> perlinSeed;
string hoverText;
string playText;
int textWidth;
string dateRecorded;
string addNewLines(vector<string> allWords);
string cleanUpDate(string date, int hour);
int durationMillis;
ofPlanePrimitive plane;
ofPlane planeIntercept; // the plane to check intersection
ofSoundPlayer sound;
ofConePrimitive playHed;
ofPolyline spiralPoly;
vector<ofPoint> spiralToPlay;
vector<ofPoint> spiralPlayed;
ofTrueTypeFont fnt;
int radius;
int numOfGhosts;
ofMesh mesh;
};
#include "ofMain.h"
#include "ofApp.h"
//========================================================================
int main( ){
ofSetupOpenGL(1024,768,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 ofApp());
}
//
// makeWav.cpp
// spiral
//
// Created by Caroline Record on 7/29/15.
//
//
#include "makeWav.h"
#include "Recording.h"
#include <CoreAudio/CoreAudio.h>
#include <CoreAudio/CoreAudioTypes.h>
#include <AudioToolbox/AudioToolbox.h>
#include <iostream>
using namespace std;
#include <stdlib.h>
makeWave::makeWave(){
recordingLength = 0;
isRecording = false;
}
makeWave::makeWave(int bufferLength, int numChannels){
recordingBuffer = (float*) malloc(sizeof(float)*bufferLength*numChannels);
recordingLength = 0;
isRecording = false;
this->bufferLength = bufferLength;
this->numChannels = numChannels;
}
void makeWave::startRecording(){
isRecording = true;
cout << "start Recording";
}
void makeWave::stopRecording(){
isRecording = false;
cout << "stop Recording";
}
void makeWave::clearRecording(){
free(recordingBuffer);
recordingBuffer = (float*) malloc(sizeof(float)*bufferLength*numChannels);
recordingLength = 0;
}
void makeWave::addSamples(int numSamples, int numChannels, float* input){
if(!isRecording)
return;
recordingLength += numSamples*numChannels;
recordingBuffer=(float*)realloc(recordingBuffer, recordingLength*sizeof(float));
//cout << recordingSize <<" "<<numSamples <<" "<<numChannels << ""<< recordingSize*sizeof(float)<<"\n";
memcpy(&recordingBuffer[recordingLength-numSamples*numChannels], input, numSamples*numChannels*sizeof(float));
}
void makeWave::writeFile(char* filename) {
OSStatus err;
CFStringRef fPath;
AudioStreamBasicDescription localFormat;
AudioBufferList buffer;
buffer.mNumberBuffers = 1;
buffer.mBuffers[0].mNumberChannels = 2;
buffer.mBuffers[0].mDataByteSize = 4 * this->recordingLength;
buffer.mBuffers[0].mData = this->recordingBuffer;
// the client format will describe the output audio file
AudioStreamBasicDescription clientFormat;
// the file type identifier tells the ExtAudioFile API what kind of file we want created
AudioFileTypeID fileType;
// this creates a wav file type
fileType = kAudioFileWAVEType;
// This function audiomatically generates the audio format according to certain arguments
//FillOutASBDForLPCM(AudioStreamBasicDescription& outASBD, Float64 inSampleRate, UInt32 inChannelsPerFrame, UInt32 inValidBitsPerChannel, UInt32 inTotalBitsPerChannel, bool inIsFloat, bool inIsBigEndian, bool inIsNonInterleaved = false)
FillOutASBDForLPCM (clientFormat,44100,2,32,32,true,false,false);
FillOutASBDForLPCM (localFormat,44100,2,32,32,true,false,false);
// create the audio file reference
ExtAudioFileRef audiofileRef;
// create a fileURL from our path
fPath = CFStringCreateWithCString(kCFAllocatorDefault, filename,
kCFStringEncodingMacRoman);
CFURLRef fileURL = CFURLCreateWithString(kCFAllocatorDefault,fPath,NULL);
// open the file for writing
err = ExtAudioFileCreateWithURL((CFURLRef)fileURL, fileType, &clientFormat, NULL, kAudioFileFlags_EraseFile, &audiofileRef);
if (err != noErr)
{
cout << "Problem when creating audio file\n";
}
// Tell the ExtAudioFile API what format we'll be sending samples in
err = ExtAudioFileSetProperty(audiofileRef, kExtAudioFileProperty_ClientDataFormat, sizeof(localFormat), &localFormat);
cout << err;
if (err != noErr)
{
cout << "Problem setting audio format\n";
}
/////////////////////////////////////////////////////////////////////////////
///////// Write the Contents of the AudioBufferList to the AudioFile ////////
/////////////////////////////////////////////////////////////////////////////
// write the data
err = ExtAudioFileWrite(audiofileRef, this->recordingLength/2, &buffer);
if (err != noErr)
{
cout << "Problem writing audio file\n";
}
ExtAudioFileDispose(audiofileRef);
}
//
// makeWav.h
// spiral
//
// Created by Caroline Record on 7/29/15.
//
//
#ifndef __spiral__makeWav__
#define __spiral__makeWav__
class makeWave{
public:
void writeFile(char* filename);
makeWave();
makeWave(int bufferLength, int numChannels);
void addSamples(int numSamples, int numChannels, float* input);
void startRecording();
void stopRecording();
void clearRecording();
bool isRecording;
private:
float *recordingBuffer;
long recordingLength;
int bufferLength;
int numChannels;
};
#endif /* defined(__spiral__makeWav__) */
#include "ofApp.h"
#include <math.h>
#include <iostream>
#include <vector>
//--------------------------------------------------------------
void ofApp::setup(){
ofSetFullscreen(true);
ofHideCursor();
//ofShowCursor();
//GUI timezes
fakeMouse.loadImage("fakeMouse5.png");
startRec.addListener(this, &ofApp::startRecSample);
stopRec.addListener(this, &ofApp::stopRecSample);
playRec.addListener(this, &ofApp::playBackSample);
toggleGhosts.addListener(this, &ofApp::toggleGhostsCallback);
loadRec.addListener(this, &ofApp::loadSample);
gui.setup();
//gui.add(micLevel.setup(<#string sliderName#>, <#float _val#>, <#float _min#>, <#float _max#>)
gui.add(audioControls.setup("Audio Controls",""));
gui.add(micLevel.setup( "Mic level", 1, 0, 1 ));
gui.add(turnTable1LevelLeft.setup( "Tt 1 left level", 0.5, 0, 1 ));
gui.add(turnTable1LevelRight.setup( "Tt 1 right level", 0.5, 0, 1 ));
gui.add(turnTable2LevelLeft.setup( "Tt 2 left level", 0.5, 0, 1 ));
gui.add(turnTable2LevelRight.setup( "Tt 2 right level", 0.5, 0, 1 ));
gui.add(startRec.setup("start record sample"));
gui.add(stopRec.setup("stop record sample"));
gui.add(loadRec.setup("load sample"));
gui.add(playRec.setup("play back sample"));
gui.add(interfaceControls.setup("Interface Controls",""));
gui.add(toggleGhosts.setup("toggle ghosts"));
showGhosts = false;
gui.add(allowCameraInput.setup("adjust camera",false));
//gui.add(audioControls.setup("screen size");
drawGui = false;
gui.loadFromFile("settings.xml");
record.setup(this);
ofSetVerticalSync(true);
ofEnableSmoothing();
ofxLoadCamera(listCamMany, "ofEasyListManyCamSettings");
ofxLoadCamera(listCamFew, "ofEasyListFewCamSettings");
ofxLoadCamera(playCam, "ofEasyPlayCamSettings");
playCamAnchor = playCam.getGlobalPosition();
sche.loadFileToHash(this);
//setup recording
//record.setup( this );
// Get all files in data folder
//--------------------------------------------------------------
//some path, may be absolute or relative to bin/data
string path = "";
ofDirectory dir(path);
//only show png files
dir.allowExt("wav");
//populate the directory object
dir.listDir();
ptSansRegular.loadFont("PT.ttf", 11, true, true);
ptSansRegular.setLineHeight(18.0f);
ptSansRegular.setLetterSpacing(1.037);
//go through and print out all the paths
for(int i = 0; i < dir.numFiles(); i++){
//ofLogNotice(dir.getPath(i));
Dub temp = *new Dub();
if (temp.setup(dir.getPath(i), this, sche, ptSansRegular)){
plates.insert(plates.begin(), temp);
}
}
if(plates.size()>0){
plates.at(0).selectionAvailable =true;
plates.at(0).playMode =false;
plates.at(0).resetViewTrigger = false;
if (plates.at(0).playMode & allowCameraInput){
playCam.enableMouseInput();
playCamAnchor = playCam.getGlobalPosition();
listCamCurrent.disableMouseInput();
}
else if(!plates.at(0).playMode & allowCameraInput){
listCamCurrent.enableMouseInput();
playCam.disableMouseInput();
}
else {
listCamCurrent.disableMouseInput();
playCam.disableMouseInput();
}
}
if (plates.size()<16){
listCamCurrent = listCamFew;
}
else{
listCamCurrent = listCamMany;
}
// int bufferSize = 256;
turnTable1.assign(BUFFER_SIZE*2, 0.0);
turnTable2.assign(BUFFER_SIZE*2, 0.0);
//ofShowCursor();
ofTrueTypeFont::setGlobalDpi(72);
scrollX = 0;
timeStartInactive = ofGetElapsedTimeMillis();
ofEnableAntiAliasing();
stopRecordTrigger = false;
//fft
fftSmoothed = new float[8192];
for (int i = 0; i < 8192; i++){
fftSmoothed[i] = 0;
}
nBandsToGet = 1;
justPlayed = false;
}
void ofApp::startRecSample(){
//ofLog() << "starting recording";
record.startRecording();
}
void ofApp::stopRecSample(){
//ofLog() << "stopping recording";
record.stopRecording(true);
}
void ofApp::loadSample(){
playSample.loadSound("sample.wav");
}
void ofApp::playBackSample(){
playSample.setLoop(false);
playSample.play();
}
void ofApp::toggleGhostsCallback(){
if (showGhosts){
ofLog()<<"saving many";
listCamMany = listCamCurrent;
}
else {
if (plates.size()<16){
ofLog()<<"saving few";
listCamFew = listCamCurrent;
}
else{
ofLog()<<"saving Many";
listCamMany = listCamCurrent;
}
}
showGhosts = !showGhosts;
if (showGhosts){
ofLog()<<"setting cam to Many";
listCamCurrent = listCamMany;
}
else {
if (plates.size()<16){
listCamCurrent = listCamFew;
ofLog()<<"setting cam to few";
}
else{
listCamCurrent = listCamMany;
ofLog()<<"setting cam to Many";
}
}
scrollX=0;
}
//--------------------------------------------------------------
void ofApp::update(){
if (stopRecordTrigger){
stopRecordTrigger = false;
string fileName = record.stopRecording(false);
Dub temp = *new Dub();
if (temp.setup(fileName, this, sche, ptSansRegular)){
plates.insert(plates.begin(), temp);
}
if (plates.size()<16){
listCamCurrent = listCamFew;
ofLog()<<"setting cam to few";
}
else{
listCamCurrent = listCamMany;
ofLog()<<"setting cam to Many";
}
}
if ((ofGetElapsedTimeMillis() -timeStartInactive) >= 120000){
scrollX = 0;
}
//ofShowCursor();
if(record.isRecording){
record.updateRecordingSpiral();
}
if (ofGetElapsedTimeMillis() > 2000){
if ( (mouseY < ofGetHeight()/10) & (mouseX < (ofGetWidth()/4)*3)){
int Xpos = listCamCurrent.worldToScreen(lastElement).y - 200;
if (Xpos < ofGetHeight()/10){
int amountToMove = ofMap(mouseY,ofGetHeight()/10, 0, 1, 25);
scrollX -= amountToMove;
}
//listCamCurrent.getTranslationKey();
}
else if ( mouseY > (ofGetHeight()/10)*9){
int Xpos = listCamCurrent.worldToScreen(firstElement ).y ;
if ((Xpos > (ofGetHeight()/10)*7) | (Xpos<0)){
int amountToMove = ofMap(mouseY, (ofGetHeight()/10)*9 , ofGetHeight(), 1, 25);
scrollX += amountToMove;
}
}
}
if (plates.size()>0) {
if (plates.at(0).playMode & allowCameraInput){
playCam.enableMouseInput();
playCamAnchor = playCam.getGlobalPosition();
listCamCurrent.disableMouseInput();
}
else if(!plates.at(0).playMode & allowCameraInput){
listCamCurrent.enableMouseInput();
playCam.disableMouseInput();
}
else {
listCamCurrent.disableMouseInput();
playCam.disableMouseInput();
}
if (plates.at(0).playMode){
timeStartInactive = ofGetElapsedTimeMillis();
//fft
float * val = ofSoundGetSpectrum(1); // request 128 values for fft
for (int i = 0;i < nBandsToGet; i++){
// let the smoothed calue sink to zero:
fftSmoothed[i] *= 0.96f;
// take the max, either the smoothed or the incoming:
if (fftSmoothed[i] < val[i]) fftSmoothed[i] = val[i];
}
plates.at(indexToPlay).updatePlaySpiral(fftSmoothed[0]);
// make the camera drift around a little
ofVec3f lastPos = playCam.getGlobalPosition();
if(!allowCameraInput){
float xNoise = ofMap(ofNoise(ofGetElapsedTimef()*0.05), 0,1,-80,80);
float yNoise = ofMap(ofNoise(ofGetElapsedTimef()*0.05,50), 0,1,-70,70);
float zNoise = ofMap(ofNoise(ofGetElapsedTimef()*0.02 ,500), 0,1,-100,1-0);
//ofLog()<< "wandering about: " + ofToString(xNoise);
playCam.setGlobalPosition(playCamAnchor.x+xNoise, playCamAnchor.y+yNoise, playCamAnchor.z + zNoise);
}
//playCam.setTarget(plates.at(indexToPlay).spiral.at(0));
}
else{
if (plates.at(0).resetViewTrigger){
scrollX = 0;
}
if(playCam.getMouseInputEnabled()){
listCamCurrent.enableMouseInput();
playCam.disableMouseInput();
}
// the mouse position on screen coordinates
screenMouse = ofVec3f(ofGetMouseX(),ofGetMouseY(),0);
// the mouse position on world coordinates
worldMouse = listCamCurrent.screenToWorld(ofVec3f(screenMouse.x, screenMouse.y, 0.0f));
// a point right in front of the mouse (used to get mouse direction)
worldMouseEnd = listCamCurrent.screenToWorld(ofVec3f(screenMouse.x, screenMouse.y, 1.0f));
// a vector representing the mouse direction (from camera to infinity?)
worldMouseTransmissionVector = worldMouseEnd - worldMouse;
// set attributes to the ray
plates.at(0).mouseRay.s = worldMouse;
plates.at(0).mouseRay.t = worldMouseTransmissionVector;
ofSetColor(0);
ofDrawBitmapString("yo yo", 200,200);
for(int i=0; i< plates.size(); i++){
plates.at(i).updateListSpiral();
}
}
}
}
void ofApp::drawGhost(int x, int y, int z){
ofPushMatrix();
ofTranslate(x,y,z);
ofEllipse(0, 0, 900, 900);
ofPopMatrix();
}
//--------------------------------------------------------------
void ofApp::draw(){
//ofBackground(236, 237, 232);
ofBackgroundGradient(ofColor::white, ofColor::lightGray);
ofColor lightRetro = ofColor(236, 237, 232);
ofColor darkRetro = ofColor(208, 210, 198);
//ofBackgroundGradient(lightRetro, darkRetro);
//ofBackground(lightRetro);
ofSetColor(0);
if (plates.size()>0) {
if (plates.at(0).playMode){
plates.at(indexToPlay).drawPlayInfo();
playCam.begin();
plates.at(indexToPlay).drawPlaySpiral();
playCam.end();
}
else{
// cam.begin();
int xLoc2 = 1500;
int zLoc2 = 0;
listCamCurrent.begin();
if(record.isRecording){
zLoc2 ++;
}
for(int i= 0; i < plates.size(); i++){
if (i ==0){
firstElement = ofVec3f( xLoc2, 0 , zLoc2 *150 + scrollX);
}
if (i == plates.size()-1){
lastElement = ofVec3f( xLoc2, 0, zLoc2 *150 + scrollX);
}
/*
if(i <0 & i%18 == 0){
xLoc2 += 1500;
zLoc2 = 0;
}
*/
plates.at(i).drawListSpiral( xLoc2, 0 , zLoc2 *150+ scrollX);
zLoc2 ++;
if (plates.at(i).isSelected){
listCamCurrent.end();
plates.at(i).drawHoverText(listCamCurrent);
listCamCurrent.begin();
}
}
if(record.isRecording){
record.drawRecordingSpiral( 1500, 0, 0 *150+ scrollX);
listCamCurrent.end();
record.drawText(listCamCurrent,ptSansRegular);
listCamCurrent.begin();
//ofLog()<<"inside";
}
listCamCurrent.end();
}
}
else{
if(record.isRecording){
int xLoc2 = 1500;
int zLoc2 = 0;
listCamCurrent.begin();
record.drawRecordingSpiral( xLoc2, 0 , zLoc2 *150 + scrollX);
listCamCurrent.end();
record.drawText(listCamCurrent,ptSansRegular);
//ofLog()<<"inside";
zLoc2 ++;
}
}
if (showGhosts){
int xLoc = 1500;
int zLoc = 0;
for(int i = 0; i < sche.schedUnits.size(); i++){
if (i ==0){
firstElement = ofVec3f( xLoc, 0 , zLoc *150 + scrollX);
}
if (i == sche.schedUnits.size()-1){
lastElement = ofVec3f( xLoc, 0 , zLoc *150 + scrollX);
}
/*
if(i%15 == 0){
xLoc += 1500;
zLoc = 0;
}
*/
listCamCurrent.begin();
drawGhost( xLoc, 0 , zLoc *150 + scrollX);
zLoc ++;
listCamCurrent.end();
}
}
//ofEllipse(listCamCurrent.worldToScreen(firstElement).x, listCamCurrent.worldToScreen(firstElement).y, 10, 10);
ofSetColor(255);
//ofDrawBitmapString("po po", 20,20);
//oneSound.drawPlaySpiral();
if (drawGui){
gui.draw();
ofShowCursor();
}
else{
ofHideCursor();
}
fakeMouse.draw(mouseX, mouseY);
}
//--------------------------------------------------------------
void ofApp::keyPressed (int key){
if(key=='a' && !record.isRecording){
record.startRecording();
}
if(key=='s' && record.isRecording){
//record.stopRecording();
stopRecordTrigger = true;
}
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
if (key == 'e'){
if (plates.size()>0) {
if (plates.at(0).playMode){
plates.at(indexToPlay).exitPlayMode();
}
}
}
else if (key == 'h'){
drawGui = !drawGui;
}
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
timeStartInactive = ofGetElapsedTimeMillis();
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
timeStartInactive = ofGetElapsedTimeMillis();
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
timeStartInactive = ofGetElapsedTimeMillis();
// have each of the plates check them selves if we are is list mode.
if(plates.size()>0){
if (!plates.at(0).playMode & !plates.at(0).selectionAvailable){
for(int i=0; i < plates.size(); i++){
plates.at(i).checkClick();
if(plates.at(i).playMode){
// store the index
indexToPlay = i;
// switch over the input on the cameras
listCamCurrent.disableMouseInput();
//playCam.enableMouseInput();
//ofLog()<< "hello";
justPlayed = true;
break;
}
}
}
else if (plates.at(0).playMode){
if (plates.at(indexToPlay).isExitHover){
plates.at(indexToPlay).exitPlayMode();
}
}
}
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
/*
timeStartInactive = ofGetElapsedTimeMillis();
if (plates.size()<16){
listCamCurrent = listCamFew;
ofLog()<<"setting cam to few";
}
else{
listCamCurrent = listCamMany;
ofLog()<<"setting cam to Many";
}
*/
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
ofHideCursor();
//ofShowCursor();
}
void ofApp::audioIn(float * input, int bufferSize, int nChannels){
/*
if(!record.recordThis.isRecording){
//not recording - listen for trigger.
}
*/
// listen to the volume of the four different inputs
float curVol = 0.0;
int numCounted = 0;
float mix[bufferSize*2];
float volMix[bufferSize*2];
int ptr = 0;
for(int i = 0; i < bufferSize*2; i+=2){
mix[i] = (input[ptr]*micLevel + input[ptr + 2]*turnTable1LevelLeft + input[ptr + 4]*turnTable2LevelLeft)/DIVISOR;
mix[i+1] = (input[ptr+1]*micLevel + input[ptr + 3]*turnTable1LevelRight + input[ptr + 5]*turnTable2LevelRight)/DIVISOR;
volMix[i] = input[ptr +2]*0.25 + input[ptr +3]*0.25;
volMix[i +1] = input[ptr +4]*0.25 + input[ptr +5]*0.25;
//float text = input[ptr +2]*0.25 + input[ptr +3]*0.25;
//turnTable2[i] = input[ptr +4]*0.25 + input[ptr +5]*0.25;
curVol += volMix[i] * volMix[i];
curVol += volMix[i+1] * volMix[i+1];
numCounted+=2;
ptr+=nChannels;
}
record.recordThis.addSamples(bufferSize, 2, mix);
//this is how we get the mean of rms :)
curVol /= (float)numCounted;
// this is how we get the root of rms :)
curVol = sqrt( curVol );
//ofLog() << curVol;
if(!record.isRecording){
//not recording - listen for trigger.
if (curVol > 0.01){
if (!inSound){
inSound = true;
startSound = ofGetElapsedTimeMillis();
}
else {
int timeElap = ofGetElapsedTimeMillis() - startSound;
if (timeElap > 2000){
record.startRecording();
startRecordTime = ofGetElapsedTimeMillis();
}
}
}
inSilence = false;
}
else {
if (curVol < 0.01){
inSound = false;
if (!inSilence){
inSilence = true;
startSilence = ofGetElapsedTimeMillis();
}
else{
int timeOfSilence = ofGetElapsedTimeMillis() - startSilence;
int durOfRecording = ofGetElapsedTimeMillis() - startRecordTime;
// the time of silence is over 10 seconds
if (timeOfSilence >= 10000){
// if the recording is over a minute long keep it. If not, throw it away.
if (durOfRecording > 60000){
stopRecordTrigger = true;
inSilence = false;
}
else{
record.discardRecording();
inSilence = false;
}
}
// if the recording is over 15 minutes then stop recording.
else if (durOfRecording > 900000){
stopRecordTrigger = true;
inSilence = false;
}
}
}
else {
inSilence = false;
}
}
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
//--------------------------------------------------------------
void ofApp::exit(){
if ((plates.size() < 16) & !showGhosts ){
ofxSaveCamera(listCamCurrent, "ofEasyListFewCamSettings");
}
else{
ofxSaveCamera(listCamCurrent, "ofEasyListManyCamSettings");
}
playCam.setPosition(playCamAnchor );
ofxSaveCamera(playCam, "ofEasyPlayCamSettings");
gui.saveToFile("settings.xml");
}
#include "ofMain.h"
#include "ofxCameraSaveLoad.h"
//#include "Scheduler.h"
#include "Dub.h"
#include "Recording.h"
#include "ofxGui.h"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void exit();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y);
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
void audioIn(float * input, int bufferSize, int nChannels);
vector <float> turnTable1;
vector <float> turnTable2;
ofTrueTypeFont ptSansRegular;
ofEasyCam listCamCurrent;
ofEasyCam listCamFew;
ofEasyCam listCamMany;
ofEasyCam playCam;
ofVec3f playCamAnchor;
Recording record;
Scheduler sche;
private:
void drawGhost(int x, int y, int z);
bool stopRecordTrigger;
bool inSilence;
bool inSound;
int startSound;
int startSilence;
int startRecordTime;
vector<Dub> plates;
// vectors
ofVec3f screenMouse;
ofVec3f worldMouse;
ofVec3f worldMouseEnd;
ofVec3f worldMouseTransmissionVector;
ofImage fakeMouse;
ofVec3f firstElement;
ofVec3f lastElement;
int indexToPlay;
ofxPanel gui;
ofxFloatSlider micLevel;
ofxFloatSlider turnTable1LevelLeft;
ofxFloatSlider turnTable1LevelRight;
ofxFloatSlider turnTable2LevelLeft;
ofxFloatSlider turnTable2LevelRight;
ofxButton stopRec;
ofxButton startRec;
ofxButton loadRec;
ofxButton playRec;
ofxButton toggleGhosts;
bool showGhosts;
ofxToggle allowCameraInput;
ofxLabel audioControls;
ofxLabel interfaceControls;
ofSoundPlayer playSample;
int timeStartInactive;
int scrollX;
void loadSample();
void startRecSample();
void stopRecSample();
void playBackSample();
void toggleGhostsCallback();
void allowCameraInputTog();
bool drawGui;
bool justPlayed;
// getting the fft
float * fftSmoothed;
int nBandsToGet;
};
//
// Recording.cpp
// spiral
//
// Created by Caroline Record on 7/23/15.
//
//
#include "Recording.h"
void Recording::setup(ofBaseApp *ref){
string path = "";
ofDirectory dir(path);
absPath = dir.getAbsolutePath();
ofLog() << absPath;
ofSoundStreamListDevices();
isRecording = false;
recordThis = *new makeWave(BUFFER_SIZE, 2);
//ofSoundStreamSetup(<#int nOutputChannels#>, int nInputChannels, <#ofBaseApp *appPtr#>, <#int sampleRate#>, <#int bufferSize#>, <#int nBuffers#>)
ofSoundStreamSetup(0,NUM_CHANNELS, ref, SAMPLE_RATE,BUFFER_SIZE,NUM_CHANNELS*2);
left.assign(BUFFER_SIZE, 0.0);
right.assign(BUFFER_SIZE, 0.0);
//turnTableInput1.start();
// fills out the baseSpiral
fullSpiral();
ofNoFill();
plane.set(900, 900); ///dimensions for width and height in pixels
plane.setPosition(0, 0, 0); /// position in x y z
plane.setResolution(2, 2); /// this resolution (as columns and rows) is enough
toggleElipse =true;
togStartTime = ofGetElapsedTimeMillis();
}
void Recording::startRecording(){
startTime= ofGetElapsedTimeMillis();
isRecording = true;
recordThis.startRecording();
fileN =ofGetTimestampString("%n.%e.%y&%h.%M&%W") + ".wav";
}
string Recording::stopRecording(bool isSample){
//cout<<"Stop recording\n";
recordThis.stopRecording();
//recordThis.writeFile("/Users/dermeister/Documents/Dev/OF/of_v0.8.4_osx_release/apps/myApps/spiral/boob2.wav");
// string ofFilePath::getAbsolutePath(string path, bool bRelativeToData=true)
//"/Users/carolinerecord/Documents/of_v0.8.4_osx_release/apps/myApps/spiralPat/bin/data/"
isRecording = false;
if(isSample){
fileN ="sample.wav";
string FilePath = absPath + "/" + fileN;
int TempNumOne=FilePath.size();
char Filename[TempNumOne];
for (int a=0;a<=TempNumOne;a++)
{
Filename[a]=FilePath[a];
}
recordThis.writeFile(Filename);
}
else {
string FilePath = absPath + "/" + fileN;
int TempNumOne=FilePath.size();
char Filename[TempNumOne];
for (int a=0;a<=TempNumOne;a++)
{
Filename[a]=FilePath[a];
}
recordThis.writeFile(Filename);
}
//recordThis.writeFile("/Users/carolinerecord/Documents/of_v0.8.4_osx_release/apps/myApps/spiralPat/bin/data/woot.wav");
//recordThis.writeFile((char *)FilePath);
recordThis.clearRecording();
//audioRecorder.finalize();
return fileN;
}
void Recording::discardRecording(){
recordThis.stopRecording();
recordThis.clearRecording();
isRecording = false;
}
//void drawHoverText(ofEasyCam camera);
void Recording::drawText(ofEasyCam camera, ofTrueTypeFont fnt ){
//ofLog() <<ofGetElapsedTimeMillis();
if(ofGetElapsedTimeMillis() - togStartTime > 1000){
togStartTime = ofGetElapsedTimeMillis();
toggleElipse = !toggleElipse;
}
// need to get the screen cordinates of the top of the current plane.
//plane.getMesh().getVertex(0)
ofVec3f textPnt(plane.getPosition().x - 650,plane.getPosition().y - 250, plane.getPosition().z );
ofVec3f drawHoverText = camera.worldToScreen(textPnt);
ofSetColor(0);
// add minus text width on x.
string toPrint = "Recording Now";
int textWidth = fnt.getStringBoundingBox(toPrint, 0, 0).width;
int textHeight = fnt.getStringBoundingBox(toPrint, 0, 0).height;
fnt.drawString(toPrint, drawHoverText.x - textWidth, drawHoverText.y );
if(toggleElipse){
ofFill();
ofEllipse(drawHoverText.x - textWidth-10, drawHoverText.y - textHeight/2, 7, 7);
ofNoFill();
}
//fnt.drawString(dateRecorded, drawHoverText.x , drawHoverText.y + 15);
}
void Recording::drawRecordingSpiral(int x, int y, int z){
if(isRecording){
if(baseSpiral.size()>0){
ofPushMatrix();
ofTranslate(x,y,z );
plane.setPosition(x,y,z);
toPlay.clear();
toPlay.addVertices(spiralToDraw);
ofSetColor(0);
toPlay.draw();
ofPopMatrix();
}
}
}
void Recording::updateRecordingSpiral(){
int dur = ofGetElapsedTimeMillis() - startTime;
//ofLog() << dur;
durationToSpiral(dur);
}
void Recording::fullSpiral(){
// make Spiral
//--------------------------------------------------------------
// radius--- Distance from origin to outer arm.
ofVec2f center(0, 0);
int radius = 600;
ofPolyline tempLine;
// sides---- Number of points or sides along the spiral's arm.
int sides = 10;
// coils---- Number of coils or full rotations. (Positive numbers spin clockwise, negative numbers spin counter-clockwise)
int coils = 40;
// rotation- Overall rotation of the spiral. ('0'=no rotation, '1'=360 degrees, '180/360'=180 degrees)
int rotation =1;
// value of theta corresponding to end of last coil
double thetaMax = coils * 2 * M_PI;
double awayStep = radius / thetaMax;
//int awayStep = radius/thetaMax;
int chord = 20;
// How far to rotate around center for each side.
int aroundStep = coils/sides;// 0 to 1 based.
//
// Convert aroundStep to radians.
int aroundRadians = aroundStep * 2 * M_PI;
//
// Convert rotation to radians.
rotation *= 2 * M_PI;
// For every side, step around and away from center.
for ( double theta = chord / awayStep; theta <= thetaMax; ) {
//
// How far away from center
double away = awayStep * theta;
//
// How far around the center.
double around = theta + rotation;
//
// Convert 'around' and 'away' to X and Y.
double x = 0 + cos ( around ) * away;
double y = 0 + sin ( around ) * away;
//
// Now that you know it, do it.
ofVec2f pnt(x,y);
tempLine.curveTo(x,y);
// to a first approximation, the points are on a circle
// so the angle between them is chord/radius
theta += chord / away;
}
baseSpiral = tempLine.getVertices();
}
void Recording::durationToSpiral(int duration){
// target Length
int targetLength = round(duration/(1000/55));
//
// remove excess
// spiralToDraw.clear();
spiralToDraw =baseSpiral;
spiralToDraw.erase(spiralToDraw.begin(),spiralToDraw.begin() + (spiralToDraw.size() - targetLength) );
}
//
// Recording.h
// spiral
//
// Created by Caroline Record on 7/23/15.
//
//
#ifndef _TEST_APP
#define _TEST_APP
#include "ofMain.h"
#include "makeWav.h"
//#include "ofxLibsndFileRecorder.h"
#define NUM_CHANNELS 6
#define SAMPLE_RATE 44100
#define BUFFER_SIZE 1024
#define DIVISOR 2.0
class Recording{
public:
bool isRecording;
void startRecording();
string stopRecording(bool isSample=false);
void discardRecording();
void drawRecordingSpiral(int x, int y, int z);
void updateRecordingSpiral();
void setup(ofBaseApp *ref);
makeWave recordThis;
//ofxLibsndFileRecorder audioRecorder;
void drawText(ofEasyCam camera, ofTrueTypeFont fnt );
vector <float> left;
vector <float> right;
private:
string fileN;
bool toggleElipse;
int togStartTime;
int totalDuration;
ofPolyline toPlay;
int audioCount;
int startTime;
string absPath;
void fullSpiral();
void durationToSpiral(int duration);
vector<ofPoint> spiralToDraw;
vector<ofPoint> baseSpiral;
ofPlanePrimitive plane;
};
#endif
//
// Scheduler.h
// spiralPat
//
// Created by Caroline Record on 8/8/15.
//
//
#include "ofMain.h"
#include <tr1/unordered_map>
class ScheduleUnit
{
public:
string date;
string name;
vector<string> times;
vector<string> timesFullText;
string fullString;
bool isEmpty;
bool hasSecondMatch;
ScheduleUnit(){
//ofLog() << "yuppy";
isEmpty = true;
hasSecondMatch = false;
}
// a function that creates and returns the full string.
string makeFullString(){
fullString = " " + name + " / " + date + " /";
for(int i =0; i < timesFullText.size(); i++){
fullString += " "+ timesFullText.at(i) + " /" ;
}
fullString += "/";
isEmpty = false;
return fullString;
}
};
class Scheduler{
public:
void loadFileToHash(ofBaseApp *app);
vector <ScheduleUnit> compareDate(string timeStamp);
string trim(const std::string& str);
int timeInMinutes(string time);
std::vector<std::string> split(const std::string &s, char delim);
vector<ScheduleUnit> schedUnits;
private:
std::tr1::unordered_map< string, ScheduleUnit> hashtable;
};
//
// Scheduler.h
// spiralPat
//
// Created by Caroline Record on 8/8/15.
//
//
#include "ofMain.h"
#include <tr1/unordered_map>
class ScheduleUnit
{
public:
string date;
string name;
vector<string> times;
vector<string> timesFullText;
string fullString;
bool isEmpty;
bool hasSecondMatch;
ScheduleUnit(){
//ofLog() << "yuppy";
isEmpty = true;
hasSecondMatch = false;
}
// a function that creates and returns the full string.
string makeFullString(){
fullString = " " + name + " / " + date + " /";
for(int i =0; i < timesFullText.size(); i++){
fullString += " "+ timesFullText.at(i) + " /" ;
}
fullString += "/";
isEmpty = false;
return fullString;
}
};
class Scheduler{
public:
void loadFileToHash(ofBaseApp *app);
vector <ScheduleUnit> compareDate(string timeStamp);
string trim(const std::string& str);
int timeInMinutes(string time);
std::vector<std::string> split(const std::string &s, char delim);
vector<ScheduleUnit> schedUnits;
private:
std::tr1::unordered_map< string, ScheduleUnit> hashtable;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment