Mercurial > hg > soniczoomios
changeset 32:ab7c86d0f3d8
V0.3 SZBeta sent out. bristol tests.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Fri, 08 Mar 2013 14:54:55 +0000 |
parents | 23ef179c3748 |
children | 92dba082d957 |
files | PresetAlertViewController.mm QuestionnaireViewController.h QuestionnaireViewController.mm ServerComms.mm TimedSessionController.h TopButtonViewController.mm eventLogger.h eventLogger.mm grid.mm presetManager.h presetManager.mm testApp.h testApp.mm |
diffstat | 13 files changed, 99 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/PresetAlertViewController.mm Fri Mar 01 13:28:45 2013 +0000 +++ b/PresetAlertViewController.mm Fri Mar 08 14:54:55 2013 +0000 @@ -59,7 +59,7 @@ presetManager.printAll(); eventLogger.printAll(); }else if([[[alertView textFieldAtIndex:0] text] isEqualToString:@"questionnaire"]){ - ((testApp *)ofGetAppPtr())->interfaceSelected(3); + ((testApp *)ofGetAppPtr())->showQuestionnaire(); }else{ presetManager.addPreset([[[alertView textFieldAtIndex:0] text] cStringUsingEncoding:NSASCIIStringEncoding]); @@ -77,7 +77,7 @@ presetManager.printAll(); eventLogger.printAll(); }else if([[[self.alert textFieldAtIndex:0] text] isEqualToString:@"questionnaire"]){ - ((testApp *)ofGetAppPtr())->interfaceSelected(3); + ((testApp *)ofGetAppPtr())->showQuestionnaire(); }else{ presetManager.addPreset([[[self.alert textFieldAtIndex:0] text] cStringUsingEncoding:NSASCIIStringEncoding]);
--- a/QuestionnaireViewController.h Fri Mar 01 13:28:45 2013 +0000 +++ b/QuestionnaireViewController.h Fri Mar 08 14:54:55 2013 +0000 @@ -39,6 +39,7 @@ -(IBAction)show:(id)sender; - (IBAction)nextQuestionPressed:(id)sender; - (IBAction)previousQuestionPressed:(id)sender; +-(void)unlockAll; //---------------------------------------------------------------- - (void)setAppRef:(id)theOFApp; - (void)populateQuestionArray;
--- a/QuestionnaireViewController.mm Fri Mar 01 13:28:45 2013 +0000 +++ b/QuestionnaireViewController.mm Fri Mar 08 14:54:55 2013 +0000 @@ -202,6 +202,7 @@ [picker selectRow:2 inComponent:0 animated:YES]; } +// 1/3/13 removed q 6 and 15. now only 15 qs //---------------------------------------------------------------- - (void)populateQuestionArray{ @@ -211,21 +212,21 @@ [[Question alloc] initWithTextAndType:@"The best interface for discovering interesting sounds quickly was...":SLIDERS_ZOOMER], [[Question alloc] initWithTextAndType:@"The best interface for fine tuning a sound was...":SLIDERS_ZOOMER], [[Question alloc] initWithTextAndType:@"The correspondence between the sliders and the grid was understandable.":AGREE_DISAGREE], - [[Question alloc] initWithTextAndType:@"The interface that felt more familiar was:":SLIDERS_ZOOMER], [[Question alloc] initWithTextAndType:@"Scrolling a greater distance on the grid seemed to correspond to larger difference in the sound.":AGREE_DISAGREE], [[Question alloc] initWithTextAndType:@"The interface that I felt more in control using was...":SLIDERS_ZOOMER], - [[Question alloc] initWithTextAndType:@"The ability to see other presets laid on the grid was useful.":AGREE_DISAGREE], // ???????? + [[Question alloc] initWithTextAndType:@"Being able to see previously saved presets laid on the grid is useful.":AGREE_DISAGREE], // [[Question alloc] initWithTextAndType:@"The interface that felt more creative was...":SLIDERS_ZOOMER], - [[Question alloc] initWithTextAndType:@"The range of sounds was too limited/poor quality to be able to judge the eventual usefulness of the interface.":AGREE_DISAGREE], + [[Question alloc] initWithTextAndType:@"The range of sounds was too limited to be able to judge the eventual usefulness of the interface.":AGREE_DISAGREE], [[Question alloc] initWithTextAndType:@"The interface better for generating new ideas was...":SLIDERS_ZOOMER], [[Question alloc] initWithTextAndType:@"The interface better for performing live would be...":SLIDERS_ZOOMER], [[Question alloc] initWithTextAndType:@"The Zoomer was an improvement on just using a randomiser.":AGREE_DISAGREE], - [[Question alloc] initWithTextAndType:@"The interface better for creating a specific sound I had in mind would be...":SLIDERS_ZOOMER], // not instructed ????? [[Question alloc] initWithTextAndType:@"The combination of Zoomer and Sliders was better than either individually.":AGREE_DISAGREE], [[Question alloc] initWithTextAndType:@"Overall, the interface I preferred using was...":SLIDERS_ZOOMER], // ?????? nil]; - + // The zoomer seemed more appropriate to explore the synth sound controls (red) than the note sequence controls (blue) +// I enjoyed the sounds produced + } //----------------------------------------------------------------
--- a/ServerComms.mm Fri Mar 01 13:28:45 2013 +0000 +++ b/ServerComms.mm Fri Mar 08 14:54:55 2013 +0000 @@ -31,7 +31,7 @@ NSString *localServerURL = @"http://127.0.0.1:8080/testservice/"; NSString *webServerURL = @"http://www.isophonics.net/datacollector/"; - NSString *urls = [localServerURL stringByAppendingString:type]; + NSString *urls = [webServerURL stringByAppendingString:type]; NSURL *url = [NSURL URLWithString:urls]; @@ -65,7 +65,7 @@ NSString *localServerURL = @"http://127.0.0.1:8080/testservice/"; NSString *webServerURL = @"http://www.isophonics.net/datacollector/"; - NSString *urls = [localServerURL stringByAppendingString:type]; + NSString *urls = [webServerURL stringByAppendingString:type]; NSURL *url = [NSURL URLWithString:urls]; @@ -92,7 +92,7 @@ NSString *responseDataString = [[NSString alloc] initWithData:result encoding:NSUTF8StringEncoding]; //NSString* responseDataString = [NSString stringWithUTF8String: ]; - NSLog(@"didRecieveDta %@", responseDataString); + NSLog(@"sync req. data %@", responseDataString); [self.data appendData:result]; if([responseDataString isEqualToString:@"testConnection:OK"]){
--- a/TimedSessionController.h Fri Mar 01 13:28:45 2013 +0000 +++ b/TimedSessionController.h Fri Mar 08 14:54:55 2013 +0000 @@ -5,7 +5,7 @@ // Created by Robert Tubb on 18/02/2013. // // -#define SECONDS_PER_INTERFACE 1 +#define SECONDS_PER_INTERFACE 300 #import <Foundation/Foundation.h>
--- a/TopButtonViewController.mm Fri Mar 01 13:28:45 2013 +0000 +++ b/TopButtonViewController.mm Fri Mar 08 14:54:55 2013 +0000 @@ -110,7 +110,9 @@ NSLog(@"button title error"); } } - +-(void)unlockAll{ + +} - (IBAction)qPressed:(id)sender { ((testApp *)self.theOFAppRef)->showQuestionnaire(); }
--- a/eventLogger.h Fri Mar 01 13:28:45 2013 +0000 +++ b/eventLogger.h Fri Mar 08 14:54:55 2013 +0000 @@ -24,18 +24,18 @@ #include "2dvector.h" #include "json.h" #include "testApp.h" - +#include "presetManager.h" #import "ServerComms.h" #define EVENT_THIN_FACTOR 10 #define EVENT_LOG_FILENAME "log.json" //#define LOGGING_SERVER_URL "http://www.isophonics.net/datacollector/" #define LOGGING_SERVER_URL "http://127.0.0.1:8080/testservice/" -#define UPLOAD_CHUNK_SIZE 2000 +#define UPLOAD_CHUNK_SIZE 1000 #define APP_CREATION_TIME 381429000000 // milliseconds to the time i wrote this wee blighter. saves digits -#define PROGRAM_VERSION 0.2 // IMPORTANT TOCHNAGE! +#define PROGRAM_VERSION 0.3 // IMPORTANT TOCHNAGE! // can add but don't change ordering - this will invalidate logs enum leventType {SAVE_PRESET, // 0 @@ -69,7 +69,7 @@ double val1; // x coord, scale if zoom double val2; // y coord, 0 if zoom int sliderID; // xtra int - long long eventTime; + long long eventTime; // MILLISECONDS since app creation lEvent(leventType eType, double v1 = 0.0, double v2 = 0.0,int sID = 0){ eventType = eType; val1 = v1; @@ -129,14 +129,7 @@ return os; } //--------------------------------------------------------------------------- - - class ThreadedObject: ofThread{ - int i; - int threadedFunc(int i){ - return i + 10; - }; - }; - + class EventLogger{ public: @@ -173,6 +166,7 @@ void testConnectionNotOK(); void printAll(); + void saveSessionToFile(); private: vector<lEvent> theEvents;
--- a/eventLogger.mm Fri Mar 01 13:28:45 2013 +0000 +++ b/eventLogger.mm Fri Mar 08 14:54:55 2013 +0000 @@ -10,6 +10,7 @@ #include "eventLogger.h" EventLogger eventLogger; +extern PresetManager presetManager; //--------------------------------------------------------------------------- EventLogger::EventLogger(){ @@ -209,7 +210,7 @@ //----------------------------- void EventLogger::eventlogOK(){ // IF UPLAODING FROM IPAD TO XCODE - //theEvents.clear(); + theEvents.clear(); cout << "EVENT LOG UPLOAD SUCCESS\n"; nextUploadNumber++; logUploadInProgress = false; @@ -221,17 +222,19 @@ } //----------------------------- void EventLogger::questionnaireNotOK(){ + cout << "XXXXX questionnaire NOT OK XXXXXXX \n"; questionnaireUploaded = false; } //----------------------------- void EventLogger::eventlogNotOK(){ // try later + cout << "XXXXX event log NOT OK XXXXXXX \n"; nextUploadQty += UPLOAD_CHUNK_SIZE; logUploadInProgress = false; } //----------------------------- void EventLogger::testConnectionNotOK(){ - cout << "^^^^^^^^ server connection NOT OK ^^^^^^^^ \n"; + cout << "XXXXX server connection NOT OK XXXXXXX \n"; serverConnectionOK = false; // alert? @@ -254,7 +257,7 @@ // if success - clear memory // IF UPLAODING FROM IPAD TO XCODE COMMENT OUT - //theEvents.clear(); + theEvents.clear(); cout << "UPLOAD SUCCESS\n"; nextUploadNumber++; } @@ -267,12 +270,14 @@ //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- -//void EventLogger::deleteLogFile(){ - //--------------------------------------------------------------------------- // only called when doing supervised tests void EventLogger::newUser(){ + // store old stuff + + saveSessionToFile(); + presetManager.saveSessionToFile(userName); cout<<"setup new user\n"; deleteLogs(); nextUploadNumber = 0; @@ -486,3 +491,15 @@ cout << questionnaireToJson() << "\n"; }; //--------------------------------------------------------------------------- + +void EventLogger::saveSessionToFile(){ + string fname = ofxiPhoneGetDocumentsDirectory() + userName + '_' + EVENT_LOG_FILENAME; + + // write to file + // json without the logs that were uploaded! + Json::Value jlogs = logsToJson(); + ofFile logFile(fname,ofFile::WriteOnly); + logFile << jlogs; + logFile.close(); + +}
--- a/grid.mm Fri Mar 01 13:28:45 2013 +0000 +++ b/grid.mm Fri Mar 08 14:54:55 2013 +0000 @@ -71,8 +71,14 @@ /// // TODO 5bit specific // transition sequence.... what a palaver! only need to do once though. + + // max MRL int trans[] = {0,1,2,3,0,4,2,1,0,3,2,1,0,4,2,3,0,1,2,3,0,4,2,1,0,3,2,1,0,4,2,3}; - + // balanced + int transB[] = {1,2,3,4,5,1,5,2,3,5,2,4,2,3,4,1,4,3,2,3,1,5,3,4,1,5,2,5,3,4,1,3}; + for(int i = 0; i<codeLength; i++){ + transB[i] = transB[i] - 1; + } int code[codeLength][paramsPerDim]; // start with normal array @@ -82,7 +88,7 @@ code[0][j] = 0; } - for(int i=0; i < codeLength-1; i++){ // TODO went off end?? + for(int i=0; i < codeLength-1; i++){ // don't need last 3 transSeq.push_back(trans[i]); // member vector for(int j=0; j<paramsPerDim; j++){
--- a/presetManager.h Fri Mar 01 13:28:45 2013 +0000 +++ b/presetManager.h Fri Mar 08 14:54:55 2013 +0000 @@ -119,6 +119,7 @@ void readJsonToPresets(const string &jsonFile); void showNameDialog(); PresetManager(); + void saveSessionToFile(string userName); };
--- a/presetManager.mm Fri Mar 01 13:28:45 2013 +0000 +++ b/presetManager.mm Fri Mar 08 14:54:55 2013 +0000 @@ -264,7 +264,17 @@ presetFile << root; } - +//--------------------------------------------------------------------------- +void PresetManager::saveSessionToFile(string userName){ // for supervised newUser() + ofFile presetFile(ofxiPhoneGetDocumentsDirectory() + userName + '_' + PRESET_FILENAME,ofFile::WriteOnly); + + // stick all the stuff in a json value + Json::Value root = allPresetsToJson(); + + cout << root; + presetFile << root; + +} //--------------------------------------------------------------------------- void PresetManager::clearAll(){ thePresets.clear();
--- a/testApp.h Fri Mar 01 13:28:45 2013 +0000 +++ b/testApp.h Fri Mar 08 14:54:55 2013 +0000 @@ -3,6 +3,7 @@ #include "ofMain.h" #include "ofxiPhone.h" #include "ofxiPhoneExtras.h" +#include "ofxiPhoneExternalDisplay.h" #include "ofxOsc.h" #include "grid.h" #include "2dvector.h" @@ -31,7 +32,7 @@ typedef enum {SLIDERS,ZOOMER,BOTH,INTRO,QUESTIONNAIRE, HELP}interfaceType; -class testApp : public ofxiPhoneApp { +class testApp : public ofxiPhoneApp , public ofxiPhoneExternalDisplay{ public:
--- a/testApp.mm Fri Mar 01 13:28:45 2013 +0000 +++ b/testApp.mm Fri Mar 08 14:54:55 2013 +0000 @@ -128,6 +128,12 @@ // GO paused = false; + randomise(); // everyone starts from random position + + ofxiPhoneExternalDisplay::mirrorOn(); + + double timemsd = [NSDate timeIntervalSinceReferenceDate]; + cout << "TIME: " << timemsd << '\n'; } @@ -221,12 +227,11 @@ void testApp::questionnaireHidden(vector<int> answers, const char* userComments){ // send answers to server as json eventLogger.questionnaireAnswersObtained(answers, userComments); + + // tell bottomtabviewcontroller to show and select both interface + interfaceSelected(BOTH); + [bottomTabViewController show:(id)this withSelection:1]; - // set "we've done questionnaire" to true in event logger - - whichInterfaceShowing = BOTH; - // tell bottomtabviewcontroller - [bottomTabViewController show:(id)this withSelection:1]; } //-------------------------------------------------------------- @@ -255,6 +260,9 @@ presetManager.clearAll(); // show username prompt [usernameAlertViewController showUserNamePrompt]; + // reset top buttons + [topButtonViewController unlockAll]; + randomise(); } // no unOK } @@ -434,10 +442,24 @@ if(paused) return; + if(ofxiPhoneExternalDisplay::isExternalScreenConnected()){ + if(!ofxiPhoneExternalDisplay::isMirroring()){ + ofxiPhoneExternalDisplay::mirrorOn(); + printf("turned on Mirroring!\n"); + } + } + // continiue to move or zoom at velocity, unless snapped if (numActiveTouches == 0){ // no touches, use momentum - + // ZOOM MOMENTUM + // continiue to zoom at velocity + if (numActiveTouches < 2 && abs(zoomVel)>0.001){ + theGridView.zoom(zoomVel + 1.0); // +1 because zoomVel factor is + or - , wheras zoom is a multiplier near 1 + zoomVel = zoomVel*slowFactor; + moveVel.setCoord(0.0,0.0);; // don't move if zooming! Too many events! + } + if(moveVel.norm() > 0.3){ if(theGridView.snapped){ // stop it (snap check sends snap event) @@ -459,14 +481,11 @@ }else{ // stopped - do nothing } + + } - // ZOOM MOMENTUM - // continiue to zoom at velocity - if (numActiveTouches < 2 && abs(zoomVel)>0.001){ - theGridView.zoom(zoomVel + 1.0); // +1 because zoomVel factor is + or - , wheras zoom is a multiplier near 1 - zoomVel = zoomVel*slowFactor; - } + } //-------------------------------------------------------------- @@ -524,6 +543,8 @@ if(touch.id == 0){ touch0.setCoord(touch.x,touch.y); prevTouch0 = touch0; + // stop zoom + zoomVel = 0.0; }else if(touch.id == 1){ touch1.setCoord(touch.x,touch.y);