diff options
author | DaveHodder67 <dave.hodder@focusrite.com> | 2015-08-13 13:33:20 +0100 |
---|---|---|
committer | DaveHodder67 <dave.hodder@focusrite.com> | 2015-08-13 13:33:20 +0100 |
commit | e314c84ab02ffe0fe47e616c2904df7984c5302f (patch) | |
tree | 06e8c4df8a054ab7f46f6a2b6468ce8e9f8ddc05 | |
parent | 6aee33aba751476da41ce673815abe602788c6e9 (diff) | |
download | launchpad-polymaker-e314c84ab02ffe0fe47e616c2904df7984c5302f.tar.gz launchpad-polymaker-e314c84ab02ffe0fe47e616c2904df7984c5302f.zip |
adding an OS X simulator for interactive testing via MIDI
-rw-r--r-- | .gitignore | 10 | ||||
-rw-r--r-- | tools/osx/simulator-osx.c | 99 | ||||
-rw-r--r-- | tools/osx/simulator.xcodeproj/project.pbxproj | 256 |
3 files changed, 365 insertions, 0 deletions
@@ -35,3 +35,13 @@ | |||
35 | build | 35 | build |
36 | .project | 36 | .project |
37 | .cproject | 37 | .cproject |
38 | |||
39 | *.xcworkspacedata | ||
40 | |||
41 | *.xccheckout | ||
42 | |||
43 | *.xcuserstate | ||
44 | |||
45 | *.xcscheme | ||
46 | |||
47 | tools/osx/simulator.xcodeproj/xcuserdata/davehodder.xcuserdatad/xcschemes/xcschememanagement.plist | ||
diff --git a/tools/osx/simulator-osx.c b/tools/osx/simulator-osx.c new file mode 100644 index 0000000..abd25f9 --- /dev/null +++ b/tools/osx/simulator-osx.c | |||
@@ -0,0 +1,99 @@ | |||
1 | /****************************************************************************** | ||
2 | |||
3 | Copyright (c) 2015, Focusrite Audio Engineering Ltd. | ||
4 | All rights reserved. | ||
5 | |||
6 | Redistribution and use in source and binary forms, with or without | ||
7 | modification, are permitted provided that the following conditions are met: | ||
8 | |||
9 | * Redistributions of source code must retain the above copyright notice, this | ||
10 | list of conditions and the following disclaimer. | ||
11 | |||
12 | * Redistributions in binary form must reproduce the above copyright notice, | ||
13 | this list of conditions and the following disclaimer in the documentation | ||
14 | and/or other materials provided with the distribution. | ||
15 | |||
16 | * Neither the name of Focusrite Audio Engineering Ltd., nor the names of its | ||
17 | contributors may be used to endorse or promote products derived from | ||
18 | this software without specific prior written permission. | ||
19 | |||
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
30 | |||
31 | *****************************************************************************/ | ||
32 | |||
33 | #include <stdio.h> | ||
34 | #include "app.h" | ||
35 | |||
36 | // ____________________________________________________________________________ | ||
37 | // | ||
38 | // Simulator "hal". This lets you exercise your device code without having to upload | ||
39 | // it to the hardware, which also means you can debug it interactively. | ||
40 | // ____________________________________________________________________________ | ||
41 | |||
42 | void hal_plot_led(u8 type, u8 index, u8 red, u8 green, u8 blue) | ||
43 | { | ||
44 | // wire this up to MIDI out... | ||
45 | } | ||
46 | |||
47 | void hal_send_midi(u8 port, u8 status, u8 d1, u8 d2) | ||
48 | { | ||
49 | // send this up a virtual MIDI port? | ||
50 | } | ||
51 | |||
52 | void hal_send_sysex(u8 port, const u8* data, u16 length) | ||
53 | { | ||
54 | // as above, or just dump to console? | ||
55 | } | ||
56 | |||
57 | // ____________________________________________________________________________ | ||
58 | // | ||
59 | // App event wrappers - these just log to the console. Would be nice to wire | ||
60 | // these up to a MIDI input from the real Launchpad Pro! | ||
61 | // ____________________________________________________________________________ | ||
62 | |||
63 | static void sim_app_init() | ||
64 | { | ||
65 | app_init(); | ||
66 | } | ||
67 | |||
68 | static void sim_app_surface_event(u8 type, u8 index, u8 value) | ||
69 | { | ||
70 | app_surface_event(type, index, value); | ||
71 | } | ||
72 | |||
73 | static void sim_app_midi_event(u8 port, u8 status, u8 d1, u8 d2) | ||
74 | { | ||
75 | app_midi_event(port, status, d1, d2); | ||
76 | } | ||
77 | |||
78 | static void sim_app_timer_event() | ||
79 | { | ||
80 | app_timer_event(); | ||
81 | } | ||
82 | |||
83 | // ____________________________________________________________________________ | ||
84 | |||
85 | int main(int argc, char * argv[]) | ||
86 | { | ||
87 | // open MIDI ports and wire them up | ||
88 | |||
89 | // init the app | ||
90 | sim_app_init(); | ||
91 | |||
92 | // start the terrible busywaiting timer loop | ||
93 | for (;;) | ||
94 | { | ||
95 | |||
96 | } | ||
97 | |||
98 | return 0; | ||
99 | } \ No newline at end of file | ||
diff --git a/tools/osx/simulator.xcodeproj/project.pbxproj b/tools/osx/simulator.xcodeproj/project.pbxproj new file mode 100644 index 0000000..23f2e4b --- /dev/null +++ b/tools/osx/simulator.xcodeproj/project.pbxproj | |||
@@ -0,0 +1,256 @@ | |||
1 | // !$*UTF8*$! | ||
2 | { | ||
3 | archiveVersion = 1; | ||
4 | classes = { | ||
5 | }; | ||
6 | objectVersion = 46; | ||
7 | objects = { | ||
8 | |||
9 | /* Begin PBXBuildFile section */ | ||
10 | C70651A01B7CC4A20005FDD9 /* app.c in Sources */ = {isa = PBXBuildFile; fileRef = C706519F1B7CC4A20005FDD9 /* app.c */; }; | ||
11 | C70651A81B7CC56F0005FDD9 /* simulator-osx.c in Sources */ = {isa = PBXBuildFile; fileRef = C70651A71B7CC56F0005FDD9 /* simulator-osx.c */; }; | ||
12 | /* End PBXBuildFile section */ | ||
13 | |||
14 | /* Begin PBXCopyFilesBuildPhase section */ | ||
15 | C713650E1B7CC2E500AB8010 /* CopyFiles */ = { | ||
16 | isa = PBXCopyFilesBuildPhase; | ||
17 | buildActionMask = 2147483647; | ||
18 | dstPath = /usr/share/man/man1/; | ||
19 | dstSubfolderSpec = 0; | ||
20 | files = ( | ||
21 | ); | ||
22 | runOnlyForDeploymentPostprocessing = 1; | ||
23 | }; | ||
24 | /* End PBXCopyFilesBuildPhase section */ | ||
25 | |||
26 | /* Begin PBXFileReference section */ | ||
27 | C706519F1B7CC4A20005FDD9 /* app.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = app.c; path = ../../src/app.c; sourceTree = "<group>"; }; | ||
28 | C70651A11B7CC4B20005FDD9 /* app_defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = app_defs.h; path = ../../include/app_defs.h; sourceTree = "<group>"; }; | ||
29 | C70651A21B7CC4B20005FDD9 /* app.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = app.h; path = ../../include/app.h; sourceTree = "<group>"; }; | ||
30 | C70651A71B7CC56F0005FDD9 /* simulator-osx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "simulator-osx.c"; sourceTree = "<group>"; }; | ||
31 | C71365101B7CC2E500AB8010 /* simulator */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = simulator; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
32 | /* End PBXFileReference section */ | ||
33 | |||
34 | /* Begin PBXFrameworksBuildPhase section */ | ||
35 | C713650D1B7CC2E500AB8010 /* Frameworks */ = { | ||
36 | isa = PBXFrameworksBuildPhase; | ||
37 | buildActionMask = 2147483647; | ||
38 | files = ( | ||
39 | ); | ||
40 | runOnlyForDeploymentPostprocessing = 0; | ||
41 | }; | ||
42 | /* End PBXFrameworksBuildPhase section */ | ||
43 | |||
44 | /* Begin PBXGroup section */ | ||
45 | C70651A51B7CC4D60005FDD9 /* source */ = { | ||
46 | isa = PBXGroup; | ||
47 | children = ( | ||
48 | C70651A71B7CC56F0005FDD9 /* simulator-osx.c */, | ||
49 | C706519F1B7CC4A20005FDD9 /* app.c */, | ||
50 | ); | ||
51 | name = source; | ||
52 | sourceTree = "<group>"; | ||
53 | }; | ||
54 | C70651A61B7CC4DF0005FDD9 /* include */ = { | ||
55 | isa = PBXGroup; | ||
56 | children = ( | ||
57 | C70651A11B7CC4B20005FDD9 /* app_defs.h */, | ||
58 | C70651A21B7CC4B20005FDD9 /* app.h */, | ||
59 | ); | ||
60 | name = include; | ||
61 | sourceTree = "<group>"; | ||
62 | }; | ||
63 | C71365071B7CC2E500AB8010 = { | ||
64 | isa = PBXGroup; | ||
65 | children = ( | ||
66 | C70651A61B7CC4DF0005FDD9 /* include */, | ||
67 | C70651A51B7CC4D60005FDD9 /* source */, | ||
68 | C71365111B7CC2E500AB8010 /* Products */, | ||
69 | ); | ||
70 | sourceTree = "<group>"; | ||
71 | }; | ||
72 | C71365111B7CC2E500AB8010 /* Products */ = { | ||
73 | isa = PBXGroup; | ||
74 | children = ( | ||
75 | C71365101B7CC2E500AB8010 /* simulator */, | ||
76 | ); | ||
77 | name = Products; | ||
78 | sourceTree = "<group>"; | ||
79 | }; | ||
80 | /* End PBXGroup section */ | ||
81 | |||
82 | /* Begin PBXNativeTarget section */ | ||
83 | C713650F1B7CC2E500AB8010 /* simulator */ = { | ||
84 | isa = PBXNativeTarget; | ||
85 | buildConfigurationList = C71365171B7CC2E500AB8010 /* Build configuration list for PBXNativeTarget "simulator" */; | ||
86 | buildPhases = ( | ||
87 | C713650C1B7CC2E500AB8010 /* Sources */, | ||
88 | C713650D1B7CC2E500AB8010 /* Frameworks */, | ||
89 | C713650E1B7CC2E500AB8010 /* CopyFiles */, | ||
90 | ); | ||
91 | buildRules = ( | ||
92 | ); | ||
93 | dependencies = ( | ||
94 | ); | ||
95 | name = simulator; | ||
96 | productName = simulator; | ||
97 | productReference = C71365101B7CC2E500AB8010 /* simulator */; | ||
98 | productType = "com.apple.product-type.tool"; | ||
99 | }; | ||
100 | /* End PBXNativeTarget section */ | ||
101 | |||
102 | /* Begin PBXProject section */ | ||
103 | C71365081B7CC2E500AB8010 /* Project object */ = { | ||
104 | isa = PBXProject; | ||
105 | attributes = { | ||
106 | LastUpgradeCheck = 0620; | ||
107 | ORGANIZATIONNAME = "Focusrite Audio Engineering Ltd."; | ||
108 | TargetAttributes = { | ||
109 | C713650F1B7CC2E500AB8010 = { | ||
110 | CreatedOnToolsVersion = 6.2; | ||
111 | }; | ||
112 | }; | ||
113 | }; | ||
114 | buildConfigurationList = C713650B1B7CC2E500AB8010 /* Build configuration list for PBXProject "simulator" */; | ||
115 | compatibilityVersion = "Xcode 3.2"; | ||
116 | developmentRegion = English; | ||
117 | hasScannedForEncodings = 0; | ||
118 | knownRegions = ( | ||
119 | en, | ||
120 | ); | ||
121 | mainGroup = C71365071B7CC2E500AB8010; | ||
122 | productRefGroup = C71365111B7CC2E500AB8010 /* Products */; | ||
123 | projectDirPath = ""; | ||
124 | projectRoot = ""; | ||
125 | targets = ( | ||
126 | C713650F1B7CC2E500AB8010 /* simulator */, | ||
127 | ); | ||
128 | }; | ||
129 | /* End PBXProject section */ | ||
130 | |||
131 | /* Begin PBXSourcesBuildPhase section */ | ||
132 | C713650C1B7CC2E500AB8010 /* Sources */ = { | ||
133 | isa = PBXSourcesBuildPhase; | ||
134 | buildActionMask = 2147483647; | ||
135 | files = ( | ||
136 | C70651A81B7CC56F0005FDD9 /* simulator-osx.c in Sources */, | ||
137 | C70651A01B7CC4A20005FDD9 /* app.c in Sources */, | ||
138 | ); | ||
139 | runOnlyForDeploymentPostprocessing = 0; | ||
140 | }; | ||
141 | /* End PBXSourcesBuildPhase section */ | ||
142 | |||
143 | /* Begin XCBuildConfiguration section */ | ||
144 | C71365151B7CC2E500AB8010 /* Debug */ = { | ||
145 | isa = XCBuildConfiguration; | ||
146 | buildSettings = { | ||
147 | ALWAYS_SEARCH_USER_PATHS = NO; | ||
148 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
149 | CLANG_CXX_LIBRARY = "libc++"; | ||
150 | CLANG_ENABLE_MODULES = YES; | ||
151 | CLANG_ENABLE_OBJC_ARC = YES; | ||
152 | CLANG_WARN_BOOL_CONVERSION = YES; | ||
153 | CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
154 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
155 | CLANG_WARN_EMPTY_BODY = YES; | ||
156 | CLANG_WARN_ENUM_CONVERSION = YES; | ||
157 | CLANG_WARN_INT_CONVERSION = YES; | ||
158 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
159 | CLANG_WARN_UNREACHABLE_CODE = YES; | ||
160 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
161 | COPY_PHASE_STRIP = NO; | ||
162 | ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
163 | GCC_C_LANGUAGE_STANDARD = gnu99; | ||
164 | GCC_DYNAMIC_NO_PIC = NO; | ||
165 | GCC_OPTIMIZATION_LEVEL = 0; | ||
166 | GCC_PREPROCESSOR_DEFINITIONS = ( | ||
167 | "DEBUG=1", | ||
168 | "$(inherited)", | ||
169 | ); | ||
170 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; | ||
171 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
172 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
173 | GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
174 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
175 | GCC_WARN_UNUSED_FUNCTION = YES; | ||
176 | GCC_WARN_UNUSED_VARIABLE = YES; | ||
177 | MACOSX_DEPLOYMENT_TARGET = 10.9; | ||
178 | MTL_ENABLE_DEBUG_INFO = YES; | ||
179 | ONLY_ACTIVE_ARCH = YES; | ||
180 | SDKROOT = macosx; | ||
181 | }; | ||
182 | name = Debug; | ||
183 | }; | ||
184 | C71365161B7CC2E500AB8010 /* Release */ = { | ||
185 | isa = XCBuildConfiguration; | ||
186 | buildSettings = { | ||
187 | ALWAYS_SEARCH_USER_PATHS = NO; | ||
188 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
189 | CLANG_CXX_LIBRARY = "libc++"; | ||
190 | CLANG_ENABLE_MODULES = YES; | ||
191 | CLANG_ENABLE_OBJC_ARC = YES; | ||
192 | CLANG_WARN_BOOL_CONVERSION = YES; | ||
193 | CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
194 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
195 | CLANG_WARN_EMPTY_BODY = YES; | ||
196 | CLANG_WARN_ENUM_CONVERSION = YES; | ||
197 | CLANG_WARN_INT_CONVERSION = YES; | ||
198 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
199 | CLANG_WARN_UNREACHABLE_CODE = YES; | ||
200 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
201 | COPY_PHASE_STRIP = NO; | ||
202 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | ||
203 | ENABLE_NS_ASSERTIONS = NO; | ||
204 | ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
205 | GCC_C_LANGUAGE_STANDARD = gnu99; | ||
206 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
207 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
208 | GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
209 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
210 | GCC_WARN_UNUSED_FUNCTION = YES; | ||
211 | GCC_WARN_UNUSED_VARIABLE = YES; | ||
212 | MACOSX_DEPLOYMENT_TARGET = 10.9; | ||
213 | MTL_ENABLE_DEBUG_INFO = NO; | ||
214 | SDKROOT = macosx; | ||
215 | }; | ||
216 | name = Release; | ||
217 | }; | ||
218 | C71365181B7CC2E500AB8010 /* Debug */ = { | ||
219 | isa = XCBuildConfiguration; | ||
220 | buildSettings = { | ||
221 | PRODUCT_NAME = "$(TARGET_NAME)"; | ||
222 | }; | ||
223 | name = Debug; | ||
224 | }; | ||
225 | C71365191B7CC2E500AB8010 /* Release */ = { | ||
226 | isa = XCBuildConfiguration; | ||
227 | buildSettings = { | ||
228 | PRODUCT_NAME = "$(TARGET_NAME)"; | ||
229 | }; | ||
230 | name = Release; | ||
231 | }; | ||
232 | /* End XCBuildConfiguration section */ | ||
233 | |||
234 | /* Begin XCConfigurationList section */ | ||
235 | C713650B1B7CC2E500AB8010 /* Build configuration list for PBXProject "simulator" */ = { | ||
236 | isa = XCConfigurationList; | ||
237 | buildConfigurations = ( | ||
238 | C71365151B7CC2E500AB8010 /* Debug */, | ||
239 | C71365161B7CC2E500AB8010 /* Release */, | ||
240 | ); | ||
241 | defaultConfigurationIsVisible = 0; | ||
242 | defaultConfigurationName = Release; | ||
243 | }; | ||
244 | C71365171B7CC2E500AB8010 /* Build configuration list for PBXNativeTarget "simulator" */ = { | ||
245 | isa = XCConfigurationList; | ||
246 | buildConfigurations = ( | ||
247 | C71365181B7CC2E500AB8010 /* Debug */, | ||
248 | C71365191B7CC2E500AB8010 /* Release */, | ||
249 | ); | ||
250 | defaultConfigurationIsVisible = 0; | ||
251 | defaultConfigurationName = Release; | ||
252 | }; | ||
253 | /* End XCConfigurationList section */ | ||
254 | }; | ||
255 | rootObject = C71365081B7CC2E500AB8010 /* Project object */; | ||
256 | } | ||