Mercurial > hg > soniczoomios
changeset 37:8ed7522deaaa
Interpolation.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Tue, 09 Apr 2013 17:14:31 +0100 |
parents | a42903c61558 |
children | 0dfe9e0c01aa |
files | QuestionnaireViewController.xib SliderViewController.h SliderViewController.mm SliderViewController.xib TopButtonViewController.mm TopButtonViewController.xib grid.h grid.mm hilbert.h presetManager.mm testApp.mm |
diffstat | 11 files changed, 389 insertions(+), 220 deletions(-) [+] |
line wrap: on
line diff
--- a/QuestionnaireViewController.xib Tue Apr 09 13:22:28 2013 +0100 +++ b/QuestionnaireViewController.xib Tue Apr 09 17:14:31 2013 +0100 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00"> <data> - <int key="IBDocument.SystemTarget">1552</int> + <int key="IBDocument.SystemTarget">1280</int> <string key="IBDocument.SystemVersion">11G63</string> <string key="IBDocument.InterfaceBuilderVersion">3084</string> <string key="IBDocument.AppKitVersion">1138.51</string> @@ -1102,6 +1102,10 @@ </object> <int key="IBDocument.localizationMode">0</int> <string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string> + <real value="1280" key="NS.object.0"/> + </object> <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> <int key="IBDocument.defaultPropertyAccessControl">3</int> <string key="IBCocoaTouchPluginVersion">2083</string>
--- a/SliderViewController.h Tue Apr 09 13:22:28 2013 +0100 +++ b/SliderViewController.h Tue Apr 09 17:14:31 2013 +0100 @@ -12,4 +12,8 @@ @property (nonatomic, assign) id theOFAppRef; -(IBAction)hide:(id)sender; -(IBAction)show:(id)sender; +- (void)setAppRef:(id)theOFApp; +@property (retain, nonatomic) IBOutlet UISlider *slider1; + + @end
--- a/SliderViewController.mm Tue Apr 09 13:22:28 2013 +0100 +++ b/SliderViewController.mm Tue Apr 09 17:14:31 2013 +0100 @@ -45,4 +45,12 @@ self.theOFAppRef = sender; self.view.hidden = NO; } +- (void)dealloc { + [_slider1 release]; + [super dealloc]; +} +- (void)viewDidUnload { + [self setSlider1:nil]; + [super viewDidUnload]; +} @end
--- a/SliderViewController.xib Tue Apr 09 13:22:28 2013 +0100 +++ b/SliderViewController.xib Tue Apr 09 17:14:31 2013 +0100 @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00"> <data> - <int key="IBDocument.SystemTarget">1536</int> + <int key="IBDocument.SystemTarget">1280</int> <string key="IBDocument.SystemVersion">11G63</string> - <string key="IBDocument.InterfaceBuilderVersion">2844</string> + <string key="IBDocument.InterfaceBuilderVersion">3084</string> <string key="IBDocument.AppKitVersion">1138.51</string> <string key="IBDocument.HIToolboxVersion">569.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="NS.object.0">1930</string> + <string key="NS.object.0">2083</string> </object> <array key="IBDocument.IntegratedClassDependencies"> <string>IBProxyObject</string> @@ -42,7 +42,7 @@ <string key="NSFrame">{{35, 52}, {81, 21}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView"/> + <reference key="NSNextKeyView" ref="765561490"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> @@ -50,10 +50,9 @@ <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> <string key="IBUIText">Transpose</string> - <object class="NSColor" key="IBUITextColor" id="462707056"> + <object class="NSColor" key="IBUITextColor" id="986956085"> <int key="NSColorSpace">1</int> - <bytes key="NSRGB">MCAwIDAAA</bytes> - <string key="IBUIColorCocoaTouchKeyPath">darkTextColor</string> + <bytes key="NSRGB">MSAxIDEAA</bytes> </object> <nil key="IBUIHighlightedColor"/> <int key="IBUIBaselineAdjustment">0</int> @@ -74,7 +73,7 @@ <string key="NSFrame">{{35, 111}, {62, 21}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView"/> + <reference key="NSNextKeyView" ref="495049070"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> @@ -82,7 +81,7 @@ <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> <string key="IBUIText">1/4 note</string> - <reference key="IBUITextColor" ref="462707056"/> + <reference key="IBUITextColor" ref="986956085"/> <nil key="IBUIHighlightedColor"/> <int key="IBUIBaselineAdjustment">0</int> <reference key="IBUIFontDescription" ref="465806017"/> @@ -95,7 +94,7 @@ <string key="NSFrame">{{35, 171}, {62, 21}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView"/> + <reference key="NSNextKeyView" ref="19664376"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> @@ -103,7 +102,7 @@ <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> <string key="IBUIText">1/6 note</string> - <reference key="IBUITextColor" ref="462707056"/> + <reference key="IBUITextColor" ref="986956085"/> <nil key="IBUIHighlightedColor"/> <int key="IBUIBaselineAdjustment">0</int> <reference key="IBUIFontDescription" ref="465806017"/> @@ -116,7 +115,7 @@ <string key="NSFrame">{{35, 228}, {62, 21}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView"/> + <reference key="NSNextKeyView" ref="156260818"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> @@ -124,7 +123,7 @@ <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> <string key="IBUIText">1/7 note</string> - <reference key="IBUITextColor" ref="462707056"/> + <reference key="IBUITextColor" ref="986956085"/> <nil key="IBUIHighlightedColor"/> <int key="IBUIBaselineAdjustment">0</int> <reference key="IBUIFontDescription" ref="465806017"/> @@ -137,7 +136,7 @@ <string key="NSFrame">{{35, 288}, {62, 21}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView"/> + <reference key="NSNextKeyView" ref="96720329"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> @@ -145,7 +144,7 @@ <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> <string key="IBUIText">1/8 note</string> - <reference key="IBUITextColor" ref="462707056"/> + <reference key="IBUITextColor" ref="986956085"/> <nil key="IBUIHighlightedColor"/> <int key="IBUIBaselineAdjustment">0</int> <reference key="IBUIFontDescription" ref="465806017"/> @@ -158,7 +157,7 @@ <string key="NSFrame">{{56, 16}, {188, 21}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="111649263"/> + <reference key="NSNextKeyView" ref="459346847"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> @@ -166,7 +165,7 @@ <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> <string key="IBUIText">Note Pattern Oscillations</string> - <reference key="IBUITextColor" ref="462707056"/> + <reference key="IBUITextColor" ref="986956085"/> <nil key="IBUIHighlightedColor"/> <int key="IBUIBaselineAdjustment">0</int> <reference key="IBUIFontDescription" ref="465806017"/> @@ -179,7 +178,7 @@ <string key="NSFrame">{{470, 19}, {166, 21}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="765561490"/> + <reference key="NSNextKeyView" ref="111649263"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> @@ -187,7 +186,7 @@ <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> <string key="IBUIText">Synth Sound Controls</string> - <reference key="IBUITextColor" ref="462707056"/> + <reference key="IBUITextColor" ref="986956085"/> <nil key="IBUIHighlightedColor"/> <int key="IBUIBaselineAdjustment">0</int> <reference key="IBUIFontDescription" ref="465806017"/> @@ -200,7 +199,7 @@ <string key="NSFrame">{{421, 82}, {308, 23}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="495049070"/> + <reference key="NSNextKeyView" ref="378389064"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> @@ -217,7 +216,7 @@ <string key="NSFrame">{{423, 52}, {78, 21}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="1033207780"/> + <reference key="NSNextKeyView" ref="588639842"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> @@ -225,7 +224,7 @@ <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> <string key="IBUIText">Waveform</string> - <reference key="IBUITextColor" ref="462707056"/> + <reference key="IBUITextColor" ref="986956085"/> <nil key="IBUIHighlightedColor"/> <int key="IBUIBaselineAdjustment">0</int> <reference key="IBUIFontDescription" ref="465806017"/> @@ -238,7 +237,7 @@ <string key="NSFrame">{{421, 142}, {308, 23}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="19664376"/> + <reference key="NSNextKeyView" ref="618289241"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> @@ -252,7 +251,7 @@ <string key="NSFrame">{{423, 111}, {82, 21}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="632225376"/> + <reference key="NSNextKeyView" ref="889637720"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> @@ -260,7 +259,7 @@ <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> <string key="IBUIText">FIlter Type</string> - <reference key="IBUITextColor" ref="462707056"/> + <reference key="IBUITextColor" ref="986956085"/> <nil key="IBUIHighlightedColor"/> <int key="IBUIBaselineAdjustment">0</int> <reference key="IBUIFontDescription" ref="465806017"/> @@ -273,7 +272,7 @@ <string key="NSFrame">{{421, 199}, {308, 23}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="156260818"/> + <reference key="NSNextKeyView" ref="356420968"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> @@ -287,7 +286,7 @@ <string key="NSFrame">{{423, 171}, {123, 21}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="715980642"/> + <reference key="NSNextKeyView" ref="51687800"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> @@ -295,7 +294,7 @@ <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> <string key="IBUIText">Filter Frequency</string> - <reference key="IBUITextColor" ref="462707056"/> + <reference key="IBUITextColor" ref="986956085"/> <nil key="IBUIHighlightedColor"/> <int key="IBUIBaselineAdjustment">0</int> <reference key="IBUIFontDescription" ref="465806017"/> @@ -308,7 +307,7 @@ <string key="NSFrame">{{421, 259}, {308, 23}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="96720329"/> + <reference key="NSNextKeyView" ref="244340737"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> @@ -322,7 +321,7 @@ <string key="NSFrame">{{423, 230}, {71, 21}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="790035490"/> + <reference key="NSNextKeyView" ref="260680075"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> @@ -330,7 +329,7 @@ <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> <string key="IBUIText">Envelope</string> - <reference key="IBUITextColor" ref="462707056"/> + <reference key="IBUITextColor" ref="986956085"/> <nil key="IBUIHighlightedColor"/> <int key="IBUIBaselineAdjustment">0</int> <reference key="IBUIFontDescription" ref="465806017"/> @@ -343,6 +342,7 @@ <string key="NSFrame">{{421, 321}, {308, 23}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> + <reference key="NSNextKeyView"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> @@ -356,7 +356,7 @@ <string key="NSFrame">{{423, 288}, {86, 21}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="977717434"/> + <reference key="NSNextKeyView" ref="200835061"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClipsSubviews">YES</bool> @@ -364,7 +364,7 @@ <bool key="IBUIUserInteractionEnabled">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> <string key="IBUIText">FM amount</string> - <reference key="IBUITextColor" ref="462707056"/> + <reference key="IBUITextColor" ref="986956085"/> <nil key="IBUIHighlightedColor"/> <int key="IBUIBaselineAdjustment">0</int> <reference key="IBUIFontDescription" ref="465806017"/> @@ -377,6 +377,7 @@ <string key="NSFrame">{{33, 82}, {308, 23}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="1033207780"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> @@ -393,6 +394,7 @@ <string key="NSFrame">{{33, 142}, {308, 23}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="632225376"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> @@ -406,6 +408,7 @@ <string key="NSFrame">{{33, 199}, {308, 23}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="715980642"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> @@ -419,6 +422,7 @@ <string key="NSFrame">{{33, 259}, {308, 23}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="790035490"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> @@ -432,6 +436,7 @@ <string key="NSFrame">{{33, 321}, {308, 23}}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="977717434"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> @@ -449,9 +454,10 @@ <reference key="NSNextKeyView" ref="867320187"/> <object class="NSColor" key="IBUIBackgroundColor"> <int key="NSColorSpace">1</int> - <bytes key="NSRGB">MC40ODg0NzIzMTY2IDAuNDg4NDcyMzE2NiAwLjQ4ODQ3MjMxNjYAA</bytes> + <bytes key="NSRGB">MCAwIDAAA</bytes> </object> <bool key="IBUIClearsContextBeforeDrawing">NO</bool> + <bool key="IBUIMultipleTouchEnabled">YES</bool> <object class="IBUISimulatedSizeMetrics" key="IBUISimulatedDestinationMetrics"> <string key="IBUISimulatedSizeMetricsClass">IBUISimulatedFreeformSizeMetricsSentinel</string> <string key="IBUIDisplayName">Freeform</string> @@ -469,6 +475,14 @@ </object> <int key="connectionID">3</int> </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchOutletConnection" key="connection"> + <string key="label">slider1</string> + <reference key="source" ref="841351856"/> + <reference key="destination" ref="588639842"/> + </object> + <int key="connectionID">287</int> + </object> </array> <object class="IBMutableOrderedSet" key="objectRecords"> <array key="orderedObjects"> @@ -506,15 +520,15 @@ <reference ref="156260818"/> <reference ref="977717434"/> <reference ref="96720329"/> - <reference ref="588639842"/> <reference ref="889637720"/> <reference ref="51687800"/> <reference ref="260680075"/> - <reference ref="200835061"/> <reference ref="378389064"/> <reference ref="618289241"/> <reference ref="356420968"/> <reference ref="244340737"/> + <reference ref="200835061"/> + <reference ref="588639842"/> </array> <reference key="parent" ref="0"/> </object> @@ -669,7 +683,7 @@ <nil key="activeLocalization"/> <dictionary class="NSMutableDictionary" key="localizations"/> <nil key="sourceID"/> - <int key="maxID">286</int> + <int key="maxID">287</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <array class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -690,6 +704,17 @@ <string key="candidateClassName">id</string> </object> </dictionary> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">slider1</string> + <string key="NS.object.0">UISlider</string> + </object> + <object class="NSMutableDictionary" key="toOneOutletInfosByName"> + <string key="NS.key.0">slider1</string> + <object class="IBToOneOutletInfo" key="NS.object.0"> + <string key="name">slider1</string> + <string key="candidateClassName">UISlider</string> + </object> + </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">./Classes/SliderViewController.h</string> @@ -699,8 +724,12 @@ </object> <int key="IBDocument.localizationMode">0</int> <string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string> + <real value="1280" key="NS.object.0"/> + </object> <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> <int key="IBDocument.defaultPropertyAccessControl">3</int> - <string key="IBCocoaTouchPluginVersion">1930</string> + <string key="IBCocoaTouchPluginVersion">2083</string> </data> </archive>
--- a/TopButtonViewController.mm Tue Apr 09 13:22:28 2013 +0100 +++ b/TopButtonViewController.mm Tue Apr 09 17:14:31 2013 +0100 @@ -87,12 +87,12 @@ - (IBAction)lockSequencePressed:(id)sender { UIBarButtonItem *button = (UIBarButtonItem *)sender; - if([button.title isEqualToString:@"Lock Sequence (X)"]){ + if([button.title isEqualToString:@"Lock X"]){ ((testApp *)self.theOFAppRef)->lockSequencerPressed(true); - button.title = @"Unlock Sequence (X)"; - }else if([button.title isEqualToString:@"Unlock Sequence (X)"]){ + button.title = @"Unlock X"; + }else if([button.title isEqualToString:@"Unlock X"]){ ((testApp *)self.theOFAppRef)->lockSequencerPressed(false); - button.title = @"Lock Sequence (X)"; + button.title = @"Lock X"; }else{ NSLog(@"button title error"); } @@ -100,12 +100,12 @@ - (IBAction)lockSynthPressed:(id)sender { UIBarButtonItem *button = (UIBarButtonItem *)sender; - if([button.title isEqualToString:@"Lock Synth (Y)"]){ + if([button.title isEqualToString:@"Lock Y"]){ ((testApp *)self.theOFAppRef)->lockSynthPressed(true); - button.title = @"Unlock Synth (Y)"; - }else if([button.title isEqualToString:@"Unlock Synth (Y)"]){ + button.title = @"Unlock Y"; + }else if([button.title isEqualToString:@"Unlock Y"]){ ((testApp *)self.theOFAppRef)->lockSynthPressed(false); - button.title = @"Lock Synth (Y)"; + button.title = @"Lock Y"; }else{ NSLog(@"button title error"); }
--- a/TopButtonViewController.xib Tue Apr 09 13:22:28 2013 +0100 +++ b/TopButtonViewController.xib Tue Apr 09 17:14:31 2013 +0100 @@ -42,6 +42,7 @@ <string key="NSFrameSize">{768, 44}</string> <reference key="NSSuperview" ref="766721923"/> <reference key="NSWindow"/> + <reference key="NSNextKeyView"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="IBUIOpaque">NO</bool> <bool key="IBUIClearsContextBeforeDrawing">NO</bool> @@ -99,13 +100,13 @@ <reference key="IBUIToolbar" ref="358683122"/> </object> <object class="IBUIBarButtonItem" id="189059998"> - <string key="IBUITitle">Lock Sequence (X)</string> + <string key="IBUITitle">Lock X</string> <string key="targetRuntimeIdentifier">IBIPadFramework</string> <int key="IBUIStyle">1</int> <reference key="IBUIToolbar" ref="358683122"/> </object> <object class="IBUIBarButtonItem" id="597523981"> - <string key="IBUITitle">Lock Synth (Y)</string> + <string key="IBUITitle">Lock Y</string> <string key="targetRuntimeIdentifier">IBIPadFramework</string> <int key="IBUIStyle">1</int> <reference key="IBUIToolbar" ref="358683122"/> @@ -400,7 +401,7 @@ <nil key="activeLocalization"/> <dictionary class="NSMutableDictionary" key="localizations"/> <nil key="sourceID"/> - <int key="maxID">42</int> + <int key="maxID">43</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <array class="NSMutableArray" key="referencedPartialClassDescriptions">
--- a/grid.h Tue Apr 09 13:22:28 2013 +0100 +++ b/grid.h Tue Apr 09 17:14:31 2013 +0100 @@ -15,9 +15,12 @@ #include "eventLogger.h" #include "presetManager.h" #include "hilbert.h" + using namespace std; class Preset; + + class Grid { public: @@ -30,22 +33,24 @@ void move(TwoVector moveP); // shift view by pixels void zoom(float factor); - + typedef enum{NO_INTERPOLATION, INTERPOLATE_GRID, INTERPOLATE_PRESET} interpolateModeType; + interpolateModeType interpolateMode; void snapCheck(); void shiftCentreToSnapped(); - void draw(); // draw lines - + void draw(); + void drawGridLines(); void update(); // change according to zoom - + int interpLevel; + int smallestGridSpacing; // number of pixels when small grid dissappears from view vector<int> getParams(); TwoVector getCoord(); void setMinZoom(); void setMaxZoom(); // HILBERT now does each coord for this - vector<int> calculateParamsFromCoord(TwoVector coord) const; - TwoVector calculateCoordFromParams(vector<int> params) const; - + vector<int> calculateParamsFromCoord(TwoVector coord); + TwoVector calculateCoordFromParams(vector<int> params); + vector<int> calculateInterpolatedParamsFromCoord(TwoVector coord); TwoVector coordToPixel(TwoVector coord); // the inverse stuff @@ -110,8 +115,8 @@ void setCoord(TwoVector coord); void drawCrossHairs(); - - + int calculateInterpolateLevel(); + vector<int> interpVector(vector<int> upper, vector<int> lower, float frac);
--- a/grid.mm Tue Apr 09 13:22:28 2013 +0100 +++ b/grid.mm Tue Apr 09 17:14:31 2013 +0100 @@ -4,7 +4,7 @@ // // Created by Robert Tubb on 03/10/2012. // -// +// This is the grid view, i.e. the viewable representation of hilbert surface #include "grid.h" @@ -17,6 +17,7 @@ //-------------------------------------------------------------- Grid::Grid(): maxValue(pow(32.0,7.0)-1), minValue(30), paramsPerDim(5), paramBitDepth(7){ + interpLevel = 4; } //-------------------------------------------------------------- //-------------------------------------------------------------- @@ -25,6 +26,8 @@ } void Grid::init(){ + interpolateMode = INTERPOLATE_GRID; + maxZoom = false; minZoom = false; @@ -33,6 +36,8 @@ //set scale and position to random scale = 15500.0; + smallestGridSpacing = 3; //pixels + snapDist = TwoVector(9,9); snapped = false; @@ -54,20 +59,67 @@ setCoord(coord); viewWasChanged(); - + calculateInterpolateLevel(); } template <typename T> int sgn(T val) { return (T(0) < val) - (val < T(0)); } +//-------------------------------------------------------------- +int Grid::calculateInterpolateLevel(){ + if(interpolateMode == INTERPOLATE_GRID){ + // calculate according to smallest gridlines + // exactly same algorithm as for drawing lines + // i.e. kinda duplicated code. + float markpow = pow(paramsPerDim,2.0); + for(int p = 0; p < paramBitDepth; p++){ + + double gridSize = pow(markpow,p); + double divsr = size.x / gridSize; + + // return the spacing + if( ofGetWidth()/divsr >= smallestGridSpacing){ + interpLevel = p; + return p; + } + } + interpLevel = 0; + return 0; + }else{ + interpLevel = 0; + return 0; // ??? + } +} +//-------------------------------------------------------------- +void Grid::draw(){ + if(interpolateMode == NO_INTERPOLATION){ + drawGridLines(); + drawPresets(); + }else if(interpolateMode == INTERPOLATE_GRID){ + // calculate according to smallest gridlines + drawGridLines(); + + }else if(interpolateMode == INTERPOLATE_PRESET){ + drawPresets(); + return; // ??? + } + + + + // draw centre cross hairs + drawCrossHairs(); + + + // draw the undo history trail, given viewing area + eventLogger.drawTrail(topLeft, topLeft + size); +} //-------------------------------------------------------------- -void Grid::draw(){ // draw lines +void Grid::drawGridLines(){ // draw lines // TODO too friggin long pixSize.setCoord(ofGetWidth(), ofGetHeight()); // incase of rotation? - //scale++; - // nice loopy thing + int power = 0; // these get big! @@ -82,24 +134,25 @@ float alpha; bool done = false; - float markpow = 32.0; // power that denotes next grid markings + float markpow = 1 << paramsPerDim; // power that denotes next grid markings e.g. 32 int lineWidth = 0; int colCycle = 0; - // loop thru powers of (base?) to determine which should be shown as grids + // loop thru powers of (base?) smallest to biggest + // to determine which should be shown as grids while (!done){ gridSize = pow(markpow,power); - colCycle = power % 7; + colCycle = power % paramBitDepth; divsr = size.x / gridSize; // if (divisor i.e. number of lines is less than 1000 - if( divsr >= 1 && divsr < 700){ + if( ofGetWidth()/divsr >= smallestGridSpacing){ // calculate transparency - float visCont = log10(divsr); // 0 if only 1 line, 3 if 1000 lines + float visCont = log10(divsr*2); // 0 if only 1 line, 3 if 1000 lines alpha = 90*(3 - visCont); ofSetLineWidth(lineWidth); @@ -199,24 +252,21 @@ } - }else if (divsr < 1){ - // ignore... + } + /*else if (divsr < 1){ + // maximum only one line. worth checking so that bigger lines still show up? done = true; } - +*/ power++; + if(power > paramBitDepth) + done = true; + } //cout << "draw done" << "\n"; //displayInfo(); - drawPresets(); - // draw centre cross hairs - drawCrossHairs(); - - - // draw the undo history trail, given viewing area - eventLogger.drawTrail(topLeft, topLeft + size); ////////-------//////// /* @@ -353,6 +403,7 @@ viewWasChanged(); + calculateInterpolateLevel(); eventLogger.logEvent(ZOOM, centre, scale); } @@ -422,7 +473,11 @@ if(snapped){ params = calculateParamsFromCoord(snapCentre); }else{ - params = calculateParamsFromCoord(centre); + if(interpolateMode == NO_INTERPOLATION){ + params = calculateParamsFromCoord(centre); + }else if(interpolateMode == INTERPOLATE_GRID){ + params = calculateInterpolatedParamsFromCoord(centre); + } } for(int i = 0;i<2*paramsPerDim;i++){ midiCC[i] = params[i]; @@ -546,7 +601,7 @@ //-------------------------------------------------------------- #pragma mark const utils -TwoVector Grid::calculateCoordFromParams(vector<int> params) const{ +TwoVector Grid::calculateCoordFromParams(vector<int> params){ vector<int> ccValueX(paramsPerDim); vector<int> ccValueY(paramsPerDim); @@ -562,7 +617,7 @@ } //-------------------------------------------------------------- -vector<int> Grid::calculateParamsFromCoord(TwoVector coord) const{ +vector<int> Grid::calculateParamsFromCoord(TwoVector coord){ if (coord.x > maxValue || coord.y > maxValue){ cout << "calculateParams Error: centre double value is too large" << "\n"; @@ -588,7 +643,59 @@ result.insert( result.end(), resultY.begin(), resultY.end() ); return result; } +//-------------------------------------------------------------- +vector<int> Grid::calculateInterpolatedParamsFromCoord(TwoVector coord){ + vector<int> result; + // round by masking according to interpLevel + + long long x = coord.x; + long long y = coord.y; + cout << interpLevel << "\n"; + int roundDigits = (paramsPerDim*interpLevel); + // knock off last digits + x = x >> roundDigits; + x = x << roundDigits; + float frac = (coord.x - x)/(1 << roundDigits); + long long xlower = x; + long long xupper = x + (1 << roundDigits); + + vector<int> pupper = hilbert.calculateParamsFromIndex(xupper); + vector<int> plower = hilbert.calculateParamsFromIndex(xlower); + + result = interpVector(pupper,plower,frac); +// now Y + y = y >> roundDigits; + y = y << roundDigits; + frac = (coord.y - y)/(1 << roundDigits); + long long ylower = y; + long long yupper = y + (1 << roundDigits); + + pupper = hilbert.calculateParamsFromIndex(yupper); + plower = hilbert.calculateParamsFromIndex(ylower); + + vector<int> resultY = interpVector(pupper,plower,frac); +// stickem together + result.insert( result.end(), resultY.begin(), resultY.end() ); + return result; +} +//-------------------------------------------------------------- +vector<int> Grid::interpVector(vector<int> upper, vector<int> lower, float frac){ + vector<int> result; + if(upper.size() != lower.size()){ + cout << "Error: interpVector takes vectors of same length" << "\n"; + return result; + } + if(frac > 1){ + cout << "Error: bad fraction for vector interpolation" << "\n"; + return result; + } + int N = upper.size(); + for(int i=0; i<N; i++){ + result.push_back(frac*upper[i] + (1-frac)*lower[i]); + } + return result; +} //-------------------------------------------------------------- vector<int> Grid::walkDiff(vector<bool> left, vector<bool> right){ // horrible
--- a/hilbert.h Tue Apr 09 13:22:28 2013 +0100 +++ b/hilbert.h Tue Apr 09 17:14:31 2013 +0100 @@ -19,8 +19,6 @@ class Hilbert{ private: - -public: int P; // dimensionas of high D space int N; // number of resolution bits int codeLength; @@ -29,13 +27,17 @@ vector<vector <bool> > theGrayCode; vector<unsigned int> theGrayCodeD; - void init(int N, int P); + void makeCode(); - vector<int> calculateParamsFromIndex(unsigned long long coord); - unsigned long long calculateIndexFromParams(vector<int> params); + void makeRotationRules(); int rotate(int vertex, int entryPoint, int direction); int rotateInverse(int vertex, int entryPoint, int direction) ; +public: + void init(int N, int P); + vector<int> calculateParamsFromIndex(unsigned long long coord); + unsigned long long calculateIndexFromParams(vector<int> params); + };
--- a/presetManager.mm Tue Apr 09 13:22:28 2013 +0100 +++ b/presetManager.mm Tue Apr 09 17:14:31 2013 +0100 @@ -195,6 +195,8 @@ } */ // hmm shouldn't have to know about eventlogger and grid view... + // TODO get coord might be wrong if in interpolation mode + thePresets.push_back(new Preset(theGridView.getCoord(), name,nextID, eventLogger.userName, eventLogger.deviceID)); eventLogger.logEvent(SAVE_PRESET, theGridView.getCoord()); // poke grid view to get it to show details
--- a/testApp.mm Tue Apr 09 13:22:28 2013 +0100 +++ b/testApp.mm Tue Apr 09 17:14:31 2013 +0100 @@ -19,13 +19,13 @@ //-------------------------------------------------------------- void testApp::setup(){ paused = true; - - + + ofBackground( 0, 0, 0 ); ofEnableAlphaBlending(); currentSequence = 0; //ofEnableSmoothing(); - + // open an outgoing connection to HOST:PORT for OSC sender.setup( OSC_HOST, OSC_PORT ); @@ -57,7 +57,12 @@ ofxiPhoneSetOrientation( OFXIPHONE_ORIENTATION_PORTRAIT ); // do this before setting up all the other objects - + /* + sliderViewController = [[SliderViewController alloc] initWithNibName:@"SliderViewController" bundle:nil]; + [ofxiPhoneGetGLParentView() addSubview:sliderViewController.view]; + [sliderViewController setAppRef:(id)this]; + sliderViewController.view.frame = CGRectMake(0,getHeight()-43 - 363,getWidth(),363); + */ // initialise the interfaces theGridView.init(); @@ -68,7 +73,7 @@ for(int i=0; i<10;i++){ sliderVals.push_back(64); } - + // initialise PD int ticksPerBuffer = 8; // 8 * 64 = buffer len of 512 @@ -79,8 +84,8 @@ // setup OF sound stream ofSoundStreamSetup(2, 1, this, 44100, ofxPd::blockSize()*ticksPerBuffer, 3); - - + + // set up iOS gui stuff bottomTabViewController = [[BottomTabViewController alloc] initWithNibName:@"BottomTabViewController" bundle:nil]; [ofxiPhoneGetGLParentView() addSubview:bottomTabViewController.view]; @@ -88,7 +93,7 @@ [bottomTabViewController setAppRef:(id)this]; bottomTabViewController.view.frame = CGRectMake(0,getHeight()-44,getWidth(),44); bottomTabViewController.view.hidden = YES; - + ///// topButtonViewController = [[TopButtonViewController alloc] initWithNibName:@"TopButtonViewController" bundle:nil]; @@ -105,15 +110,7 @@ helpViewController.view.hidden = YES; - sliderViewController = [[SliderViewController alloc] initWithNibName:@"SLiderViewController" bundle:nil]; - [ofxiPhoneGetGLParentView() addSubview:sliderViewController.view]; - - [sliderViewController setAppRef:(id)this]; - [sliderViewController show:(id)this]; - sliderViewController.view.frame = CGRectMake(0,getHeight()-43 - 363,getWidth(),44); - - // load preset sequences loadSequences(); @@ -125,7 +122,7 @@ // timer.init(); whichInterfaceShowing = BOTH; // but timer will change this - + if(eventLogger.questionnaireCompleted){ [bottomTabViewController show:(id)this withSelection:1]; @@ -133,21 +130,22 @@ setAllGUISliders(theGridView.getParams()); // GO paused = false; - + randomise(); // everyone starts from random position (or where they left off??) ofxiPhoneExternalDisplay::mirrorOn(); - + + //[sliderViewController show:(id)this]; } //-------------------------------------------------------------- void testApp::exit(){ - + presetManager.exitAndSaveAll(); eventLogger.exitAndSave(); - + core.exit(); // are these handled automatically? @@ -156,7 +154,7 @@ //[bottomTabViewController release]; delete sliderGUI; - + cout << "exit done \n"; } @@ -209,9 +207,9 @@ //-------------------------------------------------------------- void testApp::showQuestionnaire(){ // stop updating / drawing - + // if(eventLogger.questionnaireCompleted) return; - + [topButtonViewController pausePressed:(id)this]; //stopSequencer @@ -225,18 +223,18 @@ whichInterfaceShowing = QUESTIONNAIRE; - + } //-------------------------------------------------------------- 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]; - + } //-------------------------------------------------------------- // shortcut function for testing @@ -247,9 +245,9 @@ } //-------------------------------------------------------------- void testApp::showIntro(){ - + cout << "SHOW INTRO\n"; - + [tsc cancelTimers]; bottomTabViewController.view.hidden = YES; introViewController = [[IntroViewController alloc] initWithNibName:@"IntroViewController" bundle:nil]; @@ -282,7 +280,7 @@ void testApp::interfaceSelected(int which){ switch (which){ case 0: - + whichInterfaceShowing = SLIDERS; sliderGUI->setVisible(true); // set the slider values to stuff got from zoomer @@ -291,7 +289,7 @@ break; case 1: - + whichInterfaceShowing = BOTH; sliderGUI->setVisible(true); // set the slider values to stuff got from zoomer @@ -299,7 +297,7 @@ setAllGUISliders(sliderVals); break; case 2: - + sliderGUI->setVisible(false); whichInterfaceShowing = ZOOMER; break; @@ -321,10 +319,10 @@ float dim = (height-10.0*OFX_UI_GLOBAL_WIDGET_SPACING)/10.0; // LEFT GUI sliderGUI = new ofxUICanvas(0,160,SLIDER_GUI_WIDTH,getHeight()); - + // Uh.. loop this for(int i = 1; i<=10;i++){ - + ofxUISlider *slider; slider = (ofxUISlider *)sliderGUI->addWidgetDown(new ofxUISlider(length,dim,0.0,127,64,sliderParamNames[i-1])); slider->setDrawPadding(true); @@ -340,10 +338,10 @@ sliders.push_back(slider); } - + ofAddListener(sliderGUI->newGUIEvent, this, &testApp::sliderGUIEvent); - + } //-------------------------------------------------------------- void testApp::sliderGUIEvent(ofxUIEventArgs &e){ @@ -351,7 +349,7 @@ cout << "GUI ERROR"; return; } - + // "normal" parameter changes for(int i = 1; i<=10;i++){ @@ -362,14 +360,14 @@ sliderMoved(i-1,slider->getScaledValue()); // internal array 0 indexed } } - + } //-------------------------------------------------------------- void testApp::sliderMoved(int which, float value){ // an update caused by slider view being touched sliderVals[which] = (int)value; theGridView.setParams(sliderVals); - + sendParametersToPD(); eventLogger.logEvent(CHANGE_SLIDER, TwoVector(),0.0,which , value); @@ -391,7 +389,7 @@ sliderVals[i] = ofRandom(0, 127); } - + currentSequence = ofRandom(0, sequences.size()-1); // send to grid, sliders and PD theGridView.setParams(sliderVals); setAllGUISliders(sliderVals); @@ -423,35 +421,47 @@ } //-------------------------------------------------------------- void testApp::sendParametersToPD(){ + static int previousSequence; + // frequencer stuff to get 16 steps - // frequencer stuff to get 16 steps + vector<double> vals; + + + vals.push_back((sliderVals[0]+32)*8.); // DC offset + for(int i=1; i<5;i++){ + vals.push_back((sliderVals[i] - 64)*2.); + } + + vector<double> steps = frequencer.freqMagEdit(freqIndexes, vals); + List seqSteps; + seqSteps.addSymbol("seqSteps"); + for(int i=0; i < 16; i++){ + seqSteps.addFloat(round(steps[i])); + } + core.pd.sendList("fromOF", seqSteps); + /* - vector<double> vals; - - - vals.push_back((sliderVals[0]+32)*8.); // DC offset - for(int i=1; i<5;i++){ - vals.push_back((sliderVals[i] - 64)*2.); + if(currentSequence != previousSequence){ + 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(50); + } + }else{ + for(int i=0; i < 16; i++){ + seqSteps.addFloat(round(sequences[currentSequence][i])); + } + } + + core.pd.sendList("fromOF", seqSteps); + previousSequence = currentSequence; } - - vector<double> 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(sequences[currentSequence][i])); // rounding here?? - } - - - core.pd.sendList("fromOF", seqSteps); - + // send synth params sendOscShape(sliderVals[5]); sendFiltType(sliderVals[6]); sendFiltFreq(sliderVals[7]); @@ -467,7 +477,7 @@ #pragma mark STANDARD OF FUNCTIONS //-------------------------------------------------------------- void testApp::update(){ - + if(paused) return; if(ofxiPhoneExternalDisplay::isExternalScreenConnected()){ @@ -487,11 +497,8 @@ zoomVel = zoomVel*slowFactor; moveVel.setCoord(0.0,0.0);; // don't move if zooming! Too many events! - // need to do this if zoom goes to snap - if(theGridView.snapped){ - setAllGUISliders(theGridView.getParams()); - sendParametersToPD(); - } + setAllGUISliders(theGridView.getParams()); + sendParametersToPD(); } if(moveVel.norm() > 0.3){ @@ -502,7 +509,7 @@ theGridView.move(moveVel); moveVel = moveVel*slowFactor; } - // and get new parameter values + // and get new parameter values setAllGUISliders(theGridView.getParams()); sendParametersToPD(); }else if(moveVel.norm() > 0.01){ // and less than 0.3 @@ -515,9 +522,9 @@ }else{ // stopped - do nothing } - + } - + } //-------------------------------------------------------------- void testApp::sendOSCParams(){ @@ -537,18 +544,18 @@ } //-------------------------------------------------------------- void testApp::draw(){ - + switch (whichInterfaceShowing){ case SLIDERS: break; case ZOOMER: theGridView.draw(); - + break; case BOTH: theGridView.draw(); - + break; case INTRO: break; @@ -572,7 +579,7 @@ numActiveTouches++; preventingMovePostScroll = false; - + if(touch.id == 0){ touch0.setCoord(touch.x,touch.y); prevTouch0 = touch0; @@ -596,7 +603,7 @@ double dist = touch1.distanceTo(touch0); prevDist = dist; } - + } //-------------------------------------------------------------- @@ -611,7 +618,7 @@ } // otherwise we're good to let the zoomer handle touch - + // which one? keep track of each touch point if(touch.id == 0){ touch0.setCoord(touch.x,touch.y); @@ -620,7 +627,7 @@ touch1.setCoord(touch.x,touch.y); } - + if(numActiveTouches == 1){ if(preventingMovePostScroll) return; handleScroll(); @@ -629,14 +636,14 @@ } prevTouch0 = touch0; - + } //-------------------------------------------------------------- // handle a finger being dragged void testApp::handleScroll(){ - + TwoVector move = touch0 - prevTouch0; if(yLocked){ move.y = 0.0; @@ -644,7 +651,7 @@ if(xLocked){ move.x = 0.0; } - + // check time since last move - if unsigned int moveTime = ofGetSystemTimeMicros(); if(moveTime - lastMoveTime > 100000){ @@ -655,11 +662,11 @@ } lastMoveTime = moveTime; - + prevMove2 = prevMove; prevMove = move; - + theGridView.move(move); // and get new parameter values @@ -687,12 +694,11 @@ prevDist = dist; - // need to do this if zoom goes to snap - if(theGridView.snapped){ - setAllGUISliders(theGridView.getParams()); - sendParametersToPD(); - } + setAllGUISliders(theGridView.getParams()); + sendParametersToPD(); + + } //-------------------------------------------------------------- void testApp::touchUp(ofTouchEventArgs &touch){ @@ -706,7 +712,7 @@ }// otherwise we're good to let the zoomer handle touch - + // which one? if(touch.id == 0){ // tricky situation - we tried to zoom but may have left non-move finger on @@ -714,7 +720,7 @@ }else if(touch.id == 1){ - + prevTouch1.setCoord(0,0); } @@ -734,7 +740,7 @@ // can be bad if moved so create special mode to stop scroll (special modes bad!) preventingMovePostScroll = true; } - + } //-------------------------------------------------------------- @@ -742,55 +748,55 @@ // preset? /* ballses everything for some reason - TwoVector centre = TwoVector(getWidth()*0.5,getHeight()*0.5); - // if near centre - if((touch.x < centre.x+10) && (touch.x > centre.x-10) && (touch.y < centre.y+10) && (touch.y > centre.y-10)){ - numActiveTouches = 0; // dirty - presetManager.showNameDialog(); - - } + TwoVector centre = TwoVector(getWidth()*0.5,getHeight()*0.5); + // if near centre + if((touch.x < centre.x+10) && (touch.x > centre.x-10) && (touch.y < centre.y+10) && (touch.y > centre.y-10)){ + numActiveTouches = 0; // dirty + presetManager.showNameDialog(); + + } */ } //-------------------------------------------------------------- void testApp::lostFocus(){ - + } //-------------------------------------------------------------- void testApp::gotFocus(){ - + } //-------------------------------------------------------------- void testApp::gotMemoryWarning(){ - + } //-------------------------------------------------------------- void testApp::deviceOrientationChanged(int newOrientation){ -/* - cout << "orientation: " << newOrientation; - - if(newOrientation == 4){ - ofxiPhoneSetOrientation( OF_ORIENTATION_DEFAULT ); - - }else if(newOrientation == 3){ - ofxiPhoneSetOrientation( OF_ORIENTATION_90_LEFT ); - }else if(newOrientation == 3){ - ofxiPhoneSetOrientation( OF_ORIENTATION_90_LEFT ); - } - - - [ofxiPhoneGetGLView() updateDimensions]; -*/ + /* + cout << "orientation: " << newOrientation; + + if(newOrientation == 4){ + ofxiPhoneSetOrientation( OF_ORIENTATION_DEFAULT ); + + }else if(newOrientation == 3){ + ofxiPhoneSetOrientation( OF_ORIENTATION_90_LEFT ); + }else if(newOrientation == 3){ + ofxiPhoneSetOrientation( OF_ORIENTATION_90_LEFT ); + } + + + [ofxiPhoneGetGLView() updateDimensions]; + */ } //-------------------------------------------------------------- void testApp::touchCancelled(ofTouchEventArgs& args){ - + } //--------------------------------------------------------------- // AUDIO STUFF @@ -848,11 +854,11 @@ float ctrlSmoother(float newsamp){ static float x1,x2,y1,y2; float x0, y0; - + x0 = newsamp; - + y0 = fB[0]*x0 + fB[1]*x1 + fB[2]*x2 - fA[1]*y1 - fA[2]*y2; - + // shift x2 = x1; x1 = x0; @@ -874,12 +880,12 @@ float ctrlout[numcontrols]; string ctrlName[5] = {"pWidth" , "sqVol", "sawVol", "sineVol", "FMAmt"}; float values[5][5] = - {{0.5, 0., 0., 1., 1.}, // 0 - {0.5, 0., 0., 1., 0.}, // 32 + {{0.5, 0., 0., 1., 1.}, // 0 + {0.5, 0., 0., 1., 0.}, // 32 {0.5, 0., 1., 0., 0.}, // 64 {0.5, 1., 1., 0., 0.}, // 96 {0.01,1., 1., 0., 0.}}; // 127 - + float fidx = (numpoints-1)*ctrlin/128.; int idx = floor(fidx); float frac = fidx - idx; @@ -890,7 +896,7 @@ toPD.addSymbol(ctrlName[i]); toPD.addFloat(ctrlout[i]); // rounding here?? - + core.pd.sendList("fromOF", toPD); //cout << ctrlName[i] << "sending" << ctrlout[i] << "\n"; } @@ -908,7 +914,7 @@ float ctrlout[numcontrols]; string ctrlName[4] = {"lpLev" , "bpLev", "hpLev", "reson"}; float values[3][4] = - {{2., 0., 0., 1.}, // 0 + {{2., 0., 0., 1.}, // 0 {0., 10., 0., 10.}, // 64 {0., 0., 1., 1.}}; // 127 @@ -940,7 +946,7 @@ List toPD; toPD.addSymbol("filtFreq"); - toPD.addFloat(fout); + toPD.addFloat(fout); core.pd.sendList("fromOF", toPD); } @@ -956,7 +962,7 @@ float ctrlout[numcontrols]; string ctrlName[3] = {"attack" , "decay", "sustain"}; float values[5][3] = - {{0., 0., 0.}, // 0 + {{0., 0., 0.}, // 0 {0., 0.5, 0.}, // 32 {0.0, 1., 0.8}, // 64 {0.99, 0.3, 0.}, // 96 @@ -1041,10 +1047,10 @@ // 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; @@ -1056,7 +1062,7 @@ while(theFile){ theFile >> line; // cout << line << "\n"; // lots? - fileText << line; + fileText << line; } theFile.close(); @@ -1082,6 +1088,7 @@ } } // currentSequence - currentSequence = ofRandom(0,N); + + currentSequence = ofRandom(0,N-1); }