From e314c84ab02ffe0fe47e616c2904df7984c5302f Mon Sep 17 00:00:00 2001 From: DaveHodder67 Date: Thu, 13 Aug 2015 13:33:20 +0100 Subject: adding an OS X simulator for interactive testing via MIDI --- .gitignore | 10 + tools/osx/simulator-osx.c | 99 ++++++++++ tools/osx/simulator.xcodeproj/project.pbxproj | 256 ++++++++++++++++++++++++++ 3 files changed, 365 insertions(+) create mode 100644 tools/osx/simulator-osx.c create mode 100644 tools/osx/simulator.xcodeproj/project.pbxproj diff --git a/.gitignore b/.gitignore index 03302a3..db8171d 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,13 @@ build .project .cproject + +*.xcworkspacedata + +*.xccheckout + +*.xcuserstate + +*.xcscheme + +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 @@ +/****************************************************************************** + + Copyright (c) 2015, Focusrite Audio Engineering Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Focusrite Audio Engineering Ltd., nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + *****************************************************************************/ + +#include +#include "app.h" + +// ____________________________________________________________________________ +// +// Simulator "hal". This lets you exercise your device code without having to upload +// it to the hardware, which also means you can debug it interactively. +// ____________________________________________________________________________ + +void hal_plot_led(u8 type, u8 index, u8 red, u8 green, u8 blue) +{ + // wire this up to MIDI out... +} + +void hal_send_midi(u8 port, u8 status, u8 d1, u8 d2) +{ + // send this up a virtual MIDI port? +} + +void hal_send_sysex(u8 port, const u8* data, u16 length) +{ + // as above, or just dump to console? +} + +// ____________________________________________________________________________ +// +// App event wrappers - these just log to the console. Would be nice to wire +// these up to a MIDI input from the real Launchpad Pro! +// ____________________________________________________________________________ + +static void sim_app_init() +{ + app_init(); +} + +static void sim_app_surface_event(u8 type, u8 index, u8 value) +{ + app_surface_event(type, index, value); +} + +static void sim_app_midi_event(u8 port, u8 status, u8 d1, u8 d2) +{ + app_midi_event(port, status, d1, d2); +} + +static void sim_app_timer_event() +{ + app_timer_event(); +} + +// ____________________________________________________________________________ + +int main(int argc, char * argv[]) +{ + // open MIDI ports and wire them up + + // init the app + sim_app_init(); + + // start the terrible busywaiting timer loop + for (;;) + { + + } + + return 0; +} \ 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 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + C70651A01B7CC4A20005FDD9 /* app.c in Sources */ = {isa = PBXBuildFile; fileRef = C706519F1B7CC4A20005FDD9 /* app.c */; }; + C70651A81B7CC56F0005FDD9 /* simulator-osx.c in Sources */ = {isa = PBXBuildFile; fileRef = C70651A71B7CC56F0005FDD9 /* simulator-osx.c */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + C713650E1B7CC2E500AB8010 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + C706519F1B7CC4A20005FDD9 /* app.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = app.c; path = ../../src/app.c; sourceTree = ""; }; + C70651A11B7CC4B20005FDD9 /* app_defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = app_defs.h; path = ../../include/app_defs.h; sourceTree = ""; }; + C70651A21B7CC4B20005FDD9 /* app.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = app.h; path = ../../include/app.h; sourceTree = ""; }; + C70651A71B7CC56F0005FDD9 /* simulator-osx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "simulator-osx.c"; sourceTree = ""; }; + C71365101B7CC2E500AB8010 /* simulator */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = simulator; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + C713650D1B7CC2E500AB8010 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + C70651A51B7CC4D60005FDD9 /* source */ = { + isa = PBXGroup; + children = ( + C70651A71B7CC56F0005FDD9 /* simulator-osx.c */, + C706519F1B7CC4A20005FDD9 /* app.c */, + ); + name = source; + sourceTree = ""; + }; + C70651A61B7CC4DF0005FDD9 /* include */ = { + isa = PBXGroup; + children = ( + C70651A11B7CC4B20005FDD9 /* app_defs.h */, + C70651A21B7CC4B20005FDD9 /* app.h */, + ); + name = include; + sourceTree = ""; + }; + C71365071B7CC2E500AB8010 = { + isa = PBXGroup; + children = ( + C70651A61B7CC4DF0005FDD9 /* include */, + C70651A51B7CC4D60005FDD9 /* source */, + C71365111B7CC2E500AB8010 /* Products */, + ); + sourceTree = ""; + }; + C71365111B7CC2E500AB8010 /* Products */ = { + isa = PBXGroup; + children = ( + C71365101B7CC2E500AB8010 /* simulator */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + C713650F1B7CC2E500AB8010 /* simulator */ = { + isa = PBXNativeTarget; + buildConfigurationList = C71365171B7CC2E500AB8010 /* Build configuration list for PBXNativeTarget "simulator" */; + buildPhases = ( + C713650C1B7CC2E500AB8010 /* Sources */, + C713650D1B7CC2E500AB8010 /* Frameworks */, + C713650E1B7CC2E500AB8010 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = simulator; + productName = simulator; + productReference = C71365101B7CC2E500AB8010 /* simulator */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + C71365081B7CC2E500AB8010 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0620; + ORGANIZATIONNAME = "Focusrite Audio Engineering Ltd."; + TargetAttributes = { + C713650F1B7CC2E500AB8010 = { + CreatedOnToolsVersion = 6.2; + }; + }; + }; + buildConfigurationList = C713650B1B7CC2E500AB8010 /* Build configuration list for PBXProject "simulator" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = C71365071B7CC2E500AB8010; + productRefGroup = C71365111B7CC2E500AB8010 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + C713650F1B7CC2E500AB8010 /* simulator */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + C713650C1B7CC2E500AB8010 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C70651A81B7CC56F0005FDD9 /* simulator-osx.c in Sources */, + C70651A01B7CC4A20005FDD9 /* app.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + C71365151B7CC2E500AB8010 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + C71365161B7CC2E500AB8010 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + C71365181B7CC2E500AB8010 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + C71365191B7CC2E500AB8010 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C713650B1B7CC2E500AB8010 /* Build configuration list for PBXProject "simulator" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C71365151B7CC2E500AB8010 /* Debug */, + C71365161B7CC2E500AB8010 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C71365171B7CC2E500AB8010 /* Build configuration list for PBXNativeTarget "simulator" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C71365181B7CC2E500AB8010 /* Debug */, + C71365191B7CC2E500AB8010 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = C71365081B7CC2E500AB8010 /* Project object */; +} -- cgit v1.2.1