Changeset 066b060 in orbit
- Timestamp:
- 08/21/13 07:37:47 (9 years ago)
- Branches:
- master, Servo, Tab_Interface, pyramid
- Children:
- 1472980
- Parents:
- e8cd830 (diff), 8a0f920f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- iOS/Orbit
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
iOS/Orbit/Orbit/SignalConverter.m
r7945ecb r8a0f920f 185 185 */ 186 186 187 NSLog(@"Output: %@ is %@", output, kAudioSessionOutputRoute_Headphones);188 187 return CFStringCompare(output, kAudioSessionOutputRoute_Headphones, 0) == kCFCompareEqualTo; 189 188 } -
iOS/Orbit/Orbit/controllers/FlightViewController.h
rde10cbc r8a0f920f 15 15 } 16 16 17 @property (nonatomic, retain) IBOutlet UILabel *status;18 17 @property (nonatomic, retain) IBOutlet UIProgressView *attention; 19 18 @property (nonatomic, retain) IBOutlet UILabel *attentionPercent; -
iOS/Orbit/Orbit/controllers/FlightViewController.m
r359a504 r8a0f920f 23 23 @implementation FlightViewController { 24 24 SignalConverter *signalConverter; 25 int deviceStatus; 25 int deviceStatus; 26 BOOL warned; 26 27 } 27 28 28 @synthesize status,attention, meditation, signal, power, attentionThreshold, meditationThreshold, connectButton, testButton, statusImage, signalPercent, attentionPercent, meditationPercent, powerPercent;29 @synthesize attention, meditation, signal, power, attentionThreshold, meditationThreshold, connectButton, testButton, statusImage, signalPercent, attentionPercent, meditationPercent, powerPercent; 29 30 30 31 - (void)viewDidLoad … … 35 36 36 37 signalConverter.delegate = self; 37 [self.attentionThreshold addTarget:self action:@selector(sliderChanged) forControlEvents:UIControlEventValueChanged]; 38 [self.meditationThreshold addTarget:self action:@selector(sliderChanged) forControlEvents:UIControlEventValueChanged]; 38 [self setThresholds]; 39 [self.attentionThreshold addTarget:self action:@selector(setThresholds) forControlEvents:UIControlEventValueChanged]; 40 [self.meditationThreshold addTarget:self action:@selector(setThresholds) forControlEvents:UIControlEventValueChanged]; 39 41 } 40 42 … … 52 54 power.progress = 0; 53 55 powerPercent.text = @"0%"; 54 [self logMessage:@"Disconnected"];55 56 [self updateStatusImage:STATUS_DEFAULT]; 56 57 connectButton.title = @"Connect"; … … 62 63 [statusImage setImage: [UIImage imageNamed:[NSString stringWithFormat:@"status_%u", statusNo]]]; 63 64 deviceStatus = statusNo; 64 if (statusNo == STATUS_CONNECTED) {65 [self logMessage:@"Check headset fitted properly"];66 } else if (statusNo == STATUS_PROCESSING) {67 [self logMessage:@"Increase your concentration"];68 } else if (statusNo == STATUS_ACTIVE) {69 [self logMessage:@"Flying!"];70 }71 65 } 72 66 } 73 67 74 - (void) s liderChanged68 - (void) setThresholds 75 69 { 76 70 [signalConverter setValuesForAttention:attentionThreshold.value meditation:meditationThreshold.value]; 77 }78 79 - (void) logMessage:(NSString *) str80 {81 status.text = str;82 71 } 83 72 … … 113 102 - (void) notifyHeadsetConnect 114 103 { 115 [self logMessage:@"Headset connected"];116 104 [self updateStatusImage:STATUS_CONNECTING]; 117 105 } … … 125 113 - (void) notifyDeviceConnected:(NSString *)name 126 114 { 127 [self logMessage:[NSString stringWithFormat:@"EEG device %@ connected", name]];128 115 [self updateStatusImage:STATUS_CONNECTING]; 129 116 connectButton.title = @"Disconnect"; … … 146 133 BOOL headphones = [signalConverter isAudioJackPlugged]; 147 134 148 if (! volumeMax && !headphones) {135 if (!warned && !volumeMax && !headphones) { 149 136 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Check Volume & Transmitter" message:@"Ensure the volume is at max and the transmitter is plugged into the headphones" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 150 137 [alert show]; 151 } else if (! volumeMax) {138 } else if (!warned && !volumeMax) { 152 139 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Turn Up The Volume" message:@"Your device volume must be at the maximum for proper operation" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 153 140 [alert show]; 154 } else if (! headphones) {141 } else if (!warned && !headphones) { 155 142 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Plug In The Transmitter" message:@"Ensure the infrared transmitter is plugged into the headphone jack" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 156 143 [alert show]; … … 159 146 [alert show]; 160 147 } else if ([signalConverter startProcessing]) { 161 [self logMessage:@"Searching for device"];162 148 connectButton.title = @"Disconnect"; 163 149 } else { … … 165 151 [alert show]; 166 152 } 153 warned = YES; 167 154 } 168 155 } -
iOS/Orbit/Orbit/en.lproj/MainStoryboard.storyboard
r28bce14 r8a0f920f 1 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="3084" systemVersion="11G63 b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="T1J-Fd-fkz">2 <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="3084" systemVersion="11G63" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="T1J-Fd-fkz"> 3 3 <dependencies> 4 4 <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="2083"/> … … 243 243 </navigationBar> 244 244 <view contentMode="scaleToFill" id="vgz-EV-JZc" userLabel="Attention Background"> 245 <rect key="frame" x="6" y="47" width="309" height=" 55"/>245 <rect key="frame" x="6" y="47" width="309" height="62"/> 246 246 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 247 247 <subviews> … … 254 254 </label> 255 255 <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.69999999999999996" minValue="0.0" maxValue="1" id="ym8-zN-dSb" userLabel="Attention Threshold"> 256 <rect key="frame" x="4" y="3 3" width="254" height="23"/>256 <rect key="frame" x="4" y="34" width="254" height="23"/> 257 257 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> 258 258 </slider> … … 278 278 </view> 279 279 <view contentMode="scaleToFill" id="6bR-ua-0jV" userLabel="Meditation Background"> 280 <rect key="frame" x="6" y="1 08" width="309" height="57"/>280 <rect key="frame" x="6" y="117" width="309" height="63"/> 281 281 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 282 282 <subviews> … … 299 299 </label> 300 300 <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.69999999999999996" minValue="0.0" maxValue="1" id="LJj-vt-JUw" userLabel="Meditation Threshold"> 301 <rect key="frame" x="6" y="3 5" width="254" height="23"/>301 <rect key="frame" x="6" y="36" width="254" height="23"/> 302 302 </slider> 303 303 </subviews> … … 310 310 </view> 311 311 <view contentMode="scaleToFill" id="DEF-SC-IYQ" userLabel="Meditation Background"> 312 <rect key="frame" x="6" y="1 71" width="309" height="64"/>312 <rect key="frame" x="6" y="189" width="309" height="72"/> 313 313 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 314 314 <subviews> 315 315 <progressView opaque="NO" contentMode="scaleToFill" id="AuD-cU-2pt" userLabel="Signal"> 316 <rect key="frame" x="4" y="2 0" width="254" height="9"/>316 <rect key="frame" x="4" y="23" width="254" height="9"/> 317 317 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> 318 318 <color key="progressTintColor" red="0.0" green="1" blue="0.017424847109999999" alpha="1" colorSpace="calibratedRGB"/> 319 319 </progressView> 320 320 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Signal" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="JXh-II-yAS"> 321 <rect key="frame" x="6" y=" 1" width="48" height="17"/>321 <rect key="frame" x="6" y="3" width="48" height="17"/> 322 322 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 323 323 <fontDescription key="fontDescription" type="system" pointSize="14"/> … … 326 326 </label> 327 327 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Hover" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="oUh-1C-0bs"> 328 <rect key="frame" x="6" y=" 26" width="46" height="21"/>328 <rect key="frame" x="6" y="31" width="46" height="21"/> 329 329 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> 330 330 <fontDescription key="fontDescription" type="system" pointSize="14"/> … … 333 333 </label> 334 334 <progressView opaque="NO" contentMode="scaleToFill" id="KeR-cO-90u" userLabel="Power"> 335 <rect key="frame" x="4" y=" 49" width="254" height="9"/>335 <rect key="frame" x="4" y="54" width="254" height="9"/> 336 336 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> 337 337 <color key="progressTintColor" red="1" green="0.84573597209999996" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> 338 338 </progressView> 339 339 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="0%" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="yYn-76-IoI"> 340 <rect key="frame" x="263" y="1 6" width="46" height="17"/>340 <rect key="frame" x="263" y="19" width="46" height="17"/> 341 341 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 342 342 <fontDescription key="fontDescription" type="system" pointSize="14"/> … … 345 345 </label> 346 346 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="0%" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="ah9-c0-kCb"> 347 <rect key="frame" x="263" y="4 1" width="46" height="23"/>347 <rect key="frame" x="263" y="46" width="46" height="23"/> 348 348 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> 349 349 <fontDescription key="fontDescription" type="system" pointSize="14"/> … … 363 363 </view> 364 364 <view contentMode="scaleToFill" id="lfi-AW-BAx"> 365 <rect key="frame" x="7" y="243" width="308" height="163"/> 366 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 367 <subviews> 368 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Disconnected" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="BOS-Js-1rx" userLabel="Status"> 369 <rect key="frame" x="20" y="126" width="268" height="32"/> 370 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> 371 <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/> 372 <fontDescription key="fontDescription" type="system" pointSize="16"/> 373 <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/> 374 <nil key="highlightedColor"/> 375 <userDefinedRuntimeAttributes> 376 <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> 377 <real key="value" value="5"/> 378 </userDefinedRuntimeAttribute> 379 </userDefinedRuntimeAttributes> 380 </label> 365 <rect key="frame" x="7" y="269" width="308" height="137"/> 366 <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 367 <subviews> 381 368 <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFit" image="status_0.png" id="aa9-oz-0Qj"> 382 <rect key="frame" x="66" y=" 0.0" width="177" height="126"/>369 <rect key="frame" x="66" y="6" width="177" height="126"/> 383 370 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/> 384 371 </imageView> … … 408 395 <outlet property="signal" destination="AuD-cU-2pt" id="uuu-hc-E2e"/> 409 396 <outlet property="signalPercent" destination="yYn-76-IoI" id="4Ei-JM-jZ1"/> 410 <outlet property="status" destination="BOS-Js-1rx" id="fDM-Of-lza"/>411 397 <outlet property="statusImage" destination="aa9-oz-0Qj" id="ilQ-PQ-gI8"/> 412 398 <outlet property="testButton" destination="Geo-cL-sK5" id="P8n-GW-Eih"/> -
iOS/Orbit/Orbit/AudioGenerator.m
rce0a7ee r9b2949b 123 123 124 124 125 // This is a mono tone generator so we only need the first buffer 126 const int channel = 0; 125 // // This is a mono tone generator so we only need the first buffer 126 // const int channel = 0; 127 128 // There are two channels to the audio control stream (left and right) 129 const int channel = 0; // Output to left channel 130 // const int channel = 1; // Output to right channel 131 132 133 127 134 Float32 *buffer = (Float32 *)ioData->mBuffers[channel].mData; 128 135 … … 184 191 streamFormat.mFramesPerPacket = 1; 185 192 streamFormat.mBytesPerFrame = four_bytes_per_float; 186 streamFormat.mChannelsPerFrame = 1; 193 194 // There are two channels to the audio stream 195 // streamFormat.mChannelsPerFrame = 1; 196 streamFormat.mChannelsPerFrame = 2; 197 187 198 streamFormat.mBitsPerChannel = four_bytes_per_float * eight_bits_per_byte; 188 199 err = AudioUnitSetProperty (toneUnit, -
iOS/Orbit/Orbit/controllers/TutorialViewController.m
rde10cbc r9b2949b 18 18 [NSURLRequest requestWithURL: 19 19 [NSURL fileURLWithPath: 20 [[NSBundle mainBundle] pathForResource:@" index" ofType:@"html"]]]];20 [[NSBundle mainBundle] pathForResource:@"frame" ofType:@"html"]]]]; 21 21 [super viewDidLoad]; 22 22 } -
iOS/Orbit/tutorial/index.html
r6d0d67b re8cd830 1 1 <!DOCTYPE html> 2 2 <html> 3 <head> 4 <meta name="viewport" content="width=device-width"> 5 <link rel="stylesheet" type="text/css" href="style.css"> 6 <title>Orbit Tutorial</title> 3 <head> 4 <meta name="viewport" content="width=device-width"> 5 <link rel="stylesheet" type="text/css" href="style.css"> 6 <title>Orbit Tutorial</title> 7 </head> 8 <body style="background-color: white;"> 9 10 <center> 11 12 <img src="puzzlebox_logo.pdf" width="240"> 13 14 Welcome to Puzzlebox Orbit 15 16 <p><img src="status_0@2x.png" height="160"><p> 17 18 <p>Please press "Next" to begin the tutorial</p> 19 20 <a class='next button' onclick="parent.changePage('step01.html');">Next »</a> 7 21 8 <body style="background-color: white;"> 9 10 <center> 11 <img src="puzzlebox_logo.pdf" width="240"> 12 13 Welcome to Puzzlebox Orbit 14 15 <p><img src="status_0@2x.png" height="160"><p> 16 17 <p>Please press "Next" to begin the tutorial</p> 18 19 <a class='next button' onclick="parent.changePage('step01.html');">Next »</a> 20 21 </center> 22 23 <!-- 24 <table class='table'> 25 <tbody> 26 <tr> 27 <td> 28 <center> 29 <img src="puzzlebox_logo.pdf" width="240"> 30 </center> 31 </td> 32 </tr> 33 34 <tr> 35 <td> 36 <center> 37 Welcome to Puzzlebox Orbit 38 </center> 39 </td> 40 </tr> 41 42 <tr> 43 <td> 44 <center> 45 <p><img src="status_0@2x.png" height="160"></p> 46 </center> 47 </td> 48 </tr> 49 50 <tr> 51 <td> 52 <center> 53 Please press "Next" to begin the tutorial 54 </center> 55 </td> 56 </tr> 57 58 </td> 59 <tr> 60 <td> 61 <a class='next button' href="step01.html">Next »</a> 62 </td> 63 </tr> 64 </tbody> 65 </table> 66 --> 67 </body> 22 </center> 23 24 <!-- 25 <table class='table'> 26 <tbody> 27 <tr> 28 <td> 29 <center> 30 <img src="puzzlebox_logo.pdf" width="240"> 31 </center> 32 </td> 33 </tr> 34 35 <tr> 36 <td> 37 <center> 38 Welcome to Puzzlebox Orbit 39 </center> 40 </td> 41 </tr> 42 43 <tr> 44 <td> 45 <center> 46 <p><img src="status_0@2x.png" height="160"></p> 47 </center> 48 </td> 49 </tr> 50 51 <tr> 52 <td> 53 <center> 54 Please press "Next" to begin the tutorial 55 </center> 56 </td> 57 </tr> 58 59 </td> 60 <tr> 61 <td> 62 <a class='next button' href="step01.html">Next »</a> 63 </td> 64 </tr> 65 </tbody> 66 </table> 67 --> 68 69 </body> 68 70 </html> -
iOS/Orbit/tutorial/step10.html
r6d0d67b re8cd830 19 19 <center> 20 20 <img src="tutorial-01-orbit.jpg" width="100%"> 21 21 </center> 22 22 23 23 </td>
Note: See TracChangeset
for help on using the changeset viewer.