# HG changeset patch # User Robert Tubb # Date 1365510148 -3600 # Node ID a42903c61558a5458813bc2a8ee2333751c85908 # Parent 790939017078ddbed3a147d6a112be7c616622a7 Added sliderview (not operational though) diff -r 790939017078 -r a42903c61558 PresetAlertViewController.mm --- a/PresetAlertViewController.mm Mon Apr 08 17:23:13 2013 +0100 +++ b/PresetAlertViewController.mm Tue Apr 09 13:22:28 2013 +0100 @@ -39,7 +39,7 @@ alertTextField.placeholder = @"Preset Name"; [self.alert show]; self.alertShowing = YES; - [self.alert release]; + // [self.alert release]; } - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ diff -r 790939017078 -r a42903c61558 Question.m --- a/Question.m Mon Apr 08 17:23:13 2013 +0100 +++ b/Question.m Tue Apr 09 13:22:28 2013 +0100 @@ -43,6 +43,8 @@ // pseudo static variable if(type == AGREE_DISAGREE){ [Question setCount:NUM_CHOICES]; + + // potential leak return [[NSArray alloc] initWithObjects: @"Strongly agree",@"Agree", @"Neither agree nor disagree", @"Disagree",@"Strongly disagree", nil]; @@ -50,6 +52,7 @@ }else if(type == SLIDERS_ZOOMER){ [Question setCount:NUM_CHOICES]; + // potential leak return [[NSArray alloc] initWithObjects: @"definitely the Sliders", @"maybe the Sliders", @"Neither/Both equal", @"maybe the Zoomer", @"definitely the Zoomer", nil]; diff -r 790939017078 -r a42903c61558 QuestionnaireViewController.mm --- a/QuestionnaireViewController.mm Mon Apr 08 17:23:13 2013 +0100 +++ b/QuestionnaireViewController.mm Tue Apr 09 13:22:28 2013 +0100 @@ -207,7 +207,7 @@ // 1/3/13 removed q 6 and 15. now only 15 qs //---------------------------------------------------------------- - (void)populateQuestionArray{ - +// potential leak self.questionArray = [NSArray arrayWithObjects: [[Question alloc] initWithTextAndType:@"I am familiar with music software and sound synthesis.":AGREE_DISAGREE], [[Question alloc] initWithTextAndType:@"The best interface to get a feel for the possibilities of the synth was...":SLIDERS_ZOOMER], diff -r 790939017078 -r a42903c61558 ServerComms.mm --- a/ServerComms.mm Mon Apr 08 17:23:13 2013 +0100 +++ b/ServerComms.mm Tue Apr 09 13:22:28 2013 +0100 @@ -98,6 +98,7 @@ if([responseDataString isEqualToString:@"testConnection:OK"]){ eventLogger.testConnectionOK(); + [responseDataString release]; success = true; }else if([responseDataString isEqualToString:@"questionnaire:OK"]){ eventLogger.questionnaireOK(); @@ -136,6 +137,7 @@ if([responseDataString isEqualToString:@"testConnection:OK"]){ eventLogger.testConnectionOK(); + [responseDataString release]; }else if([responseDataString isEqualToString:@"questionnaire:OK"]){ eventLogger.questionnaireOK(); }else if([responseDataString isEqualToString:@"eventlog:OK"]){ @@ -172,6 +174,8 @@ // Do anything you want with it NSLog(@"response text: %@",responseText); + [responseText release]; + self.requestInProgress = NO; } diff -r 790939017078 -r a42903c61558 SliderViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SliderViewController.h Tue Apr 09 13:22:28 2013 +0100 @@ -0,0 +1,15 @@ +// +// SliderViewController.h +// sonicZoom +// +// Created by Robert Tubb on 01/02/2013. +// +// + +#import + +@interface SliderViewController : UIViewController +@property (nonatomic, assign) id theOFAppRef; +-(IBAction)hide:(id)sender; +-(IBAction)show:(id)sender; +@end diff -r 790939017078 -r a42903c61558 SliderViewController.mm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SliderViewController.mm Tue Apr 09 13:22:28 2013 +0100 @@ -0,0 +1,48 @@ +// +// SliderViewController.m +// sonicZoom +// +// Created by Robert Tubb on 01/02/2013. +// +// + +#import "SliderViewController.h" + +@interface SliderViewController () + +@end + +@implementation SliderViewController + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Custom initialization + } + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)setAppRef:(id)theOFApp{ + self.theOFAppRef = theOFApp; + +} + +- (IBAction)show:(id)sender +{ + self.theOFAppRef = sender; + self.view.hidden = NO; +} +@end diff -r 790939017078 -r a42903c61558 SliderViewController.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SliderViewController.xib Tue Apr 09 13:22:28 2013 +0100 @@ -0,0 +1,706 @@ + + + + 1536 + 11G63 + 2844 + 1138.51 + 569.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 1930 + + + IBProxyObject + IBUILabel + IBUISlider + IBUIView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 292 + + + + 292 + {{35, 52}, {81, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + Transpose + + 1 + MCAwIDAAA + darkTextColor + + + 0 + + 1 + 17 + + + Helvetica + 17 + 16 + + NO + + + + 292 + {{35, 111}, {62, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + 1/4 note + + + 0 + + + NO + + + + 292 + {{35, 171}, {62, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + 1/6 note + + + 0 + + + NO + + + + 292 + {{35, 228}, {62, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + 1/7 note + + + 0 + + + NO + + + + 292 + {{35, 288}, {62, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + 1/8 note + + + 0 + + + NO + + + + 292 + {{56, 16}, {188, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + Note Pattern Oscillations + + + 0 + + + NO + + + + 292 + {{470, 19}, {166, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + Synth Sound Controls + + + 0 + + + NO + + + + 292 + {{421, 82}, {308, 23}} + + + + _NS:9 + NO + IBIPadFramework + 0.5 + 127 + + 1 + MSAwIDAuMDExNzg4NjU2MTQAA + + + + + 292 + {{423, 52}, {78, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + Waveform + + + 0 + + + NO + + + + 292 + {{421, 142}, {308, 23}} + + + + _NS:9 + NO + IBIPadFramework + 0.5 + 127 + + + + + 292 + {{423, 111}, {82, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + FIlter Type + + + 0 + + + NO + + + + 292 + {{421, 199}, {308, 23}} + + + + _NS:9 + NO + IBIPadFramework + 0.5 + 127 + + + + + 292 + {{423, 171}, {123, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + Filter Frequency + + + 0 + + + NO + + + + 292 + {{421, 259}, {308, 23}} + + + + _NS:9 + NO + IBIPadFramework + 0.5 + 127 + + + + + 292 + {{423, 230}, {71, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + Envelope + + + 0 + + + NO + + + + 292 + {{421, 321}, {308, 23}} + + + _NS:9 + NO + IBIPadFramework + 0.5 + 127 + + + + + 292 + {{423, 288}, {86, 21}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + FM amount + + + 0 + + + NO + + + + 292 + {{33, 82}, {308, 23}} + + + _NS:9 + NO + IBIPadFramework + 0.5 + 127 + + 1 + MC4wMzAwMTkyNDA3MiAwLjMxNDIwOTgyMTQgMQA + + + + + 292 + {{33, 142}, {308, 23}} + + + _NS:9 + NO + IBIPadFramework + 0.5 + 127 + + + + + 292 + {{33, 199}, {308, 23}} + + + _NS:9 + NO + IBIPadFramework + 0.5 + 127 + + + + + 292 + {{33, 259}, {308, 23}} + + + _NS:9 + NO + IBIPadFramework + 0.5 + 127 + + + + + 292 + {{33, 321}, {308, 23}} + + + _NS:9 + NO + IBIPadFramework + 0.5 + 127 + + 1 + MC4wMzAwMTkyNDA3MiAwLjMxNDIwOTgyMTQgMQA + + + + {768, 363} + + + + + 1 + MC40ODg0NzIzMTY2IDAuNDg4NDcyMzE2NiAwLjQ4ODQ3MjMxNjYAA + + NO + + IBUISimulatedFreeformSizeMetricsSentinel + Freeform + + IBIPadFramework + + + + + + + view + + + + 3 + + + + + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 13 + + + + + 18 + + + + + 32 + + + + + 34 + + + + + 55 + + + + + 72 + + + + + 76 + + + + + 81 + + + + + + 82 + + + + + 83 + + + + + + 84 + + + + + 85 + + + + + + 86 + + + + + 87 + + + + + + 88 + + + + + 89 + + + + + + 90 + + + + + 234 + + + + + + 235 + + + + + 236 + + + + + 237 + + + + + 238 + + + + + + + SliderViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 286 + + + + + SliderViewController + UIViewController + + id + id + + + + hide: + id + + + show: + id + + + + IBProjectSource + ./Classes/SliderViewController.h + + + + + 0 + IBIPadFramework + YES + 3 + 1930 + + diff -r 790939017078 -r a42903c61558 TopButtonViewController.h --- a/TopButtonViewController.h Mon Apr 08 17:23:13 2013 +0100 +++ b/TopButtonViewController.h Tue Apr 09 13:22:28 2013 +0100 @@ -17,6 +17,7 @@ @property (retain, nonatomic) IBOutlet UIBarButtonItem *pauseButton; @property (retain, strong, nonatomic) IBOutlet UIBarButtonItem *qButton; @property (retain, strong,nonatomic) IBOutlet UIBarButtonItem *newUserButton; +- (IBAction)nextSequence:(id)sender; -(IBAction)show:(id)sender; -(void)setAppRef:(id)theOFApp; diff -r 790939017078 -r a42903c61558 TopButtonViewController.mm --- a/TopButtonViewController.mm Mon Apr 08 17:23:13 2013 +0100 +++ b/TopButtonViewController.mm Tue Apr 09 13:22:28 2013 +0100 @@ -34,15 +34,15 @@ // Do any additional setup after loading the view from its nib. self.playButton.enabled = true; self.pauseButton.enabled = false; - self.qButton.enabled = true; + self.qButton.enabled = false; self.newUserButton.enabled = true; //------------------------ // Get the reference to the current toolbar buttons - NSMutableArray *toolbarButtons = [self.toolbarItems mutableCopy]; + //NSMutableArray *toolbarButtons = [self.toolbarItems mutableCopy]; // This is how you remove the button from the toolbar and animate it - [toolbarButtons removeObject:self.qButton]; - [self setToolbarItems:toolbarButtons animated:YES]; + //[toolbarButtons removeObject:self.qButton]; + //[self setToolbarItems:toolbarButtons animated:YES]; // This is how you add the button to the toolbar and animate it /* @@ -130,6 +130,10 @@ ((testApp *)self.theOFAppRef)->setupNewUser(); } +- (IBAction)nextSequence:(id)sender { + ((testApp *)self.theOFAppRef)->nextSequence(); +} + - (IBAction)show:(id)sender { self.theOFAppRef = sender; diff -r 790939017078 -r a42903c61558 TopButtonViewController.xib --- a/TopButtonViewController.xib Mon Apr 08 17:23:13 2013 +0100 +++ b/TopButtonViewController.xib Tue Apr 09 13:22:28 2013 +0100 @@ -81,6 +81,12 @@ 18 + + IBIPadFramework + 1 + + 20 + IBIPadFramework @@ -248,6 +254,14 @@ 38 + + + nextSequence: + + + + 42 + @@ -290,6 +304,7 @@ + @@ -353,6 +368,11 @@ + + 41 + + + @@ -372,6 +392,7 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -379,7 +400,7 @@ - 40 + 42 @@ -391,6 +412,7 @@ id id id + id id id id @@ -415,6 +437,10 @@ newUser: id + + nextSequence: + id + pausePressed: id diff -r 790939017078 -r a42903c61558 UsernameAlertViewController.mm --- a/UsernameAlertViewController.mm Mon Apr 08 17:23:13 2013 +0100 +++ b/UsernameAlertViewController.mm Tue Apr 09 13:22:28 2013 +0100 @@ -28,7 +28,7 @@ alertTextField.keyboardType = UIKeyboardTypeDefault; alertTextField.placeholder = @"Username"; [self.alert show]; - [self.alert release]; + //[self.alert release]; } diff -r 790939017078 -r a42903c61558 eventLogger.mm --- a/eventLogger.mm Mon Apr 08 17:23:13 2013 +0100 +++ b/eventLogger.mm Tue Apr 09 13:22:28 2013 +0100 @@ -229,6 +229,7 @@ //----------------------------- void EventLogger::questionnaireOK(){ questionnaireUploaded = true; + questionnaireComments = ""; } //----------------------------- void EventLogger::eventlogOK(){ diff -r 790939017078 -r a42903c61558 hilbert.cpp --- a/hilbert.cpp Mon Apr 08 17:23:13 2013 +0100 +++ b/hilbert.cpp Tue Apr 09 13:22:28 2013 +0100 @@ -190,7 +190,7 @@ } // for loop thru bit levels - i=0; + for(int blev = N-1; blev >= 0; blev--){ // get next highest bits of index @@ -254,7 +254,7 @@ // for loop thru bit levels - i=0; + for(int blev = N-1; blev >= 0; blev--){ //% get next highest bit of param diff -r 790939017078 -r a42903c61558 testApp.h --- a/testApp.h Mon Apr 08 17:23:13 2013 +0100 +++ b/testApp.h Tue Apr 09 13:22:28 2013 +0100 @@ -69,6 +69,8 @@ vector sliderVals; vector freqIndexes; + vector > sequences; + int currentSequence; int numActiveTouches; bool preventingMovePostScroll; @@ -118,6 +120,8 @@ void helpHidden(); // shortcut function for testing void justStart(); + void loadSequences(); + void nextSequence(); void setupBottomGui(); void bottomGuiEvent(); diff -r 790939017078 -r a42903c61558 testApp.mm --- a/testApp.mm Mon Apr 08 17:23:13 2013 +0100 +++ b/testApp.mm Tue Apr 09 13:22:28 2013 +0100 @@ -23,6 +23,7 @@ ofBackground( 0, 0, 0 ); ofEnableAlphaBlending(); + currentSequence = 0; //ofEnableSmoothing(); // open an outgoing connection to HOST:PORT for OSC @@ -103,7 +104,7 @@ [helpViewController setAppRef:(id)this]; helpViewController.view.hidden = YES; - /* + sliderViewController = [[SliderViewController alloc] initWithNibName:@"SLiderViewController" bundle:nil]; [ofxiPhoneGetGLParentView() addSubview:sliderViewController.view]; @@ -111,8 +112,11 @@ [sliderViewController show:(id)this]; sliderViewController.view.frame = CGRectMake(0,getHeight()-43 - 363,getWidth(),44); - */ + + // load preset sequences + loadSequences(); + // initialise user logging stuff presetManager.startLoadAll(); tsc = [[TimedSessionController alloc] init]; @@ -130,10 +134,11 @@ // GO paused = false; - randomise(); // everyone starts from random position + randomise(); // everyone starts from random position (or where they left off??) ofxiPhoneExternalDisplay::mirrorOn(); + } @@ -409,8 +414,18 @@ } //-------------------------------------------------------------- +void testApp::nextSequence(){ + currentSequence++; + if(currentSequence >= sequences.size()){ + currentSequence = 0; + } + sendParametersToPD(); +} +//-------------------------------------------------------------- void testApp::sendParametersToPD(){ + // frequencer stuff to get 16 steps + /* vector vals; @@ -420,14 +435,21 @@ } vector steps = frequencer.freqMagEdit(freqIndexes, vals); + + */ + // send a list using the List object List seqSteps; seqSteps.addSymbol("seqSteps"); + if(currentSequence > sequences.size() || currentSequence < 0){ + cout << "ERROR: not a valid sequence index\n"; + } for(int i=0; i < 16; i++){ - seqSteps.addFloat(round(steps[i])); // rounding here?? + seqSteps.addFloat(round(sequences[currentSequence][i])); // rounding here?? } + core.pd.sendList("fromOF", seqSteps); sendOscShape(sliderVals[5]); @@ -1015,3 +1037,51 @@ sequenceFile << root; } //=-------------------------------------------------------------------- +void testApp::loadSequences(){ + + // read in sequence preset file + string jsonFile = ofxiPhoneGetDocumentsDirectory() + "pilot_sequences.json"; + + Json::Value root; + Json::Reader reader; + + ifstream theFile(jsonFile.c_str()); + stringstream fileText; + string line; + if(!theFile){ + cout<<"can't find sequence file: " << jsonFile.c_str() << "\n"; + return; + }else{ + + while(theFile){ + theFile >> line; + // cout << line << "\n"; // lots? + fileText << line; + } + + theFile.close(); + } + + bool parsingSuccessful = reader.parse( fileText.str(), root ); + + if ( !parsingSuccessful ) + { + // report to the user the failure and their locations in the document. + std::cout << "Failed to parse sequence JSON: \n" + << reader.getFormattedErrorMessages(); + return; + } + + // now put into variables + const Json::Value jseqs = root["sequences"]; + int N = jseqs.size(); + for(int i=0; i()); + for(int j=0; j