├── .github
└── FUNDING.yml
├── linux
├── cibuild
└── CMakeLists.txt
├── cinderblock.png
├── templates
└── Basic MIDI
│ ├── include
│ └── Resources.h
│ ├── template.xml
│ └── src
│ └── _TBOX_PREFIX_App.cpp
├── MidiTest
├── vc2013
│ ├── Resources.rc
│ ├── sample.sln
│ ├── sample.vcxproj.filters
│ └── sample.vcxproj
├── vc2017
│ ├── Resources.rc
│ ├── sample.sln
│ ├── sample.vcxproj.filters
│ └── sample.vcxproj
├── vc2019
│ ├── Resources.rc
│ ├── MidiTest.sln
│ ├── MidiTest.vcxproj.filters
│ └── MidiTest.vcxproj
├── resources
│ ├── CinderApp.icns
│ └── cinder_app_icon.ico
├── include
│ └── Resources.h
├── xcode
│ ├── MidiTest.xcodeproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcuserdata
│ │ │ │ └── bruce.xcuserdatad
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── xcuserdata
│ │ │ └── bruce.xcuserdatad
│ │ │ └── xcschemes
│ │ │ ├── xcschememanagement.plist
│ │ │ └── MidiTest.xcscheme
│ ├── MidiTest_Prefix.pch
│ └── Info.plist
└── src
│ └── MidiTestApp.cpp
├── samples
├── Devices
│ ├── AkaiMidimix.midimix
│ └── KorgNanoKontrol2.nktrl2_data
├── Midi2Osc
│ ├── vc2015
│ │ ├── Resources.rc
│ │ ├── Midi2Osc.sln
│ │ ├── Midi2Osc.vcxproj.filters
│ │ └── Midi2Osc.vcxproj
│ ├── vc2017
│ │ ├── Resources.rc
│ │ ├── Midi2Osc.sln
│ │ ├── Midi2Osc.vcxproj.filters
│ │ └── Midi2Osc.vcxproj
│ ├── vc2019
│ │ ├── Resources.rc
│ │ ├── Midi2Osc.sln
│ │ ├── Midi2Osc.vcxproj.filters
│ │ └── Midi2Osc.vcxproj
│ ├── resources
│ │ └── cinder_app_icon.ico
│ ├── include
│ │ └── Resources.h
│ └── src
│ │ └── Midi2OscApp.cpp
└── Midi2Websocket
│ ├── vc2015
│ ├── Resources.rc
│ ├── Midi2Websocket.sln
│ ├── Midi2Websocket.vcxproj.filters
│ └── Midi2Websocket.vcxproj
│ ├── vc2017
│ ├── Resources.rc
│ ├── Midi2Websocket.sln
│ ├── Midi2Websocket.vcxproj.filters
│ └── Midi2Websocket.vcxproj
│ ├── resources
│ └── cinder_app_icon.ico
│ ├── include
│ └── Resources.h
│ └── src
│ └── Midi2WebsocketApp.cpp
├── .gitattributes
├── src
├── MidiMessage.cpp
├── MidiIn.cpp
├── MidiHub.cpp
└── MidiOut.cpp
├── cinderblock.xml
├── include
├── MidiHeaders.h
├── MidiExceptions.h
├── MidiMessage.h
├── MidiHub.h
├── MidiConstants.h
├── MidiIn.h
└── MidiOut.h
├── .gitignore
└── README.md
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [brucelane]
2 |
--------------------------------------------------------------------------------
/linux/cibuild:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | ../../../../tools/linux/cibuilder -app "$@"
3 |
--------------------------------------------------------------------------------
/cinderblock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brucelane/Cinder-MIDI2/HEAD/cinderblock.png
--------------------------------------------------------------------------------
/templates/Basic MIDI/include/Resources.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "cinder/CinderResources.h"
3 |
--------------------------------------------------------------------------------
/MidiTest/vc2013/Resources.rc:
--------------------------------------------------------------------------------
1 | #include "../include/Resources.h"
2 |
3 | 1 ICON "..\\resources\\cinder_app_icon.ico"
4 |
--------------------------------------------------------------------------------
/MidiTest/vc2017/Resources.rc:
--------------------------------------------------------------------------------
1 | #include "../include/Resources.h"
2 |
3 | 1 ICON "..\\resources\\cinder_app_icon.ico"
4 |
--------------------------------------------------------------------------------
/MidiTest/vc2019/Resources.rc:
--------------------------------------------------------------------------------
1 | #include "../include/Resources.h"
2 |
3 | 1 ICON "..\\resources\\cinder_app_icon.ico"
4 |
--------------------------------------------------------------------------------
/MidiTest/resources/CinderApp.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brucelane/Cinder-MIDI2/HEAD/MidiTest/resources/CinderApp.icns
--------------------------------------------------------------------------------
/samples/Devices/AkaiMidimix.midimix:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brucelane/Cinder-MIDI2/HEAD/samples/Devices/AkaiMidimix.midimix
--------------------------------------------------------------------------------
/samples/Midi2Osc/vc2015/Resources.rc:
--------------------------------------------------------------------------------
1 | #include "../include/Resources.h"
2 |
3 | 1 ICON "..\\resources\\cinder_app_icon.ico"
4 |
--------------------------------------------------------------------------------
/samples/Midi2Osc/vc2017/Resources.rc:
--------------------------------------------------------------------------------
1 | #include "../include/Resources.h"
2 |
3 | 1 ICON "..\\resources\\cinder_app_icon.ico"
4 |
--------------------------------------------------------------------------------
/samples/Midi2Osc/vc2019/Resources.rc:
--------------------------------------------------------------------------------
1 | #include "../include/Resources.h"
2 |
3 | 1 ICON "..\\resources\\cinder_app_icon.ico"
4 |
--------------------------------------------------------------------------------
/samples/Midi2Websocket/vc2015/Resources.rc:
--------------------------------------------------------------------------------
1 | #include "../include/Resources.h"
2 |
3 | 1 ICON "..\\resources\\cinder_app_icon.ico"
4 |
--------------------------------------------------------------------------------
/samples/Midi2Websocket/vc2017/Resources.rc:
--------------------------------------------------------------------------------
1 | #include "../include/Resources.h"
2 |
3 | 1 ICON "..\\resources\\cinder_app_icon.ico"
4 |
--------------------------------------------------------------------------------
/MidiTest/resources/cinder_app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brucelane/Cinder-MIDI2/HEAD/MidiTest/resources/cinder_app_icon.ico
--------------------------------------------------------------------------------
/samples/Devices/KorgNanoKontrol2.nktrl2_data:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brucelane/Cinder-MIDI2/HEAD/samples/Devices/KorgNanoKontrol2.nktrl2_data
--------------------------------------------------------------------------------
/samples/Midi2Osc/resources/cinder_app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brucelane/Cinder-MIDI2/HEAD/samples/Midi2Osc/resources/cinder_app_icon.ico
--------------------------------------------------------------------------------
/samples/Midi2Websocket/resources/cinder_app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brucelane/Cinder-MIDI2/HEAD/samples/Midi2Websocket/resources/cinder_app_icon.ico
--------------------------------------------------------------------------------
/MidiTest/include/Resources.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "cinder/CinderResources.h"
3 |
4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE )
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/samples/Midi2Osc/include/Resources.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "cinder/CinderResources.h"
3 |
4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE )
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/samples/Midi2Websocket/include/Resources.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "cinder/CinderResources.h"
3 |
4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE )
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/MidiTest/xcode/MidiTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/templates/Basic MIDI/template.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | mb.cinder.midi2
5 | src/_TBOX_PREFIX_App.cpp
6 |
7 |
--------------------------------------------------------------------------------
/MidiTest/xcode/MidiTest_Prefix.pch:
--------------------------------------------------------------------------------
1 | #if defined( __cplusplus )
2 | #include "cinder/Cinder.h"
3 |
4 | #include "cinder/app/App.h"
5 |
6 | #include "cinder/gl/gl.h"
7 |
8 | #include "cinder/CinderMath.h"
9 | #include "cinder/Matrix.h"
10 | #include "cinder/Vector.h"
11 | #include "cinder/Quaternion.h"
12 | #endif
13 |
--------------------------------------------------------------------------------
/MidiTest/xcode/MidiTest.xcodeproj/project.xcworkspace/xcuserdata/bruce.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildLocationStyle
6 | UseTargetSettings
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/src/MidiMessage.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Message.cpp
3 | * glitches
4 | *
5 | * Created by hec on 5/20/10.
6 | * Copyright 2010 aer studio. All rights reserved.
7 | *
8 | */
9 |
10 | #include "MidiMessage.h"
11 |
12 | namespace cinder { namespace midi {
13 |
14 | Message::Message(){
15 |
16 | }
17 |
18 | Message& Message::copy(const Message& other){
19 | port = other.port;
20 | channel = other.channel;
21 | status = other.status;
22 | byteOne = other.byteOne;
23 | byteTwo = other.byteTwo;
24 |
25 | return *this;
26 | }
27 |
28 | }// namespace midi
29 | }// namespace cinder
--------------------------------------------------------------------------------
/MidiTest/xcode/MidiTest.xcodeproj/xcuserdata/bruce.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | MidiTest.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 8D1107260486CEB800E47090
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/MidiTest/vc2019/MidiTest.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 12.00
2 | # Visual Studio Version 16
3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MidiTest", "MidiTest.vcxproj", "{983EF04F-1930-4DEE-945D-A49570A18EF1}"
4 | EndProject
5 | Global
6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
7 | Debug|x64 = Debug|x64
8 | Release|x64 = Release|x64
9 | EndGlobalSection
10 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
11 | {983EF04F-1930-4DEE-945D-A49570A18EF1}.Debug|x64.ActiveCfg = Debug|x64
12 | {983EF04F-1930-4DEE-945D-A49570A18EF1}.Debug|x64.Build.0 = Debug|x64
13 | {983EF04F-1930-4DEE-945D-A49570A18EF1}.Release|x64.ActiveCfg = Release|x64
14 | {983EF04F-1930-4DEE-945D-A49570A18EF1}.Release|x64.Build.0 = Release|x64
15 | EndGlobalSection
16 | GlobalSection(SolutionProperties) = preSolution
17 | HideSolutionNode = FALSE
18 | EndGlobalSection
19 | EndGlobal
20 |
--------------------------------------------------------------------------------
/MidiTest/vc2013/sample.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Express 2012 for Windows Desktop
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample", "sample.vcxproj", "{7F571890-FF11-4184-AF53-AFF0E0B1C946}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {7F571890-FF11-4184-AF53-AFF0E0B1C946}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {7F571890-FF11-4184-AF53-AFF0E0B1C946}.Debug|Win32.Build.0 = Debug|Win32
14 | {7F571890-FF11-4184-AF53-AFF0E0B1C946}.Release|Win32.ActiveCfg = Release|Win32
15 | {7F571890-FF11-4184-AF53-AFF0E0B1C946}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/MidiTest/vc2017/sample.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Express 2012 for Windows Desktop
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample", "sample.vcxproj", "{7F571890-FF11-4184-AF53-AFF0E0B1C946}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {7F571890-FF11-4184-AF53-AFF0E0B1C946}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {7F571890-FF11-4184-AF53-AFF0E0B1C946}.Debug|Win32.Build.0 = Debug|Win32
14 | {7F571890-FF11-4184-AF53-AFF0E0B1C946}.Release|Win32.ActiveCfg = Release|Win32
15 | {7F571890-FF11-4184-AF53-AFF0E0B1C946}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/MidiTest/xcode/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIconFile
10 | CinderApp.icns
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSMinimumSystemVersion
26 | ${MACOSX_DEPLOYMENT_TARGET}
27 | NSHumanReadableCopyright
28 | Copyright © 2015 __MyCompanyName__. All rights reserved.
29 | NSMainNibFile
30 | MainMenu
31 | NSPrincipalClass
32 | NSApplication
33 |
34 |
35 |
--------------------------------------------------------------------------------
/linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Videodromm
2 | cmake_minimum_required( VERSION 2.8 FATAL_ERROR )
3 | set( CMAKE_VERBOSE_MAKEFILE on )
4 |
5 | get_filename_component( CINDER_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../.." ABSOLUTE )
6 | include( ${CINDER_DIR}/linux/cmake/Cinder.cmake )
7 |
8 | project( Videodromm )
9 |
10 | get_filename_component( SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../src" ABSOLUTE )
11 | get_filename_component( INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../include" ABSOLUTE )
12 |
13 | if( NOT TARGET cinder${CINDER_LIB_SUFFIX} )
14 | find_package( cinder REQUIRED
15 | PATHS ${PROJECT_SOURCE_DIR}/../../../../linux/${CMAKE_BUILD_TYPE}/${CINDER_OUT_DIR_PREFIX}
16 | $ENV{Cinder_DIR}/linux/${CMAKE_BUILD_TYPE}/${CINDER_OUT_DIR_PREFIX}
17 | )
18 | endif()
19 |
20 | # Use PROJECT_NAME since CMAKE_PROJET_NAME returns the top-level project name.
21 | set( EXE_NAME ${PROJECT_NAME} )
22 |
23 | set( SRC_FILES
24 | ${SRC_DIR}/MidiHub.cpp
25 | ${SRC_DIR}/MidiIn.cpp
26 | ${SRC_DIR}/MidiMessage.cpp
27 | ${SRC_DIR}/MidiOut.cpp
28 | ${SRC_DIR}/RtMidi.cpp
29 | ${SRC_DIR}/VDApp.cpp
30 | )
31 |
32 | add_executable( "${EXE_NAME}" ${SRC_FILES} )
33 |
34 | target_include_directories(
35 | "${EXE_NAME}"
36 | PUBLIC ${INC_DIR}
37 | )
38 |
39 | target_link_libraries( "${EXE_NAME}" cinder${CINDER_LIB_SUFFIX} )
40 |
--------------------------------------------------------------------------------
/samples/Midi2Osc/vc2015/Midi2Osc.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2015
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2Osc", "Midi2Osc.vcxproj", "{7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | Debug|x64 = Debug|x64
11 | Release|x64 = Release|x64
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Debug|Win32.ActiveCfg = Debug|Win32
15 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Debug|Win32.Build.0 = Debug|Win32
16 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Release|Win32.ActiveCfg = Release|Win32
17 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Release|Win32.Build.0 = Release|Win32
18 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Debug|x64.ActiveCfg = Debug|x64
19 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Debug|x64.Build.0 = Debug|x64
20 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Release|x64.ActiveCfg = Release|x64
21 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Release|x64.Build.0 = Release|x64
22 | EndGlobalSection
23 | GlobalSection(SolutionProperties) = preSolution
24 | HideSolutionNode = FALSE
25 | EndGlobalSection
26 | EndGlobal
27 |
--------------------------------------------------------------------------------
/samples/Midi2Osc/vc2017/Midi2Osc.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2015
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2Osc", "Midi2Osc.vcxproj", "{7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | Debug|x64 = Debug|x64
11 | Release|x64 = Release|x64
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Debug|Win32.ActiveCfg = Debug|Win32
15 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Debug|Win32.Build.0 = Debug|Win32
16 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Release|Win32.ActiveCfg = Release|Win32
17 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Release|Win32.Build.0 = Release|Win32
18 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Debug|x64.ActiveCfg = Debug|x64
19 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Debug|x64.Build.0 = Debug|x64
20 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Release|x64.ActiveCfg = Release|x64
21 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Release|x64.Build.0 = Release|x64
22 | EndGlobalSection
23 | GlobalSection(SolutionProperties) = preSolution
24 | HideSolutionNode = FALSE
25 | EndGlobalSection
26 | EndGlobal
27 |
--------------------------------------------------------------------------------
/samples/Midi2Osc/vc2019/Midi2Osc.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2015
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2Osc", "Midi2Osc.vcxproj", "{7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | Debug|x64 = Debug|x64
11 | Release|x64 = Release|x64
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Debug|Win32.ActiveCfg = Debug|Win32
15 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Debug|Win32.Build.0 = Debug|Win32
16 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Release|Win32.ActiveCfg = Release|Win32
17 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Release|Win32.Build.0 = Release|Win32
18 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Debug|x64.ActiveCfg = Debug|x64
19 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Debug|x64.Build.0 = Debug|x64
20 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Release|x64.ActiveCfg = Release|x64
21 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}.Release|x64.Build.0 = Release|x64
22 | EndGlobalSection
23 | GlobalSection(SolutionProperties) = preSolution
24 | HideSolutionNode = FALSE
25 | EndGlobalSection
26 | EndGlobal
27 |
--------------------------------------------------------------------------------
/samples/Midi2Websocket/vc2015/Midi2Websocket.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2015
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2Websocket", "Midi2Websocket.vcxproj", "{D3920E1F-039E-4191-B5DA-6DB2051CE0DD}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | Debug|x64 = Debug|x64
11 | Release|x64 = Release|x64
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Debug|Win32.ActiveCfg = Debug|Win32
15 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Debug|Win32.Build.0 = Debug|Win32
16 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Release|Win32.ActiveCfg = Release|Win32
17 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Release|Win32.Build.0 = Release|Win32
18 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Debug|x64.ActiveCfg = Debug|x64
19 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Debug|x64.Build.0 = Debug|x64
20 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Release|x64.ActiveCfg = Release|x64
21 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Release|x64.Build.0 = Release|x64
22 | EndGlobalSection
23 | GlobalSection(SolutionProperties) = preSolution
24 | HideSolutionNode = FALSE
25 | EndGlobalSection
26 | EndGlobal
27 |
--------------------------------------------------------------------------------
/samples/Midi2Websocket/vc2017/Midi2Websocket.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2015
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2Websocket", "Midi2Websocket.vcxproj", "{D3920E1F-039E-4191-B5DA-6DB2051CE0DD}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | Debug|x64 = Debug|x64
11 | Release|x64 = Release|x64
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Debug|Win32.ActiveCfg = Debug|Win32
15 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Debug|Win32.Build.0 = Debug|Win32
16 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Release|Win32.ActiveCfg = Release|Win32
17 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Release|Win32.Build.0 = Release|Win32
18 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Debug|x64.ActiveCfg = Debug|x64
19 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Debug|x64.Build.0 = Debug|x64
20 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Release|x64.ActiveCfg = Release|x64
21 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}.Release|x64.Build.0 = Release|x64
22 | EndGlobalSection
23 | GlobalSection(SolutionProperties) = preSolution
24 | HideSolutionNode = FALSE
25 | EndGlobalSection
26 | EndGlobal
27 |
--------------------------------------------------------------------------------
/cinderblock.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
14 |
15 |
16 | include
17 | lib
18 | src
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | src/MidiHub.cpp
29 | src/MidiIn.cpp
30 | src/MidiMessage.cpp
31 | src/MidiOut.cpp
32 | lib/RtMidi.cpp
33 |
34 | CoreMIDI.framework
35 |
36 |
37 | winmm.lib
38 |
39 |
40 | templates/Basic MIDI/template.xml
41 |
42 |
--------------------------------------------------------------------------------
/include/MidiHeaders.h:
--------------------------------------------------------------------------------
1 | /*
2 | MidiBlock for Cinder developed by Bruce Lane, Martin Blasko.
3 | Original code by Hector Sanchez-Pajares(http://www.aerstudio.com).
4 | MidiOut written by Tim Murray-Browne (http://timmb.com)
5 | Midi parsing taken from openFrameworks addon ofxMidi by Theo Watson & Dan Wilcox
6 |
7 | This is a block for MIDI Integration for Cinder framework developed by The Barbarian Group, 2010
8 |
9 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that
10 | the following conditions are met:
11 |
12 | * Redistributions of source code must retain the above copyright notice, this list of conditions and
13 | the following disclaimer.
14 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
15 | the following disclaimer in the documentation and/or other materials provided with the distribution.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
18 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 | POSSIBILITY OF SUCH DAMAGE.
25 |
26 | */
27 |
28 | #pragma once
29 |
30 | #include
31 | #include
32 |
33 | #include "MidiConstants.h"
34 | #include "MidiExceptions.h"
35 | #include "MidiMessage.h"
36 | #include "RtMidi.h"
37 | #include "MidiIn.h"
38 | #include "MidiOut.h"
39 | #include "MidiHub.h"
40 |
--------------------------------------------------------------------------------
/include/MidiExceptions.h:
--------------------------------------------------------------------------------
1 | /*
2 | MidiBlock for Cinder developed by Bruce Lane, Martin Blasko.
3 | Original code by Hector Sanchez-Pajares(http://www.aerstudio.com).
4 | MidiOut written by Tim Murray-Browne (http://timmb.com)
5 | Midi parsing taken from openFrameworks addon ofxMidi by Theo Watson & Dan Wilcox
6 |
7 |
8 | This is a block for MIDI Integration for Cinder framework developed by The Barbarian Group, 2010
9 |
10 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that
11 | the following conditions are met:
12 |
13 | * Redistributions of source code must retain the above copyright notice, this list of conditions and
14 | the following disclaimer.
15 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
16 | the following disclaimer in the documentation and/or other materials provided with the distribution.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
19 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
22 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 | POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 |
29 | #pragma once
30 |
31 |
32 | namespace cinder { namespace midi {
33 |
34 | class MidiExc : public std::exception {
35 |
36 | };
37 |
38 | class MidiExcNoPortsAvailable : public MidiExc {
39 |
40 | };
41 |
42 | class MidiExcPortNotAvailable : public MidiExc {
43 |
44 | };
45 |
46 | } // namespace midi
47 | } // namespace cinder
48 |
--------------------------------------------------------------------------------
/include/MidiMessage.h:
--------------------------------------------------------------------------------
1 | /*
2 | MidiBlock for Cinder developed by Bruce Lane, Martin Blasko.
3 | Original code by Hector Sanchez-Pajares(http://www.aerstudio.com).
4 | MidiOut written by Tim Murray-Browne (http://timmb.com)
5 | Midi parsing taken from openFrameworks addon ofxMidi by Theo Watson & Dan Wilcox
6 |
7 |
8 | This is a block for MIDI Integration for Cinder framework developed by The Barbarian Group, 2010
9 |
10 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that
11 | the following conditions are met:
12 |
13 | * Redistributions of source code must retain the above copyright notice, this list of conditions and
14 | the following disclaimer.
15 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
16 | the following disclaimer in the documentation and/or other materials provided with the distribution.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
19 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
22 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 | POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 |
29 | #pragma once
30 |
31 |
32 | namespace cinder { namespace midi {
33 |
34 | class Message {
35 | public:
36 |
37 | Message();
38 |
39 | int port;
40 | int channel;
41 | int status;
42 | int byteOne;
43 | int byteTwo;
44 | double timeStamp;
45 | int pitch; //< 0 - 127
46 | int velocity; //< 0 - 127
47 | int control; //< 0 - 127
48 | int value; //< depends on message status type
49 | Message& copy(const Message& other);
50 | };
51 |
52 | } // namespace midi
53 | } // namespace cinder
54 |
--------------------------------------------------------------------------------
/include/MidiHub.h:
--------------------------------------------------------------------------------
1 | /*
2 | This is a block for MIDI Integration for Cinder framework developed by The Barbarian Group, 2010
3 |
4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that
5 | the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and
8 | the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
10 | the following disclaimer in the documentation and/or other materials provided with the distribution.
11 |
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
13 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
14 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
15 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
16 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
17 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
18 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
19 | POSSIBILITY OF SUCH DAMAGE.
20 | */
21 |
22 | /*
23 | * midi::Hub.h
24 | * By Roger Sodre
25 | *
26 | * Connects to ALL midi devices
27 | */
28 |
29 | #pragma once
30 |
31 | #include "MidiHeaders.h"
32 |
33 |
34 | namespace cinder { namespace midi {
35 |
36 | class Input;
37 |
38 | class Hub {
39 | public:
40 | Hub();
41 | ~Hub();
42 |
43 | void disconnectAll();
44 | void connectAll();
45 | void update();
46 |
47 | size_t getConnectedDeviceCount() { return midiInPool.size(); };
48 | bool isConnected() { return (midiInPool.size() > 0 ? true : false); };
49 | bool isDeviceConnected( std::string _name );
50 |
51 | //bool hasWaitingMessages();
52 | //bool getNextMessage( Message *msg );
53 |
54 | protected:
55 |
56 | RtMidiIn midii;
57 |
58 | std::vector midiInPool;
59 | //vector midiOutPool;
60 | };
61 |
62 |
63 | } // namespace midi
64 | } // namespace cinder
65 |
--------------------------------------------------------------------------------
/include/MidiConstants.h:
--------------------------------------------------------------------------------
1 | /*
2 | MidiBlock for Cinder developed by Bruce Lane, Martin Blasko.
3 | Original code by Hector Sanchez-Pajares(http://www.aerstudio.com).
4 | MidiOut written by Tim Murray-Browne (http://timmb.com)
5 | Midi parsing taken from openFrameworks addon ofxMidi by Theo Watson & Dan Wilcox
6 |
7 |
8 | This is a block for MIDI Integration for Cinder framework developed by The Barbarian Group, 2010
9 |
10 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that
11 | the following conditions are met:
12 |
13 | * Redistributions of source code must retain the above copyright notice, this list of conditions and
14 | the following disclaimer.
15 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
16 | the following disclaimer in the documentation and/or other materials provided with the distribution.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
19 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
22 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 | POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 |
29 | #pragma once
30 |
31 |
32 |
33 | // channel info
34 | enum MidiStatus {
35 |
36 | MIDI_UNKNOWN = 0x00,
37 |
38 | // channel voice messages
39 | MIDI_NOTE_OFF = 0x80,
40 | MIDI_NOTE_ON = 0x90,
41 | MIDI_CONTROL_CHANGE = 0xB0,
42 | MIDI_PROGRAM_CHANGE = 0xC0,
43 | MIDI_PITCH_BEND = 0xE0,
44 | MIDI_AFTERTOUCH = 0xD0, // aka channel pressure
45 | MIDI_POLY_AFTERTOUCH = 0xA0, // aka key pressure
46 |
47 | // system messages
48 | MIDI_SYSEX = 0xF0,
49 | MIDI_TIME_CODE = 0xF1,
50 | MIDI_SONG_POS_POINTER = 0xF2,
51 | MIDI_SONG_SELECT = 0xF3,
52 | MIDI_TUNE_REQUEST = 0xF6,
53 | MIDI_SYSEX_END = 0xF7,
54 | MIDI_TIME_CLOCK = 0xF8,
55 | MIDI_START = 0xFA,
56 | MIDI_CONTINUE = 0xFB,
57 | MIDI_STOP = 0xFC,
58 | MIDI_ACTIVE_SENSING = 0xFE,
59 | MIDI_SYSTEM_RESET = 0xFF
60 | };
61 |
--------------------------------------------------------------------------------
/templates/Basic MIDI/src/_TBOX_PREFIX_App.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2020, Bruce Lane - Martin Blasko All rights reserved.
3 | This code is intended for use with the Cinder C++ library: http://libcinder.org
4 |
5 | This file is part of Cinder-MIDI.
6 |
7 | Cinder-MIDI is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation, either version 3 of the License, or
10 | (at your option) any later version.
11 |
12 | Cinder-MIDI is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License
18 | along with Cinder-MIDI. If not, see .
19 | */
20 |
21 | // don't forget to add winmm.lib to the linker
22 |
23 | #include "cinder/app/App.h"
24 | #include "cinder/app/RendererGl.h"
25 | #include "cinder/gl/gl.h"
26 | #include "cinder/Utilities.h"
27 | #include
28 | #include "MidiIn.h"
29 | #include "MidiMessage.h"
30 | #include "MidiConstants.h"
31 |
32 | using namespace ci;
33 | using namespace ci::app;
34 | using namespace std;
35 |
36 | #define SLIDER_NOTE 1
37 |
38 |
39 | class _TBOX_PREFIX_App : public App {
40 | public:
41 | void setup() override;
42 | void update() override;
43 | void draw() override;
44 | void midiListener(midi::Message msg);
45 |
46 | midi::Input mMidiIn;
47 |
48 | float sliderValue = 0.0f;
49 | string status = "";
50 | int notes[128];
51 | int cc[128];
52 | };
53 |
54 | void _TBOX_PREFIX_App::setup(){
55 |
56 | if (mMidiIn.getNumPorts() > 0){
57 | mMidiIn.listPorts();
58 | mMidiIn.openPort(0);
59 | console() << "Opening MIDI port 0" << std::endl;
60 | mMidiIn.midiSignal.connect(std::bind(&_TBOX_PREFIX_App::midiListener, this, std::placeholders::_1));
61 | }else {
62 | console() << "No MIDI Ports found!!!!" << std::endl;
63 | }
64 | }
65 | void _TBOX_PREFIX_App::midiListener(midi::Message msg){
66 | switch (msg.status)
67 | {
68 | case MIDI_NOTE_ON:
69 | notes[msg.pitch] = msg.velocity;
70 | status = "Pitch: " + toString(msg.pitch) + "\n" + "Velocity: " + toString(msg.velocity);
71 | sliderValue = msg.pitch / 127.0f;
72 | break;
73 | case MIDI_NOTE_OFF:
74 | break;
75 | case MIDI_CONTROL_CHANGE:
76 | cc[msg.control] = msg.value;
77 | sliderValue = msg.value / 127.0f;
78 | status = "Control: " + toString(msg.control) + "\n" +
79 | "Value: " + toString(msg.value);
80 | break;
81 | default:
82 | break;
83 | }
84 |
85 | }
86 | void _TBOX_PREFIX_App::update(){
87 |
88 | }
89 |
90 | void _TBOX_PREFIX_App::draw(){
91 | gl::clear(Color(0,0,0), true);
92 | gl::color(Color(1, 1, 1));
93 | gl::drawSolidRect(Rectf(vec2(0, 0), vec2(sliderValue * getWindowWidth(), getWindowHeight())));
94 | }
95 |
96 | CINDER_APP( _TBOX_PREFIX_App, RendererGl )
97 |
--------------------------------------------------------------------------------
/include/MidiIn.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | MidiBlock for Cinder developed by Bruce Lane, Martin Blasko.
4 | Original code by Hector Sanchez-Pajares(http://www.aerstudio.com).
5 | Midi parsing taken from openFrameworks addon ofxMidi by Theo Watson & Dan Wilcox
6 |
7 | All rights reserved.
8 |
9 |
10 |
11 | This is a block for MIDI Integration for Cinder framework developed by The Barbarian Group, 2010
12 |
13 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that
14 | the following conditions are met:
15 |
16 | * Redistributions of source code must retain the above copyright notice, this list of conditions and
17 | the following disclaimer.
18 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
19 | the following disclaimer in the documentation and/or other materials provided with the distribution.
20 |
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
22 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 | POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 |
32 | #pragma once
33 |
34 | #include
35 | #include
36 | #include
37 |
38 | #include "MidiHeaders.h"
39 | #include "cinder/Signals.h"
40 | #include "cinder/ConcurrentCircularBuffer.h"
41 |
42 |
43 |
44 | namespace cinder { namespace midi {
45 |
46 | void MidiInCallback( double deltatime, std::vector< unsigned char > *message, void *userData );
47 |
48 | class Input {
49 | public:
50 | Input();
51 | virtual ~Input();
52 |
53 | void processMessage(double deltatime, std::vector *message);
54 | void listPorts();
55 | void openPort(unsigned int port = 0);
56 | void closePort();
57 |
58 | void setDispatchToMainThread(bool shouldDispatch) { mDispatchToMainThread = shouldDispatch; }
59 |
60 | unsigned int getNumPorts()const{ return mNumPorts; }
61 | unsigned int getPort()const;
62 | void ignoreTypes(bool sysex, bool time, bool midisense);
63 |
64 | std::vector mPortNames;
65 | std::string getName() { return mName; };
66 | std::string getPortName(int number);
67 |
68 | signals::Signal midiThreadSignal; // Will be called from the Midi thread
69 | signals::Signal midiSignal; // Will be called from the Main thread
70 |
71 |
72 | protected:
73 |
74 | RtMidiIn* mMidiIn;
75 | unsigned int mNumPorts;
76 | unsigned int mPort;
77 | std::string mName;
78 |
79 | bool mDispatchToMainThread { true };
80 |
81 | };
82 |
83 | } // namespace midi
84 | } // namespace cinder
85 |
--------------------------------------------------------------------------------
/MidiTest/src/MidiTestApp.cpp:
--------------------------------------------------------------------------------
1 | #include "cinder/app/App.h"
2 | #include "cinder/app/RendererGl.h"
3 | #include "cinder/gl/gl.h"
4 | #include "cinder/Utilities.h"
5 |
6 | #include "MidiHeaders.h"
7 | #include "cinder/Font.h"
8 |
9 | using namespace ci;
10 | using namespace ci::app;
11 | using namespace std;
12 |
13 | #define TAU M_PI*2
14 |
15 | class MidiTestApp : public App {
16 | public:
17 | void setup();
18 | void mouseDown(MouseEvent event);
19 | void update();
20 | void draw();
21 | void initPads();
22 |
23 | void midiListener(midi::Message msg);
24 | void midiThreadListener(midi::Message msg);
25 |
26 | midi::Input mInput;
27 | vector notes;
28 | vector cc;
29 |
30 | Font mFont;
31 | std::string status;
32 |
33 | };
34 |
35 | void MidiTestApp::midiThreadListener(midi::Message msg)
36 | {
37 | // This will be called from a background midi thread
38 | }
39 |
40 | void MidiTestApp::midiListener(midi::Message msg)
41 | {
42 | // This will be called on on the main thread and
43 | // safe to use with update and draw.
44 |
45 | switch (msg.status)
46 | {
47 | case MIDI_NOTE_ON:
48 | notes[msg.pitch] = msg.velocity;
49 | status = "Pitch: " + toString(msg.pitch) + "\n" +
50 | "Velocity: " + toString(msg.velocity);
51 | break;
52 | case MIDI_NOTE_OFF:
53 | notes[msg.pitch] = 0;
54 | break;
55 | case MIDI_CONTROL_CHANGE:
56 | cc[msg.control] = msg.value;
57 | status = "Control: " + toString(msg.control) + "\n" +
58 | "Value: " + toString(msg.value);
59 | break;
60 | default:
61 | break;
62 | }
63 |
64 | }
65 |
66 | void MidiTestApp::setup()
67 | {
68 | mInput.listPorts();
69 | console() << "NUMBER OF PORTS: " << mInput.getNumPorts() << endl;
70 |
71 | if (mInput.getNumPorts() > 0)
72 | {
73 | for (int i = 0; i < mInput.getNumPorts(); i++)
74 | console() << mInput.getPortName(i) << endl;
75 |
76 | mInput.openPort(0);
77 |
78 | // Connect midi signal to our callback function
79 | // This connects to our main thread
80 | mInput.midiSignal.connect([this](midi::Message msg) { midiListener(msg); });
81 |
82 | // Optionally, this connects directly to the midi thread
83 | mInput.midiThreadSignal.connect([this](midi::Message msg) { midiThreadListener(msg); });
84 | }
85 |
86 | for (int i = 0; i < 127; i++)
87 | {
88 | notes.push_back(0);
89 | cc.push_back(0);
90 | }
91 |
92 | mFont = Font("Arial", 25);
93 | }
94 |
95 | void MidiTestApp::mouseDown(MouseEvent event)
96 | {
97 | }
98 |
99 | void MidiTestApp::update()
100 | {
101 | }
102 |
103 | void MidiTestApp::draw()
104 | {
105 | // clear out the window with black
106 | gl::clear(Color(0, 0, 0));
107 | gl::pushMatrices();
108 | gl::translate(getWindowCenter());
109 |
110 | for (int i = 0; i < notes.size(); i++)
111 | {
112 | float x = 200 * sin((i * 2.83) * M_PI / 180);
113 | float y = 200 * cos((i * 2.83) * M_PI / 180);
114 | float lx = (200 - cc[i]) * sin((i * 2.83) * M_PI / 180);
115 | float ly = (200 - cc[i]) * cos((i * 2.83) * M_PI / 180);
116 |
117 | gl::color(Color(1, 1, 1));
118 | gl::drawStrokedCircle(vec2(x, y), 5 + (notes[i] / 4));
119 | gl::drawLine(vec2(x, y), vec2(lx, ly));
120 | gl::color(Color(notes[i], notes[i], notes[i]));
121 | gl::drawSolidCircle(vec2(x, y), 5 + (notes[i] / 4));
122 |
123 | }
124 |
125 |
126 | gl::popMatrices();
127 | gl::drawStringCentered(status, getWindowCenter(), Color(1, 1, 1), mFont);
128 | }
129 |
130 |
131 |
132 | CINDER_APP(MidiTestApp, RendererGl(RendererGl::Options().msaa(4)), [](App::Settings* settings)
133 | {
134 | settings->setWindowSize(600, 600);
135 | })
136 |
--------------------------------------------------------------------------------
/MidiTest/xcode/MidiTest.xcodeproj/xcuserdata/bruce.xcuserdatad/xcschemes/MidiTest.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #################
2 | ## Eclipse
3 | #################
4 |
5 | *.pydevproject
6 | .project
7 | .metadata
8 | bin/
9 | tmp/
10 | *.tmp
11 | *.bak
12 | *.swp
13 | *~.nib
14 | local.properties
15 | .classpath
16 | .settings/
17 | .loadpath
18 |
19 | # External tool builders
20 | .externalToolBuilders/
21 |
22 | # Locally stored "Eclipse launch configurations"
23 | *.launch
24 |
25 | # CDT-specific
26 | .cproject
27 |
28 | # PDT-specific
29 | .buildpath
30 |
31 |
32 | #################
33 | ## Visual Studio
34 | #################
35 |
36 | ## Ignore Visual Studio temporary files, build results, and
37 | ## files generated by popular Visual Studio add-ons.
38 |
39 | # User-specific files
40 | *.suo
41 | *.user
42 | *.sln.docstates
43 |
44 | # Build results
45 |
46 | [Dd]ebug/
47 | [Rr]elease/
48 | x64/
49 | build/
50 | [Bb]in/
51 | [Oo]bj/
52 |
53 | # MSTest test Results
54 | [Tt]est[Rr]esult*/
55 | [Bb]uild[Ll]og.*
56 |
57 | *_i.c
58 | *_p.c
59 | *.ilk
60 | *.meta
61 | *.obj
62 | *.pdb
63 | *.pgc
64 | *.pgd
65 | *.rsp
66 | *.sbr
67 | *.tlb
68 | *.tli
69 | *.tlh
70 | *.tmp
71 | *.tmp_proj
72 | *.log
73 | *.vspscc
74 | *.vssscc
75 | .builds
76 | *.pidb
77 | *.log
78 | *.scc
79 |
80 | # Visual C++ cache files
81 | ipch/
82 | *.aps
83 | *.ncb
84 | *.opensdf
85 | *.sdf
86 | *.cachefile
87 |
88 | # Visual Studio profiler
89 | *.psess
90 | *.vsp
91 | *.vspx
92 |
93 | # Guidance Automation Toolkit
94 | *.gpState
95 |
96 | # ReSharper is a .NET coding add-in
97 | _ReSharper*/
98 | *.[Rr]e[Ss]harper
99 |
100 | # TeamCity is a build add-in
101 | _TeamCity*
102 |
103 | # DotCover is a Code Coverage Tool
104 | *.dotCover
105 |
106 | # NCrunch
107 | *.ncrunch*
108 | .*crunch*.local.xml
109 |
110 | # Installshield output folder
111 | [Ee]xpress/
112 |
113 | # DocProject is a documentation generator add-in
114 | DocProject/buildhelp/
115 | DocProject/Help/*.HxT
116 | DocProject/Help/*.HxC
117 | DocProject/Help/*.hhc
118 | DocProject/Help/*.hhk
119 | DocProject/Help/*.hhp
120 | DocProject/Help/Html2
121 | DocProject/Help/html
122 |
123 | # Click-Once directory
124 | publish/
125 |
126 | # Publish Web Output
127 | *.Publish.xml
128 | *.pubxml
129 |
130 | # NuGet Packages Directory
131 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
132 | #packages/
133 |
134 | # Windows Azure Build Output
135 | csx
136 | *.build.csdef
137 |
138 | # Windows Store app package directory
139 | AppPackages/
140 |
141 | # Others
142 | sql/
143 | *.Cache
144 | ClientBin/
145 | [Ss]tyle[Cc]op.*
146 | ~$*
147 | *~
148 | *.dbmdl
149 | *.[Pp]ublish.xml
150 | *.pfx
151 | *.publishsettings
152 |
153 | # RIA/Silverlight projects
154 | Generated_Code/
155 |
156 | # Backup & report files from converting an old project file to a newer
157 | # Visual Studio version. Backup files are not needed, because we have git ;-)
158 | _UpgradeReport_Files/
159 | Backup*/
160 | UpgradeLog*.XML
161 | UpgradeLog*.htm
162 |
163 | # SQL Server files
164 | App_Data/*.mdf
165 | App_Data/*.ldf
166 |
167 | #############
168 | ## Windows detritus
169 | #############
170 |
171 | # Windows image file caches
172 | Thumbs.db
173 | ehthumbs.db
174 |
175 | # Folder config file
176 | Desktop.ini
177 |
178 | # Recycle Bin used on file shares
179 | $RECYCLE.BIN/
180 |
181 | # Mac crap
182 | .DS_Store
183 |
184 |
185 | #############
186 | ## Python
187 | #############
188 |
189 | *.py[co]
190 |
191 | # Packages
192 | *.egg
193 | *.egg-info
194 | dist/
195 | build/
196 | eggs/
197 | parts/
198 | var/
199 | sdist/
200 | develop-eggs/
201 | .installed.cfg
202 |
203 | # Installer logs
204 | pip-log.txt
205 |
206 | # Unit test / coverage reports
207 | .coverage
208 | .tox
209 |
210 | #Translations
211 | *.mo
212 |
213 | #Mr Developer
214 | .mr.developer.cfg
215 |
--------------------------------------------------------------------------------
/MidiTest/vc2019/MidiTest.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
6 |
7 |
8 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
9 | h;hpp;hxx;hm;inl;inc;xsd
10 |
11 |
12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav
14 |
15 |
16 | {7273A8BD-DA36-43A8-8608-AFC789FF6338}
17 |
18 |
19 | {701C3BE5-E2E9-4E39-9F1C-550F3418C196}
20 |
21 |
22 | {A5100493-AB40-4D57-8A71-71131A410694}
23 |
24 |
25 | {706D0B24-4763-462C-B697-3CC1381D052A}
26 |
27 |
28 | {548161F7-A3A9-4163-8BA7-9DB6AD932393}
29 |
30 |
31 |
32 |
33 | Source Files
34 |
35 |
36 | Header Files
37 |
38 |
39 | Source Files
40 |
41 |
42 | Blocks\Midi2\include
43 |
44 |
45 | Blocks\Midi2\include
46 |
47 |
48 | Blocks\Midi2\include
49 |
50 |
51 | Blocks\Midi2\include
52 |
53 |
54 | Blocks\Midi2\include
55 |
56 |
57 | Blocks\Midi2\include
58 |
59 |
60 | Blocks\Midi2\include
61 |
62 |
63 | Blocks\Midi2\lib
64 |
65 |
66 | Blocks\Midi2\src
67 |
68 |
69 | Blocks\Midi2\src
70 |
71 |
72 | Blocks\Midi2\src
73 |
74 |
75 | Blocks\Midi2\src
76 |
77 |
78 | Blocks\Midi2\lib
79 |
80 |
81 |
82 |
83 | Header Files
84 |
85 |
86 |
87 |
88 | Resource Files
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/MidiTest/vc2013/sample.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav
15 |
16 |
17 | {6060FB75-28A0-4A07-A3BA-DDFC25931732}
18 |
19 |
20 | {890757FF-67CC-4CC1-B41F-56E0D4FACC0E}
21 |
22 |
23 | {ADC41AF3-A694-4173-A91E-B2BC1300AB53}
24 |
25 |
26 | {D0C23C05-3D4D-466B-8C39-C18293E4596E}
27 |
28 |
29 | {F014DD4A-41BB-462E-BD4D-BAA4A482B1B5}
30 |
31 |
32 |
33 |
34 | Source Files
35 |
36 |
37 | Source Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Blocks\Midi2\include
44 |
45 |
46 | Blocks\Midi2\include
47 |
48 |
49 | Blocks\Midi2\include
50 |
51 |
52 | Blocks\Midi2\include
53 |
54 |
55 | Blocks\Midi2\include
56 |
57 |
58 | Blocks\Midi2\include
59 |
60 |
61 | Blocks\Midi2\include
62 |
63 |
64 | Blocks\Midi2\lib
65 |
66 |
67 | Blocks\Midi2\src
68 |
69 |
70 | Blocks\Midi2\src
71 |
72 |
73 | Blocks\Midi2\src
74 |
75 |
76 | Blocks\Midi2\src
77 |
78 |
79 | Blocks\Midi2\lib
80 |
81 |
82 |
83 |
84 | Header Files
85 |
86 |
87 |
88 |
89 | Resource Files
90 |
91 |
92 |
--------------------------------------------------------------------------------
/MidiTest/vc2017/sample.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav
15 |
16 |
17 | {6060FB75-28A0-4A07-A3BA-DDFC25931732}
18 |
19 |
20 | {890757FF-67CC-4CC1-B41F-56E0D4FACC0E}
21 |
22 |
23 | {ADC41AF3-A694-4173-A91E-B2BC1300AB53}
24 |
25 |
26 | {D0C23C05-3D4D-466B-8C39-C18293E4596E}
27 |
28 |
29 | {F014DD4A-41BB-462E-BD4D-BAA4A482B1B5}
30 |
31 |
32 |
33 |
34 | Source Files
35 |
36 |
37 | Source Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Blocks\Midi2\include
44 |
45 |
46 | Blocks\Midi2\include
47 |
48 |
49 | Blocks\Midi2\include
50 |
51 |
52 | Blocks\Midi2\include
53 |
54 |
55 | Blocks\Midi2\include
56 |
57 |
58 | Blocks\Midi2\include
59 |
60 |
61 | Blocks\Midi2\include
62 |
63 |
64 | Blocks\Midi2\lib
65 |
66 |
67 | Blocks\Midi2\src
68 |
69 |
70 | Blocks\Midi2\src
71 |
72 |
73 | Blocks\Midi2\src
74 |
75 |
76 | Blocks\Midi2\src
77 |
78 |
79 | Blocks\Midi2\lib
80 |
81 |
82 |
83 |
84 | Header Files
85 |
86 |
87 |
88 |
89 | Resource Files
90 |
91 |
92 |
--------------------------------------------------------------------------------
/src/MidiIn.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * MidiIn.cpp
3 | * glitches
4 | *
5 | * Created by hec on 5/20/10.
6 | * Copyright 2010 aer studio. All rights reserved.
7 | *
8 | */
9 |
10 | #include "MidiIn.h"
11 |
12 | namespace cinder { namespace midi {
13 |
14 | void MidiInCallback(double deltatime, std::vector *message, void *userData){
15 | ((Input*)userData)->processMessage(deltatime, message);
16 | }
17 |
18 |
19 | Input::Input(){
20 | mMidiIn = new RtMidiIn();
21 | mNumPorts = mMidiIn->getPortCount();
22 | mMidiIn->getCurrentApi();
23 | }
24 |
25 | Input::~Input(){
26 | closePort();
27 | }
28 |
29 | void Input::listPorts(){
30 | std::cout << "MidiIn: " << mNumPorts << " available." << std::endl;
31 | for (size_t i = 0; i < mNumPorts; ++i){
32 | std::cout << i << ": " << mMidiIn->getPortName(i).c_str() << std::endl;
33 | std::string name( mMidiIn->getPortName( i ).c_str() ); // strip null chars introduced by rtmidi
34 | mPortNames.push_back( name );
35 | }
36 | }
37 |
38 | void Input::ignoreTypes(bool sysex, bool time, bool midisense){
39 | mMidiIn->ignoreTypes(sysex, time, midisense);
40 |
41 | }
42 |
43 | std::string Input::getPortName(int number){
44 |
45 | return mPortNames.at(number);
46 | }
47 |
48 | void Input::openPort(unsigned int port){
49 | if (mNumPorts == 0){
50 | throw MidiExcNoPortsAvailable();
51 | }
52 |
53 | if (port + 1 > mNumPorts){
54 | throw MidiExcPortNotAvailable();
55 | }
56 |
57 | mPort = port;
58 | mName = mMidiIn->getPortName(port);
59 |
60 | mMidiIn->openPort(mPort);
61 |
62 | mMidiIn->setCallback(&MidiInCallback, this);
63 |
64 | mMidiIn->ignoreTypes(false, false, false);
65 | }
66 |
67 | void Input::closePort(){
68 | mMidiIn->closePort();
69 | mMidiIn->cancelCallback();
70 | }
71 |
72 | void Input::processMessage(double deltatime, std::vector *message){
73 | unsigned int numBytes = message->size();
74 |
75 | // solution for proper reading anything above MIDI_TIME_CODE goes to miguelvb
76 | // http://forum.openframeworks.cc/t/incorrect-handling-of-midiin-messages-in-ofxmidi-solved/8719
77 |
78 |
79 | Message msg;
80 | msg.port = mPort;
81 | if((message->at(0)) >= MIDI_SYSEX) {
82 | msg.status = (MidiStatus)(message->at(0) & 0xFF);
83 | msg.channel = 0;
84 | } else {
85 | msg.status = (MidiStatus) (message->at(0) & 0xF0);
86 | msg.channel = (int) (message->at(0) & 0x0F)+1;
87 | }
88 |
89 |
90 | msg.port = mPort;
91 |
92 | switch(msg.status) {
93 | case MIDI_NOTE_ON :
94 | case MIDI_NOTE_OFF:
95 | msg.pitch = (int) message->at(1);
96 | msg.velocity = (int) message->at(2);
97 | break;
98 | case MIDI_CONTROL_CHANGE:
99 | msg.control = (int) message->at(1);
100 | msg.value = (int) message->at(2);
101 | break;
102 | case MIDI_PROGRAM_CHANGE:
103 | case MIDI_AFTERTOUCH:
104 | msg.value = (int) message->at(1);
105 | break;
106 | case MIDI_PITCH_BEND:
107 | msg.value = (int) (message->at(2) << 7) +
108 | (int) message->at(1); // msb + lsb
109 | break;
110 | case MIDI_POLY_AFTERTOUCH:
111 | msg.pitch = (int) message->at(1);
112 | msg.value = (int) message->at(2);
113 | break;
114 | default:
115 | break;
116 | }
117 |
118 | midiThreadSignal.emit( msg );
119 |
120 | if (mDispatchToMainThread)
121 | ci::app::App::get()->dispatchAsync( [this, msg](){ midiSignal.emit( msg ); });
122 | }
123 |
124 | // bool Input::hasWaitingMessages(){
125 | // int queue_length = (int)mMessages.size();
126 | // return queue_length > 0;
127 | // }
128 |
129 | // bool Input::getNextMessage(Message* message){
130 | // if (mMessages.size() == 0){
131 | // return false;
132 | // }
133 |
134 | // Message* src_message = mMessages.front();
135 | // message->copy(*src_message);
136 | // delete src_message;
137 | // mMessages.pop_front();
138 |
139 | // return true;
140 | // }
141 |
142 | unsigned int Input::getPort()const{
143 | return mPort;
144 |
145 | }
146 |
147 |
148 | } // namespace midi
149 | } // namespace cinder
150 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Cinder-MIDI2
2 | ============
3 |
4 | Alternative approach to interfacing RtMidi lib in Cinder
5 | Using
6 | ============
7 |
8 | 1. Create void function in your app, that will be reacting to incoming midi-messages:
9 |
10 | ```cpp
11 |
12 | void MidiTestApp::midiListener(midi::Message msg){
13 | switch (msg.status)
14 | {
15 | case MIDI_NOTE_ON:
16 | notes[msg.pitch] = msg.velocity;
17 | status = "Pitch: " + toString(msg.pitch) + "\n" +
18 | "Velocity: " + toString(msg.velocity);
19 | break;
20 | case MIDI_NOTE_OFF:
21 | break;
22 | case MIDI_CONTROL_CHANGE:
23 | cc[msg.control] = msg.value;
24 | status = "Control: " + toString(msg.control) + "\n" +
25 | "Value: " + toString(msg.value);
26 | break;
27 | default:
28 | break;
29 | }
30 | ```
31 |
32 | 2. connect signal from MidiInput instance to your function like so:
33 |
34 | ```mInput.midiSignal.connect( [this](midi::Message msg){ MidiTestApp::midiListener( msg ); }); ```
35 |
36 | this will push the incoming midi messages safely over onto the main thread for consumption. You can however also get a signal directly from the midi thread if you need like so:
37 |
38 | ```mInput.midiThreadSignal.connect( [this](midi::Message msg){ MidiTestApp::midiListener( msg ); }); ```
39 |
40 | 3. if you are using Windows, you need to add ```winmm.lib``` to your linker
41 |
42 | 4. add __WINDOWS_MM__ to preprocessor
43 | or add in Cinder/blocks/__AppTemplates/__Foundation\vc2019\foundation.vcxproj
44 |
45 | ============
46 |
47 |
48 | ###Positive changes>
49 | **Using signals:** Possibly THE biggest change, is that now not only block runs stable and fast, but there's no need for processing midi inside update() function. I used boost::signals2 for sending signals with processed midi messages out of instance of MidiInput class. So after initialization, you just connect signal to some void function in your app which is used as listener and does automatically all you need your midi-messages to do.
50 |
51 | **Processing midi-messages** is straight copy of ofxMidi format, because I was familiar with it, and I thought it might be familiar to all people moving to Cinder from OF, not to mention it's internal structure is clear, and well designed. I also think this might goes to some sort of credits to Dan Wilcox & Theo Watson (original authors of ofxMidi) in form of comment in header file.
52 |
53 | **RtMidi 2.0.1** - made upgrade to newer version of base library, as old version of MidiBlock is still using using 1.0.something. I have not found any particularly noticeable changes in interfacing, but changelog of RtMidi is quite long so there's got to be something worth upgrading :)
54 |
55 | ###Negative stuff>
56 |
57 | **Callback to RtMidiInput:** this is a problem that I tried to solve while I was working on midi-sequencer. I needed to switch virtual midi channels a lot during development, and RtMidi was still complaining, that callback is already set. That is because callback is set inside openPort() function, but I think it would be (somehow) possible to set callback once per initialization and just let midi-messages fly through it once desired port is opened. I remember I tried to do it this way and than I rolled back to current version for some reason.
58 |
59 |
60 |
61 | **iOS version:** OF guys are using some other lib for iOS (coremidi???) for processing midi, because RtMidi does not support it.
62 |
63 | **Missing "openPort(string nameOfThePort)" function:** this is just something I was using before by some terrible workaround but it was on my to do list. Now I found some way how to do this using C++ 11 (namely std::string.find), so in theory, it should work even when you specify just fragment of port name (like "BCR" instead of "BCR2000 MIDI INPUT").
64 |
65 |
66 | Thanks to [Thomas Sanchez Lengeling](https://github.com/ThomasLengeling) for providing testing and changes to make block work on OSX!
67 |
68 | ###TODO:
69 |
70 | **Auto-Reconnect:** just some little safety function, which tries to reconnect device after it finds that it was disconnected, so you do not have to restart whole application. I had some issues with this kind of situation with using Ableton couple of years back, so this is just for convenience. It should be disabled by default tho.
71 |
--------------------------------------------------------------------------------
/samples/Midi2Osc/vc2015/Midi2Osc.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
6 |
7 |
8 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
9 | h;hpp;hxx;hm;inl;inc;xsd
10 |
11 |
12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav
14 |
15 |
16 | {EC0A3E56-D08F-455F-9376-753976D96DD1}
17 |
18 |
19 | {8CED6771-3116-46C9-91D9-29ED40C168CE}
20 |
21 |
22 | {EA88FF48-907D-442C-9E0A-55219F4C1F10}
23 |
24 |
25 | {5FA9EE88-95CE-45DC-9541-C65C60F3C9EF}
26 |
27 |
28 | {71EF27CC-89FC-4126-9482-6A5E202E32AD}
29 |
30 |
31 | {58CA7091-D5BB-4B89-AEC1-68A0D261D655}
32 |
33 |
34 | {72A69D24-A03F-4617-BEF0-2C2713B37758}
35 |
36 |
37 | {12D1CC09-73FE-4910-85A7-DABB71E824C0}
38 |
39 |
40 | {9778FD74-9AD2-48B9-83AC-36DD28B37B92}
41 |
42 |
43 |
44 |
45 | Source Files
46 |
47 |
48 | Header Files
49 |
50 |
51 | Source Files
52 |
53 |
54 | Blocks\Midi2\include
55 |
56 |
57 | Blocks\Midi2\include
58 |
59 |
60 | Blocks\Midi2\include
61 |
62 |
63 | Blocks\Midi2\include
64 |
65 |
66 | Blocks\Midi2\include
67 |
68 |
69 | Blocks\Midi2\include
70 |
71 |
72 | Blocks\Midi2\include
73 |
74 |
75 | Blocks\Midi2\lib
76 |
77 |
78 | Blocks\Midi2\src
79 |
80 |
81 | Blocks\Midi2\src
82 |
83 |
84 | Blocks\Midi2\src
85 |
86 |
87 | Blocks\Midi2\src
88 |
89 |
90 | Blocks\Midi2\lib
91 |
92 |
93 | Blocks\OSC\src\cinder\osc
94 |
95 |
96 | Blocks\OSC\src\cinder\osc
97 |
98 |
99 |
100 |
101 | Header Files
102 |
103 |
104 |
105 |
106 | Resource Files
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/samples/Midi2Osc/vc2017/Midi2Osc.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
6 |
7 |
8 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
9 | h;hpp;hxx;hm;inl;inc;xsd
10 |
11 |
12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav
14 |
15 |
16 | {EC0A3E56-D08F-455F-9376-753976D96DD1}
17 |
18 |
19 | {8CED6771-3116-46C9-91D9-29ED40C168CE}
20 |
21 |
22 | {EA88FF48-907D-442C-9E0A-55219F4C1F10}
23 |
24 |
25 | {5FA9EE88-95CE-45DC-9541-C65C60F3C9EF}
26 |
27 |
28 | {71EF27CC-89FC-4126-9482-6A5E202E32AD}
29 |
30 |
31 | {58CA7091-D5BB-4B89-AEC1-68A0D261D655}
32 |
33 |
34 | {72A69D24-A03F-4617-BEF0-2C2713B37758}
35 |
36 |
37 | {12D1CC09-73FE-4910-85A7-DABB71E824C0}
38 |
39 |
40 | {9778FD74-9AD2-48B9-83AC-36DD28B37B92}
41 |
42 |
43 |
44 |
45 | Source Files
46 |
47 |
48 | Header Files
49 |
50 |
51 | Source Files
52 |
53 |
54 | Blocks\Midi2\include
55 |
56 |
57 | Blocks\Midi2\include
58 |
59 |
60 | Blocks\Midi2\include
61 |
62 |
63 | Blocks\Midi2\include
64 |
65 |
66 | Blocks\Midi2\include
67 |
68 |
69 | Blocks\Midi2\include
70 |
71 |
72 | Blocks\Midi2\include
73 |
74 |
75 | Blocks\Midi2\lib
76 |
77 |
78 | Blocks\Midi2\src
79 |
80 |
81 | Blocks\Midi2\src
82 |
83 |
84 | Blocks\Midi2\src
85 |
86 |
87 | Blocks\Midi2\src
88 |
89 |
90 | Blocks\Midi2\lib
91 |
92 |
93 | Blocks\OSC\src\cinder\osc
94 |
95 |
96 | Blocks\OSC\src\cinder\osc
97 |
98 |
99 |
100 |
101 | Header Files
102 |
103 |
104 |
105 |
106 | Resource Files
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/samples/Midi2Osc/vc2019/Midi2Osc.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
6 |
7 |
8 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
9 | h;hpp;hxx;hm;inl;inc;xsd
10 |
11 |
12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav
14 |
15 |
16 | {EC0A3E56-D08F-455F-9376-753976D96DD1}
17 |
18 |
19 | {8CED6771-3116-46C9-91D9-29ED40C168CE}
20 |
21 |
22 | {EA88FF48-907D-442C-9E0A-55219F4C1F10}
23 |
24 |
25 | {5FA9EE88-95CE-45DC-9541-C65C60F3C9EF}
26 |
27 |
28 | {71EF27CC-89FC-4126-9482-6A5E202E32AD}
29 |
30 |
31 | {58CA7091-D5BB-4B89-AEC1-68A0D261D655}
32 |
33 |
34 | {72A69D24-A03F-4617-BEF0-2C2713B37758}
35 |
36 |
37 | {12D1CC09-73FE-4910-85A7-DABB71E824C0}
38 |
39 |
40 | {9778FD74-9AD2-48B9-83AC-36DD28B37B92}
41 |
42 |
43 |
44 |
45 | Source Files
46 |
47 |
48 | Header Files
49 |
50 |
51 | Source Files
52 |
53 |
54 | Blocks\Midi2\include
55 |
56 |
57 | Blocks\Midi2\include
58 |
59 |
60 | Blocks\Midi2\include
61 |
62 |
63 | Blocks\Midi2\include
64 |
65 |
66 | Blocks\Midi2\include
67 |
68 |
69 | Blocks\Midi2\include
70 |
71 |
72 | Blocks\Midi2\include
73 |
74 |
75 | Blocks\Midi2\lib
76 |
77 |
78 | Blocks\Midi2\src
79 |
80 |
81 | Blocks\Midi2\src
82 |
83 |
84 | Blocks\Midi2\src
85 |
86 |
87 | Blocks\Midi2\src
88 |
89 |
90 | Blocks\Midi2\lib
91 |
92 |
93 | Blocks\OSC\src\cinder\osc
94 |
95 |
96 | Blocks\OSC\src\cinder\osc
97 |
98 |
99 |
100 |
101 | Header Files
102 |
103 |
104 |
105 |
106 | Resource Files
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/src/MidiHub.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2010, Hector Sanchez-Pajares
3 | Aer Studio http://www.aerstudio.com
4 | All rights reserved.
5 |
6 |
7 | This is a block for MIDI Integration for Cinder framework developed by The Barbarian Group, 2010
8 |
9 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that
10 | the following conditions are met:
11 |
12 | * Redistributions of source code must retain the above copyright notice, this list of conditions and
13 | the following disclaimer.
14 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
15 | the following disclaimer in the documentation and/or other materials provided with the distribution.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
18 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 | POSSIBILITY OF SUCH DAMAGE.
25 | */
26 |
27 | /*
28 | * midi::Hub.cpp
29 | * By Roger Sodre
30 | *
31 | * Connects to ALL present MIDI devices
32 | */
33 |
34 | #include "MidiHub.h"
35 |
36 | namespace cinder { namespace midi {
37 |
38 | // --------------------------------------------------------------------------------------
39 | Hub::Hub() {
40 | this->connectAll();
41 | }
42 |
43 | // --------------------------------------------------------------------------------------
44 | Hub::~Hub() {
45 | this->disconnectAll();
46 | }
47 |
48 | // --------------------------------------------------------------------------------------
49 | void Hub::disconnectAll() {
50 | for (size_t i = 0 ; i < midiInPool.size() ; i++ )
51 | delete midiInPool[i];
52 | midiInPool.clear();
53 | /*
54 | for (int i = 0 ; i < midiOutPool.size() ; i++)
55 | delete midiOutPool[i];
56 | midiOutPool.clear();
57 | */
58 | }
59 |
60 | // --------------------------------------------------------------------------------------
61 | void Hub::connectAll() {
62 |
63 | for ( uint8_t i = 0 ; i < midii.getPortCount() ; i++ )
64 | {
65 | if (this->isDeviceConnected(midii.getPortName(i)))
66 | continue;
67 |
68 | printf("MIDI HUB: connecting to %i: %s\n",i,midii.getPortName(i).c_str());
69 |
70 | // Connect IN
71 | midi::Input *in = new midi::Input();
72 | in->openPort(i);
73 | midiInPool.push_back(in);
74 |
75 | // Connect OUT
76 | /*
77 | midi::Output *out = new midi::Output();
78 | out->openPort(i);
79 | out->setVerbose(false);
80 | midiOutPool.push_back(out);
81 | */
82 | }
83 | }
84 |
85 | // --------------------------------------------------------------------------------------
86 | void Hub::update()
87 | {
88 | /* /// check only once per second
89 | static int sec = 0;
90 | if ( sec == (int) timeInSecs )
91 | return;
92 | sec = (int) timeInSecs;*/
93 |
94 | // new devices?
95 | //printf("MIDI CHECK...\n");
96 | if ( midiInPool.size() != midii.getPortCount() )
97 | this->connectAll();
98 | }
99 |
100 | // --------------------------------------------------------------------------------------
101 | bool Hub::isDeviceConnected(std::string _name) {
102 | for (int i = 0 ; i < midiInPool.size() ; i++)
103 | if (midiInPool[i]->getName() == _name)
104 | return true;
105 | /*
106 | for (int i = 0 ; i < midiOutPool.size() ; i++)
107 | if (midiOutPool[i]->getName() == _name)
108 | return true;
109 | */
110 | return false;
111 | }
112 |
113 | // --------------------------------------------------------------------------------------
114 | //bool Hub::hasWaitingMessages() {
115 | // this->update();
116 | // for ( int n = 0 ; n < midiInPool.size() ; n++ )
117 | // if ( midiInPool[n]->hasWaitingMessages() )
118 | // return true;
119 | // // No messages!
120 | // return false;
121 | //}
122 | //
123 | //// --------------------------------------------------------------------------------------
124 | //bool Hub::getNextMessage( Message* msg ) {
125 | // this->update();
126 | // for ( int n = 0 ; n < midiInPool.size() ; n++ )
127 | // if ( midiInPool[n]->getNextMessage( msg ) )
128 | // return true;
129 | // // No messages!
130 | // return false;
131 | //}
132 |
133 |
134 | } // namespace midi
135 | } // namespace cinder
136 |
--------------------------------------------------------------------------------
/samples/Midi2Websocket/src/Midi2WebsocketApp.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2020, Bruce Lane - Martin Blasko All rights reserved.
3 | This code is intended for use with the Cinder C++ library: http://libcinder.org
4 |
5 | This file is part of Cinder-MIDI.
6 |
7 | Cinder-MIDI is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation, either version 3 of the License, or
10 | (at your option) any later version.
11 |
12 | Cinder-MIDI is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License
18 | along with Cinder-MIDI. If not, see .
19 | */
20 |
21 | // don't forget to add winmm.lib to the linker
22 |
23 | #include "cinder/app/App.h"
24 | #include "cinder/app/RendererGl.h"
25 | #include "cinder/gl/gl.h"
26 | #include "cinder/Utilities.h"
27 | #include
28 | #include "MidiIn.h"
29 | #include "MidiMessage.h"
30 | #include "MidiConstants.h"
31 | // WebSockets
32 | #include "WebSocketClient.h"
33 |
34 | using namespace ci;
35 | using namespace ci::app;
36 | using namespace std;
37 | using namespace asio;
38 |
39 | #define SLIDER_NOTE 1
40 |
41 |
42 | class Midi2WebsocketApp : public App {
43 | public:
44 | void setup() override;
45 | void update() override;
46 | void draw() override;
47 | void cleanup() override;
48 | void midiListener(midi::Message msg);
49 |
50 | midi::Input mMidiIn;
51 |
52 | float sliderValue = 0.0f;
53 | string status = "";
54 | int notes[128];
55 | int cc[128];
56 | private:
57 | // Websocket client
58 | bool clientConnected = false;
59 | void wsWrite(std::string msg);
60 | void wsConnect();
61 | void wsClientConnect();
62 | void parseMessage(string msg);
63 | void disconnect();
64 | WebSocketClient mClient;
65 | };
66 | void Midi2WebsocketApp::cleanup() {
67 | disconnect();
68 | }
69 | void Midi2WebsocketApp::setup() {
70 |
71 | wsConnect();
72 | if (mMidiIn.getNumPorts() > 0) {
73 | mMidiIn.listPorts();
74 | mMidiIn.openPort(0);
75 | console() << "Opening MIDI port 0" << std::endl;
76 | mMidiIn.midiSignal.connect(std::bind(&Midi2WebsocketApp::midiListener, this, std::placeholders::_1));
77 | }
78 | else {
79 | console() << "No MIDI Ports found!!!!" << std::endl;
80 | }
81 | }
82 | void Midi2WebsocketApp::wsConnect() {
83 | mClient.connectOpenEventHandler([&]() {
84 | clientConnected = true;
85 | status += "\nConnected";
86 | });
87 | mClient.connectCloseEventHandler([&]() {
88 | clientConnected = false;
89 | status += "\nDisconnected";
90 | });
91 | mClient.connectFailEventHandler([&](string err) {
92 | status += "\nWS Error";
93 | if (!err.empty()) {
94 | status += ": " + err;
95 | }
96 | });
97 | mClient.connectInterruptEventHandler([&]() {
98 | status += "\nWS Interrupted";
99 | });
100 | mClient.connectPingEventHandler([&](string msg) {
101 | status += "\nWS Ponged";
102 | if (!msg.empty())
103 | {
104 | status += ": " + msg;
105 | }
106 | });
107 | mClient.connectMessageEventHandler([&](string msg) {
108 | parseMessage(msg);
109 | });
110 | wsClientConnect();
111 |
112 | }
113 | void Midi2WebsocketApp::wsClientConnect()
114 | {
115 | mClient.connect("ws://localhost:8088");
116 | }
117 | void Midi2WebsocketApp::wsWrite(string msg)
118 | {
119 | if (clientConnected) {
120 | mClient.write(msg);
121 | }
122 |
123 | }
124 | void Midi2WebsocketApp::disconnect()
125 | {
126 | if (clientConnected) {
127 | mClient.disconnect();
128 | }
129 | }
130 | void Midi2WebsocketApp::parseMessage(string msg) {
131 | status += "\nWS onRead";
132 | if (!msg.empty()) {
133 | status += ": " + msg;
134 | }
135 | }
136 | void Midi2WebsocketApp::midiListener(midi::Message msg) {
137 | stringstream sParams;
138 | string strParams = "";
139 | switch (msg.status)
140 | {
141 | case MIDI_NOTE_ON:
142 | notes[msg.pitch] = msg.velocity;
143 | status = "Pitch: " + toString(msg.pitch) + "\n" + "Velocity: " + toString(msg.velocity);
144 | sliderValue = msg.pitch / 127.0f;
145 | break;
146 | case MIDI_NOTE_OFF:
147 | break;
148 | case MIDI_CONTROL_CHANGE:
149 | cc[msg.control] = msg.value;
150 | sliderValue = msg.value / 127.0f;
151 | status = "Control: " + toString(msg.control) + "\n" +
152 | "Value: " + toString(msg.value);
153 | // TODO check boolean value:
154 | sParams << "{\"params\" :[{\"name\" : " << msg.control << ",\"value\" : " << sliderValue << "}]}";
155 | strParams = sParams.str();
156 | wsWrite(strParams);
157 | break;
158 | default:
159 | break;
160 | }
161 |
162 | }
163 | void Midi2WebsocketApp::update() {
164 | mClient.poll();
165 | }
166 |
167 | void Midi2WebsocketApp::draw() {
168 | gl::clear(Color(0, 0, 0), true);
169 | gl::color(Color(1, 1, 1));
170 | gl::drawSolidRect(Rectf(vec2(0, 0), vec2(sliderValue * getWindowWidth(), getWindowHeight())));
171 | }
172 |
173 | CINDER_APP(Midi2WebsocketApp, RendererGl)
174 |
--------------------------------------------------------------------------------
/samples/Midi2Websocket/vc2015/Midi2Websocket.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
6 |
7 |
8 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
9 | h;hpp;hxx;hm;inl;inc;xsd
10 |
11 |
12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav
14 |
15 |
16 | {9DE5FB56-4940-43CE-BEE1-7C1A49669869}
17 |
18 |
19 | {1EEF923D-F251-4074-A474-80EB77A0D74B}
20 |
21 |
22 | {9C7956F9-FF82-4404-8229-036AAD220BE7}
23 |
24 |
25 | {ECD07580-831A-4B5F-94E5-9C1865359278}
26 |
27 |
28 | {6CAD96E7-37AC-4D51-915A-F2C25D41C04A}
29 |
30 |
31 | {556907FE-3905-4EAC-BCE6-539CD807D027}
32 |
33 |
34 | {622D5E76-FCF7-4F85-837D-C83D4B9B7CF2}
35 |
36 |
37 |
38 |
39 | Source Files
40 |
41 |
42 | Header Files
43 |
44 |
45 | Source Files
46 |
47 |
48 | Blocks\Midi2\include
49 |
50 |
51 | Blocks\Midi2\include
52 |
53 |
54 | Blocks\Midi2\include
55 |
56 |
57 | Blocks\Midi2\include
58 |
59 |
60 | Blocks\Midi2\include
61 |
62 |
63 | Blocks\Midi2\include
64 |
65 |
66 | Blocks\Midi2\include
67 |
68 |
69 | Blocks\Midi2\lib
70 |
71 |
72 | Blocks\Midi2\src
73 |
74 |
75 | Blocks\Midi2\src
76 |
77 |
78 | Blocks\Midi2\src
79 |
80 |
81 | Blocks\Midi2\src
82 |
83 |
84 | Blocks\Midi2\lib
85 |
86 |
87 | Blocks\Cinder-WebSocketPP\src
88 |
89 |
90 | Blocks\Cinder-WebSocketPP\src
91 |
92 |
93 | Blocks\Cinder-WebSocketPP\src
94 |
95 |
96 | Blocks\Cinder-WebSocketPP\src
97 |
98 |
99 | Blocks\Cinder-WebSocketPP\src
100 |
101 |
102 | Blocks\Cinder-WebSocketPP\src
103 |
104 |
105 |
106 |
107 | Header Files
108 |
109 |
110 |
111 |
112 | Resource Files
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/samples/Midi2Websocket/vc2017/Midi2Websocket.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
6 |
7 |
8 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
9 | h;hpp;hxx;hm;inl;inc;xsd
10 |
11 |
12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav
14 |
15 |
16 | {9DE5FB56-4940-43CE-BEE1-7C1A49669869}
17 |
18 |
19 | {1EEF923D-F251-4074-A474-80EB77A0D74B}
20 |
21 |
22 | {9C7956F9-FF82-4404-8229-036AAD220BE7}
23 |
24 |
25 | {ECD07580-831A-4B5F-94E5-9C1865359278}
26 |
27 |
28 | {6CAD96E7-37AC-4D51-915A-F2C25D41C04A}
29 |
30 |
31 | {556907FE-3905-4EAC-BCE6-539CD807D027}
32 |
33 |
34 | {622D5E76-FCF7-4F85-837D-C83D4B9B7CF2}
35 |
36 |
37 |
38 |
39 | Source Files
40 |
41 |
42 | Header Files
43 |
44 |
45 | Source Files
46 |
47 |
48 | Blocks\Midi2\include
49 |
50 |
51 | Blocks\Midi2\include
52 |
53 |
54 | Blocks\Midi2\include
55 |
56 |
57 | Blocks\Midi2\include
58 |
59 |
60 | Blocks\Midi2\include
61 |
62 |
63 | Blocks\Midi2\include
64 |
65 |
66 | Blocks\Midi2\include
67 |
68 |
69 | Blocks\Midi2\lib
70 |
71 |
72 | Blocks\Midi2\src
73 |
74 |
75 | Blocks\Midi2\src
76 |
77 |
78 | Blocks\Midi2\src
79 |
80 |
81 | Blocks\Midi2\src
82 |
83 |
84 | Blocks\Midi2\lib
85 |
86 |
87 | Blocks\Cinder-WebSocketPP\src
88 |
89 |
90 | Blocks\Cinder-WebSocketPP\src
91 |
92 |
93 | Blocks\Cinder-WebSocketPP\src
94 |
95 |
96 | Blocks\Cinder-WebSocketPP\src
97 |
98 |
99 | Blocks\Cinder-WebSocketPP\src
100 |
101 |
102 | Blocks\Cinder-WebSocketPP\src
103 |
104 |
105 |
106 |
107 | Header Files
108 |
109 |
110 |
111 |
112 | Resource Files
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/include/MidiOut.h:
--------------------------------------------------------------------------------
1 | /*
2 | MidiBlock for Cinder developed by Bruce Lane, Martin Blasko.
3 | Original code by Hector Sanchez-Pajares(http://www.aerstudio.com).
4 | MidiOut written by Tim Murray-Browne (http://timmb.com)
5 | Midi parsing taken from openFrameworks addon ofxMidi by Theo Watson & Dan Wilcox
6 |
7 | This is a block for MIDI Integration for Cinder framework developed by The Barbarian Group, 2010
8 |
9 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that
10 | the following conditions are met:
11 |
12 | * Redistributions of source code must retain the above copyright notice, this list of conditions and
13 | the following disclaimer.
14 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
15 | the following disclaimer in the documentation and/or other materials provided with the distribution.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
18 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 | POSSIBILITY OF SUCH DAMAGE.
25 | */
26 |
27 | #pragma once
28 |
29 | #include "cinder/app/App.h"
30 |
31 | #include "MidiHeaders.h"
32 |
33 |
34 | namespace cinder { namespace midi {
35 | ///
36 | /// A midi output port
37 | ///
38 | /// Create multiple instances to connect to multiple ports.
39 | ///
40 | /// With thanks to the authors of ofxMidi .
41 | class MidiOut {
42 |
43 | public:
44 |
45 | /// Set the output client name (optional).
46 | MidiOut(std::string const& name="Cinder-MIDI Client");
47 | virtual ~MidiOut();
48 |
49 | /// \section Global Port Info
50 |
51 | /// Get a list of output port names.
52 | /// The vector index corresponds with the name's port number.
53 | /// Note: this order may change when new devices are added/removed
54 | /// from the system.
55 | std::vector getPortList() const;
56 |
57 | /// Get the number of output ports
58 | int getNumPorts() const;
59 |
60 | /// Get the name of an output port by it's number
61 | /// \return "" if number is invalid
62 | std::string getPortName(unsigned int portNumber) const;
63 |
64 | /// \section Connection
65 |
66 | /// Connect to an output port.
67 | /// Setting port = 0 will open the first available
68 | bool openPort(unsigned int portNumber=0);
69 |
70 | /// Create and connect to a virtual output port (MacOS and Linux ALSA only).
71 | /// allows for connections between software
72 | /// note: a connected virtual port has a portNum = -1
73 | /// note: an open virtual port ofxMidiOut object cannot see it's virtual
74 | /// own virtual port when listing ports
75 | ///
76 | bool openVirtualPort(std::string const& portName="ofxMidi Virtual Output");
77 |
78 | /// Close the port connection
79 | void closePort();
80 |
81 | /// Get the port number if connected.
82 | /// \return -1 if not connected or this is a virtual port
83 | int getPort() const;
84 |
85 | /// Get the connected output port name
86 | /// \return "" if not connected
87 | std::string getName() const;
88 | bool isOpen() const;
89 | bool isVirtual() const;
90 |
91 | /// \section Sending
92 |
93 | ///
94 | /// midi events
95 | ///
96 | /// number ranges:
97 | /// channel 1 - 16
98 | /// pitch 0 - 127
99 | /// velocity 0 - 127
100 | /// control value 0 - 127
101 | /// program value 0 - 127
102 | /// bend value 0 - 16383
103 | /// touch value 0 - 127
104 | ///
105 | /// note:
106 | /// - a noteon with vel = 0 is equivalent to a noteoff
107 | /// - send velocity = 64 if not using velocity values
108 | /// - most synths don't use the velocity value in a noteoff
109 | /// - the lsb & msb for raw pitch bend bytes are 7 bit
110 | ///
111 | /// references:
112 | /// http://www.srm.com/qtma/davidsmidispec.html
113 | ///
114 | void sendNoteOn(int channel, int pitch, int velocity=64);
115 | void sendNoteOff(int channel, int pitch, int velocity=64);
116 | void sendControlChange(int channel, int control, int value);
117 | void sendProgramChange(int channel, int value);
118 | void sendPitchBend(int channel, int value);
119 | void sendPitchBend(int channel, unsigned char lsb, unsigned char msb);
120 | void sendAftertouch(int channel, int value);
121 | void sendPolyAftertouch(int channel, int pitch, int value);
122 |
123 | /// Low level access
124 | void sendMessage(std::vector& bytes);
125 | void sendMessage(unsigned char status, unsigned char byteOne);
126 | void sendMessage(unsigned char status, unsigned char byteOne, unsigned char byteTwo);
127 |
128 | static bool sVerboseLogging;
129 | private:
130 | std::string mName;
131 | std::shared_ptr mRtMidiOut;
132 | bool mIsVirtual; ///< mIsVirtual => port is open as virtual port
133 | std::string mPortName;
134 | int mPortNumber; ///< mPortNumber == -1 => port is not open or is open as virtual port
135 | // Invariant: mIsVirtual => mPortNumber == -1
136 | /// Vector used to create midi messages. This should be kept at a length of 3
137 | /// and may be wiped at any point by any function. It is used by sendMessage( , , )
138 | std::vector mBytes;
139 | // Invariant: mBytes.size() == 3
140 | };
141 |
142 | }} // namespaces
143 |
--------------------------------------------------------------------------------
/MidiTest/vc2019/MidiTest.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x64
6 |
7 |
8 | Release
9 | x64
10 |
11 |
12 |
13 | {983EF04F-1930-4DEE-945D-A49570A18EF1}
14 | MidiTest
15 | Win32Proj
16 |
17 |
18 |
19 | Application
20 | false
21 | v142
22 | Unicode
23 | false
24 |
25 |
26 | Application
27 | true
28 | v142
29 | Unicode
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | <_ProjectFileVersion>10.0.30319.1
42 | true
43 | false
44 |
45 |
46 |
47 | Disabled
48 | ..\include;"..\..\..\..\include";..\..\include;..\..\lib;..\..\src
49 | WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)
50 | EnableFastChecks
51 | MultiThreadedDebug
52 |
53 | Level3
54 | ProgramDatabase
55 | true
56 | stdcpp17
57 |
58 |
59 | "..\..\..\..\include";..\include
60 |
61 |
62 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
63 | "..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)"
64 | true
65 | Windows
66 | false
67 |
68 | LIBCMT;LIBCPMT
69 |
70 |
71 |
72 |
73 | ..\include;"..\..\..\..\include";..\..\include;..\..\lib;..\..\src
74 | WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)
75 | MultiThreaded
76 |
77 | Level3
78 | ProgramDatabase
79 | true
80 | stdcpp17
81 |
82 |
83 | true
84 |
85 |
86 | "..\..\..\..\include";..\include
87 |
88 |
89 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
90 | "..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)"
91 | false
92 | true
93 | Windows
94 | true
95 |
96 | false
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/samples/Midi2Osc/src/Midi2OscApp.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2020, Bruce Lane - Martin Blasko All rights reserved.
3 | This code is intended for use with the Cinder C++ library: http://libcinder.org
4 |
5 | This file is part of Cinder-MIDI.
6 |
7 | Cinder-MIDI is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation, either version 3 of the License, or
10 | (at your option) any later version.
11 |
12 | Cinder-MIDI is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License
18 | along with Cinder-MIDI. If not, see .
19 | */
20 |
21 | // don't forget to add winmm.lib to the linker
22 |
23 | #include "cinder/app/App.h"
24 | #include "cinder/app/RendererGl.h"
25 | #include "cinder/gl/gl.h"
26 | #include "cinder/Utilities.h"
27 | #include
28 | #include "MidiIn.h"
29 | #include "MidiMessage.h"
30 | #include "MidiConstants.h"
31 | #include "cinder/osc/Osc.h"
32 | #include "cinder/Log.h"
33 |
34 | using namespace ci;
35 | using namespace ci::app;
36 | using namespace std;
37 | using namespace ci::osc;
38 | using namespace asio;
39 | using namespace asio::ip;
40 | #define SLIDER_NOTE 1
41 |
42 | #define USE_UDP 1
43 |
44 | #if USE_UDP
45 | using Sender = osc::SenderUdp;
46 | #else
47 | using Sender = osc::SenderTcp;
48 | #endif
49 |
50 | const std::string destinationHost = "127.0.0.1";
51 | const uint16_t destinationPort = 10001;
52 | const uint16_t localPort = 10000;
53 |
54 | class Midi2OscApp : public App {
55 | public:
56 | Midi2OscApp();
57 | void setup() override;
58 | void update() override;
59 | void draw() override;
60 | void mouseMove(MouseEvent event) override;
61 | void mouseDown(MouseEvent event) override;
62 | void mouseDrag(MouseEvent event) override;
63 | void mouseUp(MouseEvent event) override;
64 | void midiListener(midi::Message msg);
65 |
66 | midi::Input mMidiIn;
67 |
68 | float sliderValue = 0.0f;
69 | string status;
70 | int notes[128];
71 | //int cc[128];
72 |
73 | ivec2 mCurrentMousePositon;
74 |
75 | void onSendError(asio::error_code error);
76 | Sender mSender;
77 | bool mIsConnected;
78 | };
79 |
80 | Midi2OscApp::Midi2OscApp()
81 | : mSender(localPort, destinationHost, destinationPort), mIsConnected(false)
82 | {
83 | }
84 | void Midi2OscApp::setup() {
85 |
86 | if (mMidiIn.getNumPorts() > 0) {
87 | mMidiIn.listPorts();
88 | mMidiIn.openPort(0);
89 | console() << "Opening MIDI port 0" << std::endl;
90 | mMidiIn.midiSignal.connect(std::bind(&Midi2OscApp::midiListener, this, std::placeholders::_1));
91 | }
92 | else {
93 | console() << "No MIDI Ports found!!!!" << std::endl;
94 | }
95 | try {
96 | // Bind the sender to the endpoint. This function may throw. The exception will
97 | // contain asio::error_code information.
98 | mSender.bind();
99 | }
100 | catch (const osc::Exception &ex) {
101 | //CI_LOG_E("Error binding: " << ex.what() << " val: " << ex.value());
102 | quit();
103 | }
104 |
105 | #if ! USE_UDP
106 | mSender.connect(
107 | // Set up the OnConnectFn. If there's no error, you can consider yourself connected to
108 | // the endpoint supplied.
109 | [&](asio::error_code error) {
110 | if (error) {
111 | CI_LOG_E("Error connecting: " << error.message() << " val: " << error.value());
112 | quit();
113 | }
114 | else {
115 | CI_LOG_V("Connected");
116 | mIsConnected = true;
117 | }
118 | });
119 | #else
120 | // Udp doesn't "connect" the same way Tcp does. If bind doesn't throw, we can
121 | // consider ourselves connected.
122 | mIsConnected = true;
123 | #endif
124 | }
125 |
126 | // Unified error handler. Easiest to have a bound function in this situation,
127 | // since we're sending from many different places.
128 | void Midi2OscApp::onSendError(asio::error_code error)
129 | {
130 | if (error) {
131 | CI_LOG_E("Error sending: " << error.message() << " val: " << error.value());
132 | // If you determine that this error is fatal, make sure to flip mIsConnected. It's
133 | // possible that the error isn't fatal.
134 | mIsConnected = false;
135 | try {
136 | #if ! USE_UDP
137 | // If this is Tcp, it's recommended that you shutdown before closing. This
138 | // function could throw. The exception will contain asio::error_code
139 | // information.
140 | mSender.shutdown();
141 | #endif
142 | // Close the socket on exit. This function could throw. The exception will
143 | // contain asio::error_code information.
144 | mSender.close();
145 | }
146 | catch (const osc::Exception &ex) {
147 | CI_LOG_E("Cleaning up socket: val -" << ex.value(), ex);
148 | }
149 | quit();
150 | }
151 | }
152 | void Midi2OscApp::midiListener(midi::Message msg) {
153 | osc::Message oscMsg("/cc");
154 | switch (msg.status)
155 | {
156 | case MIDI_NOTE_ON:
157 | notes[msg.pitch] = msg.velocity;
158 | status = "Pitch: " + toString(msg.pitch) + "\n" + "Velocity: " + toString(msg.velocity);
159 | sliderValue = msg.pitch / 127.0f;
160 | break;
161 | case MIDI_NOTE_OFF:
162 | break;
163 | case MIDI_CONTROL_CHANGE:
164 | //cc[msg.control] = msg.value;
165 | sliderValue = msg.value / 127.0f;
166 | status = "Control: " + toString(msg.control) + "\n" +
167 | "Value: " + toString(msg.value);
168 |
169 | oscMsg.append(msg.control);
170 | oscMsg.append(sliderValue);
171 | // Send the msg and also provide an error handler. If the message is important you
172 | // could store it in the error callback to dispatch it again if there was a problem.
173 | mSender.send(oscMsg, std::bind(&Midi2OscApp::onSendError,
174 | this, std::placeholders::_1));
175 |
176 | break;
177 | default:
178 | break;
179 | }
180 | // Make sure you're connected before trying to send.
181 | if (!mIsConnected)
182 | return;
183 |
184 | }
185 | void Midi2OscApp::update() {
186 |
187 | }
188 | void Midi2OscApp::mouseMove(MouseEvent event)
189 | {
190 | }
191 |
192 | void Midi2OscApp::mouseDown(MouseEvent event)
193 | {
194 | }
195 |
196 | void Midi2OscApp::mouseDrag(MouseEvent event)
197 | {
198 | osc::Message oscMx("/cc");
199 | oscMx.append(42);
200 | oscMx.append((float)event.getX());
201 | mSender.send(oscMx, std::bind(&Midi2OscApp::onSendError,
202 | this, std::placeholders::_1));
203 |
204 | osc::Message oscMy("/cc");
205 | oscMy.append(43);
206 | oscMy.append((float)event.getY());
207 | mSender.send(oscMy, std::bind(&Midi2OscApp::onSendError,
208 | this, std::placeholders::_1));
209 |
210 | }
211 |
212 | void Midi2OscApp::mouseUp(MouseEvent event)
213 | {
214 | }
215 | void Midi2OscApp::draw() {
216 | gl::clear(Color(0, 0, 0), true);
217 | gl::color(Color(1, 1, 1));
218 | gl::drawSolidRect(Rectf(vec2(0, 0), vec2(sliderValue * getWindowWidth(), getWindowHeight())));
219 | }
220 | auto settingsFunc = [](App::Settings *settings) {
221 | #if defined( CINDER_MSW )
222 | settings->setConsoleWindowEnabled();
223 | #endif
224 | settings->setMultiTouchEnabled(false);
225 | };
226 | CINDER_APP(Midi2OscApp, RendererGl, settingsFunc)
227 |
--------------------------------------------------------------------------------
/src/MidiOut.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // MidiOut.cpp
3 | //
4 | // Created by Tim Murray-Browne on 26/01/2013. See licence and credits in MidiOut.h.
5 | //
6 | //
7 |
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include "MidiOut.h"
13 |
14 |
15 | using namespace cinder::midi;
16 | using namespace std;
17 |
18 | bool MidiOut::sVerboseLogging = false;
19 |
20 | /// Set the output client name (optional).
21 | MidiOut::MidiOut(std::string const& name)
22 | : mName(name)
23 | , mRtMidiOut(new RtMidiOut())
24 | //, mRtMidiOut(new RtMidiOut(name))
25 | , mPortNumber(-1)
26 | , mIsVirtual(false)
27 | , mBytes(3)
28 | {}
29 |
30 | MidiOut::~MidiOut()
31 | {
32 | closePort();
33 | }
34 |
35 | /// Get a list of output port names.
36 | /// The vector index corresponds with the name's port number.
37 | /// Note: this order may change when new devices are added/removed
38 | /// from the system.
39 | std::vector MidiOut::getPortList() const
40 | {
41 | vector portList;
42 | for(unsigned int i = 0; i < mRtMidiOut->getPortCount(); ++i)
43 | {
44 | portList.push_back(mRtMidiOut->getPortName(i));
45 | }
46 | return portList;
47 | }
48 |
49 | /// Get the number of output ports
50 | int MidiOut::getNumPorts() const
51 | {
52 | return mRtMidiOut->getPortCount();
53 | }
54 |
55 | /// Get the name of an output port by it's number
56 | /// \return "" if number is invalid
57 | std::string MidiOut::getPortName(unsigned int portNumber) const
58 | {
59 | return mRtMidiOut->getPortName(portNumber).c_str(); // strip null chars introduced by rtmidi
60 | }
61 |
62 | /// \section Connection
63 |
64 | /// Connect to an output port.
65 | /// Setting port = 0 will open the first available
66 | bool MidiOut::openPort(unsigned int portNumber)
67 | {
68 | // handle rtmidi exceptions
69 | try
70 | {
71 | closePort();
72 | std::stringstream ss;
73 | ss << mName << "Output " << portNumber;
74 | mRtMidiOut->openPort( portNumber, ss.str() );
75 | }
76 | catch (RtMidiError& err)
77 | {
78 | std::cout << "[ERROR ci::midi::MidiOut::openPort] couldn't open port " << portNumber << " " << err.getMessage() << std::endl;
79 | return false;
80 | }
81 | mPortNumber = portNumber;
82 | mPortName = mRtMidiOut->getPortName(portNumber);
83 | if (sVerboseLogging)
84 | std::cout << "[VERBOSE ci::midi::MidiOut::openPort] opened port " << portNumber << " " << mPortName << std::endl;
85 | return true;
86 | }
87 |
88 | /// Create and connect to a virtual output port (MacOS and Linux ALSA only).
89 | /// allows for connections between software
90 | /// note: a connected virtual port has a portNum = -1
91 | /// note: an open virtual port ofxMidiOut object cannot see it's virtual
92 | /// own virtual port when listing ports
93 | ///
94 | bool MidiOut::openVirtualPort(std::string const& portName)
95 | {
96 | // handle rtmidi exceptions
97 | try
98 | {
99 | closePort();
100 | mRtMidiOut->openVirtualPort(portName);
101 | }
102 | catch (RtMidiError& err) {
103 | std::cout << "[ERROR ci::midi::MidiOut::openVirtualPort] couldn't open virtual port " << portName << " " << err.getMessage() << std::endl;
104 | return false;
105 | }
106 |
107 | mPortName = portName;
108 | mIsVirtual = true;
109 | if (sVerboseLogging)
110 | std::cout << "[VERBOSE ci::midi::MidiOut::openVirtualPort] opened virtual port " << portName << std::endl;
111 | return true;
112 | }
113 |
114 | /// Close the port connection
115 | void MidiOut::closePort()
116 | {
117 | if (sVerboseLogging)
118 | {
119 | if(mIsVirtual)
120 | {
121 | assert(mPortNumber == -1); // ensure invariant is valid
122 | std::cout << "[VERBOSE ci::midi::MidiOut::closePort] closed virtual port " << mPortName << std::endl;
123 | }
124 | else if(mPortNumber > -1)
125 | {
126 | std::cout << "[VERBOSE ci::midi::MidiOut::closePort] closed port " << mPortNumber << ": " << mPortName << std::endl;
127 | }
128 | }
129 | mRtMidiOut->closePort();
130 | mPortNumber = -1;
131 | mPortName = "";
132 | mIsVirtual = false;
133 | }
134 |
135 | /// Get the port number if connected.
136 | /// \return -1 if not connected or this is a virtual port
137 | int MidiOut::getPort() const
138 | {
139 | return mPortNumber;
140 | }
141 |
142 | /// Get the connected output port name
143 | /// \return "" if not connected
144 | std::string MidiOut::getName() const
145 | {
146 | return mPortName;
147 | }
148 |
149 | /// \return true if connected
150 | bool MidiOut::isOpen() const
151 | {
152 | return mPortNumber>-1 || mIsVirtual;
153 | }
154 |
155 | /// \return true if this is a virtual port
156 | bool MidiOut::isVirtual() const
157 | {
158 | return mIsVirtual;
159 | }
160 |
161 | /// \section Sending
162 |
163 | ///
164 | /// midi events
165 | ///
166 | /// number ranges:
167 | /// channel 1 - 16
168 | /// pitch 0 - 127
169 | /// velocity 0 - 127
170 | /// control value 0 - 127
171 | /// program value 0 - 127
172 | /// bend value 0 - 16383
173 | /// touch value 0 - 127
174 | ///
175 | /// note:
176 | /// - a noteon with vel = 0 is equivalent to a noteoff
177 | /// - send velocity = 64 if not using velocity values
178 | /// - most synths don't use the velocity value in a noteoff
179 | /// - the lsb & msb for raw pitch bend bytes are 7 bit
180 | ///
181 | /// references:
182 | /// http://www.srm.com/qtma/davidsmidispec.html
183 | ///
184 | void MidiOut::sendMessage(unsigned char status, unsigned char byteOne, unsigned char byteTwo)
185 | {
186 | assert(mBytes.size() == 3);
187 | mBytes[0] = status;
188 | mBytes[1] = byteOne;
189 | mBytes[2] = byteTwo;
190 | sendMessage(mBytes);
191 | }
192 |
193 | void MidiOut::sendMessage(unsigned char status, unsigned char byteOne)
194 | {
195 | assert(mBytes.size() == 3);
196 | mBytes.resize(2);
197 | mBytes[0] = status;
198 | mBytes[1] = byteOne;
199 | sendMessage(mBytes);
200 | mBytes.resize(3); // restore invariant
201 | }
202 |
203 | void MidiOut::sendMessage(std::vector& bytes)
204 | {
205 | mRtMidiOut->sendMessage(&bytes);
206 | }
207 |
208 | void MidiOut::sendNoteOn(int channel, int pitch, int velocity)
209 | {
210 | sendMessage(MIDI_NOTE_ON+channel-1, pitch, velocity);
211 | }
212 | void MidiOut::sendNoteOff(int channel, int pitch, int velocity)
213 | {
214 | sendMessage(MIDI_NOTE_OFF+channel-1, pitch, velocity);
215 | }
216 | void MidiOut::sendControlChange(int channel, int control, int value)
217 | {
218 | sendMessage(MIDI_CONTROL_CHANGE+channel-1, control, value);
219 | }
220 | void MidiOut::sendProgramChange(int channel, int value)
221 | {
222 | sendMessage(MIDI_PROGRAM_CHANGE+channel-1, value);
223 | }
224 | void MidiOut::sendPitchBend(int channel, int value)
225 | {
226 | if (value >>14 != 0)
227 | {
228 | std::cout << "[ERROR ci::midi::MidiOut::sendPitchBend] Pitch bend values must be less than " << (1<<14) << std::endl;
229 | }
230 | // least significant 7 bits, most significant 7 bits (assuming 14 bit value)
231 | sendPitchBend(channel, value & 0x7F, (value>>7) & 0x7F);
232 | }
233 | void MidiOut::sendPitchBend(int channel, unsigned char lsb, unsigned char msb)
234 | {
235 | sendMessage(MIDI_PITCH_BEND, lsb, msb);
236 | }
237 | void MidiOut::sendAftertouch(int channel, int value)
238 | {
239 | sendMessage(MIDI_AFTERTOUCH+channel-1, value);
240 | }
241 | void MidiOut::sendPolyAftertouch(int channel, int pitch, int value)
242 | {
243 | sendMessage(MIDI_POLY_AFTERTOUCH+channel-1, pitch, value);
244 | }
245 |
--------------------------------------------------------------------------------
/MidiTest/vc2013/sample.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {7F571890-FF11-4184-AF53-AFF0E0B1C946}
15 | sample
16 | Win32Proj
17 |
18 |
19 |
20 | Application
21 | false
22 | v120
23 | Unicode
24 | true
25 |
26 |
27 | Application
28 | true
29 | v120
30 | Unicode
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | <_ProjectFileVersion>10.0.30319.1
43 | $(SolutionDir)$(Configuration)\
44 | $(Configuration)\
45 | true
46 | $(SolutionDir)$(Configuration)\
47 | $(Configuration)\
48 | false
49 |
50 |
51 |
52 | Disabled
53 | ..\include;"..\..\..\..\\include";"..\..\..\..\\boost";..\..\include;..\..\lib;..\..\src
54 | WIN32;_DEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions)
55 | true
56 | EnableFastChecks
57 | MultiThreadedDebug
58 |
59 | Level3
60 | EditAndContinue
61 | true
62 |
63 |
64 | "..\..\..\..\\include";..\include
65 |
66 |
67 | winmm.lib;cinder-$(PlatformToolset)_d.lib;%(AdditionalDependencies)
68 | "..\..\..\..\\lib";"..\..\..\..\\lib\msw\$(PlatformTarget)"
69 | true
70 | Windows
71 | false
72 |
73 | MachineX86
74 | LIBCMT;LIBCPMT
75 |
76 |
77 |
78 |
79 | ..\include;"..\..\..\..\\include";"..\..\..\..\\boost";..\..\include;..\..\lib;..\..\src
80 | WIN32;NDEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions)
81 | MultiThreaded
82 |
83 | Level3
84 | ProgramDatabase
85 | true
86 |
87 |
88 | true
89 |
90 |
91 | "..\..\..\..\\include";..\include
92 |
93 |
94 | winmm.lib;cinder-$(PlatformToolset).lib;%(AdditionalDependencies)
95 | "..\..\..\..\\lib";"..\..\..\..\\lib\msw\$(PlatformTarget)"
96 | false
97 | true
98 | Windows
99 | true
100 |
101 | false
102 |
103 | MachineX86
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/MidiTest/vc2017/sample.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {7F571890-FF11-4184-AF53-AFF0E0B1C946}
15 | sample
16 | Win32Proj
17 | 10.0.17763.0
18 |
19 |
20 |
21 | Application
22 | false
23 | v141
24 | Unicode
25 | true
26 |
27 |
28 | Application
29 | true
30 | v141
31 | Unicode
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | <_ProjectFileVersion>10.0.30319.1
44 | $(SolutionDir)$(Configuration)\
45 | $(Configuration)\
46 | true
47 | $(SolutionDir)$(Configuration)\
48 | $(Configuration)\
49 | false
50 |
51 |
52 |
53 | Disabled
54 | ..\include;"..\..\..\..\\include";"..\..\..\..\\boost";..\..\include;..\..\lib;..\..\src
55 | WIN32;_DEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions)
56 | true
57 | EnableFastChecks
58 | MultiThreadedDebug
59 |
60 | Level3
61 | EditAndContinue
62 | true
63 |
64 |
65 | "..\..\..\..\\include";..\include
66 |
67 |
68 | winmm.lib;cinder.lib;%(AdditionalDependencies)
69 | ..\..\..\..\\lib;..\..\..\..\\lib\msw\$(PlatformTarget);..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)
70 | true
71 | Windows
72 | false
73 |
74 | MachineX86
75 | LIBCMT;LIBCPMT
76 |
77 |
78 |
79 |
80 | ..\include;"..\..\..\..\\include";"..\..\..\..\\boost";..\..\include;..\..\lib;..\..\src
81 | WIN32;NDEBUG;_WINDOWS;NOMINMAX;_WIN32_WINNT=0x0502;%(PreprocessorDefinitions)
82 | MultiThreaded
83 |
84 | Level3
85 | ProgramDatabase
86 | true
87 |
88 |
89 | true
90 |
91 |
92 | "..\..\..\..\\include";..\include
93 |
94 |
95 | winmm.lib;cinder.lib;%(AdditionalDependencies)
96 | ..\..\..\..\\lib;..\..\..\..\\lib\msw\$(PlatformTarget);..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)
97 | false
98 | true
99 | Windows
100 | true
101 |
102 | false
103 |
104 | MachineX86
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
--------------------------------------------------------------------------------
/samples/Midi2Osc/vc2015/Midi2Osc.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | Win32
6 |
7 |
8 | Debug
9 | x64
10 |
11 |
12 | Release
13 | Win32
14 |
15 |
16 | Release
17 | x64
18 |
19 |
20 |
21 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}
22 | Midi2Osc
23 | Win32Proj
24 |
25 |
26 |
27 | Application
28 | false
29 | v140
30 | Unicode
31 | false
32 |
33 |
34 | Application
35 | false
36 | v140
37 | Unicode
38 | false
39 |
40 |
41 | Application
42 | true
43 | v140
44 | Unicode
45 |
46 |
47 | Application
48 | true
49 | v140
50 | Unicode
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | <_ProjectFileVersion>10.0.30319.1
69 | $(ProjectDir)build\$(Platform)\$(Configuration)\
70 | $(ProjectDir)build\$(Platform)\$(Configuration)\intermediate\
71 | true
72 | true
73 | $(ProjectDir)build\$(Platform)\$(Configuration)\
74 | $(ProjectDir)build\$(Platform)\$(Configuration)\intermediate\
75 | false
76 | false
77 |
78 |
79 |
80 | Disabled
81 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\OSC\src
82 | WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)
83 | true
84 | EnableFastChecks
85 | MultiThreadedDebug
86 |
87 | Level3
88 | EditAndContinue
89 | true
90 |
91 |
92 | "..\..\..\..\..\include";..\include
93 |
94 |
95 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
96 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)"
97 | true
98 | Windows
99 | false
100 |
101 | MachineX86
102 | LIBCMT;LIBCPMT
103 |
104 |
105 |
106 |
107 | Disabled
108 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\OSC\src
109 | WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)
110 | EnableFastChecks
111 | MultiThreadedDebug
112 |
113 | Level3
114 | ProgramDatabase
115 | true
116 |
117 |
118 | "..\..\..\..\..\include";..\include
119 |
120 |
121 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
122 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)"
123 | true
124 | Windows
125 | false
126 |
127 | LIBCMT;LIBCPMT
128 |
129 |
130 |
131 |
132 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\OSC\src
133 | WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)
134 | MultiThreaded
135 |
136 | Level3
137 | ProgramDatabase
138 | true
139 |
140 |
141 | true
142 |
143 |
144 | "..\..\..\..\..\include";..\include
145 |
146 |
147 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
148 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)"
149 | false
150 | true
151 | Windows
152 | true
153 |
154 | false
155 |
156 | MachineX86
157 |
158 |
159 |
160 |
161 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\OSC\src
162 | WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)
163 | MultiThreaded
164 |
165 | Level3
166 | ProgramDatabase
167 | true
168 |
169 |
170 | true
171 |
172 |
173 | "..\..\..\..\..\include";..\include
174 |
175 |
176 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
177 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)"
178 | false
179 | true
180 | Windows
181 | true
182 |
183 | false
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
--------------------------------------------------------------------------------
/samples/Midi2Osc/vc2017/Midi2Osc.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | Win32
6 |
7 |
8 | Debug
9 | x64
10 |
11 |
12 | Release
13 | Win32
14 |
15 |
16 | Release
17 | x64
18 |
19 |
20 |
21 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}
22 | Midi2Osc
23 | Win32Proj
24 | 10.0.18362.0
25 |
26 |
27 |
28 | Application
29 | false
30 | v141
31 | Unicode
32 | false
33 |
34 |
35 | Application
36 | false
37 | v141
38 | Unicode
39 | false
40 |
41 |
42 | Application
43 | true
44 | v141
45 | Unicode
46 |
47 |
48 | Application
49 | true
50 | v141
51 | Unicode
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | <_ProjectFileVersion>10.0.30319.1
70 | $(ProjectDir)build\$(Platform)\$(Configuration)\
71 | $(ProjectDir)build\$(Platform)\$(Configuration)\intermediate\
72 | true
73 | true
74 | $(ProjectDir)build\$(Platform)\$(Configuration)\
75 | $(ProjectDir)build\$(Platform)\$(Configuration)\intermediate\
76 | false
77 | false
78 |
79 |
80 |
81 | Disabled
82 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\OSC\src
83 | __WINDOWS_MM__;WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)
84 | true
85 | EnableFastChecks
86 | MultiThreadedDebug
87 |
88 | Level3
89 | EditAndContinue
90 | true
91 |
92 |
93 | "..\..\..\..\..\include";..\include
94 |
95 |
96 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
97 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)"
98 | true
99 | Windows
100 | false
101 |
102 | MachineX86
103 | LIBCMT;LIBCPMT
104 |
105 |
106 |
107 |
108 | Disabled
109 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\OSC\src
110 | __WINDOWS_MM__;WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)
111 | EnableFastChecks
112 | MultiThreadedDebug
113 |
114 | Level3
115 | ProgramDatabase
116 | true
117 |
118 |
119 | "..\..\..\..\..\include";..\include
120 |
121 |
122 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
123 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)"
124 | true
125 | Windows
126 | false
127 |
128 | LIBCMT;LIBCPMT
129 |
130 |
131 |
132 |
133 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\OSC\src
134 | __WINDOWS_MM__;WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)
135 | MultiThreaded
136 |
137 | Level3
138 | ProgramDatabase
139 | true
140 |
141 |
142 | true
143 |
144 |
145 | "..\..\..\..\..\include";..\include
146 |
147 |
148 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
149 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)"
150 | false
151 | true
152 | Windows
153 | true
154 |
155 | false
156 |
157 | MachineX86
158 |
159 |
160 |
161 |
162 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\OSC\src
163 | __WINDOWS_MM__;WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)
164 | MultiThreaded
165 |
166 | Level3
167 | ProgramDatabase
168 | true
169 |
170 |
171 | true
172 |
173 |
174 | "..\..\..\..\..\include";..\include
175 |
176 |
177 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
178 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)"
179 | false
180 | true
181 | Windows
182 | true
183 |
184 | false
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
--------------------------------------------------------------------------------
/samples/Midi2Websocket/vc2015/Midi2Websocket.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | Win32
6 |
7 |
8 | Debug
9 | x64
10 |
11 |
12 | Release
13 | Win32
14 |
15 |
16 | Release
17 | x64
18 |
19 |
20 |
21 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}
22 | Midi2Websocket
23 | Win32Proj
24 |
25 |
26 |
27 | Application
28 | false
29 | v140
30 | Unicode
31 | false
32 |
33 |
34 | Application
35 | false
36 | v140
37 | Unicode
38 | false
39 |
40 |
41 | Application
42 | true
43 | v140
44 | Unicode
45 |
46 |
47 | Application
48 | true
49 | v140
50 | Unicode
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | <_ProjectFileVersion>10.0.30319.1
69 | $(ProjectDir)build\$(Platform)\$(Configuration)\
70 | $(ProjectDir)build\$(Platform)\$(Configuration)\intermediate\
71 | true
72 | true
73 | $(ProjectDir)build\$(Platform)\$(Configuration)\
74 | $(ProjectDir)build\$(Platform)\$(Configuration)\intermediate\
75 | false
76 | false
77 |
78 |
79 |
80 | Disabled
81 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\Cinder-WebSocketPP\src;..\..\..\..\..\include\asio
82 | WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)
83 | true
84 | EnableFastChecks
85 | MultiThreadedDebug
86 |
87 | Level3
88 | EditAndContinue
89 | true
90 |
91 |
92 | "..\..\..\..\..\include";..\include
93 |
94 |
95 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
96 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)";..\..\..\..\Cinder-WebSocketPP\lib\msw
97 | true
98 | Windows
99 | false
100 |
101 | MachineX86
102 | LIBCMT;LIBCPMT
103 |
104 |
105 |
106 |
107 | Disabled
108 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\Cinder-WebSocketPP\src;..\..\..\..\..\include\asio
109 | WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)
110 | EnableFastChecks
111 | MultiThreadedDebug
112 |
113 | Level3
114 | ProgramDatabase
115 | true
116 |
117 |
118 | "..\..\..\..\..\include";..\include
119 |
120 |
121 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
122 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)";..\..\..\..\Cinder-WebSocketPP\lib\msw
123 | true
124 | Windows
125 | false
126 |
127 | LIBCMT;LIBCPMT
128 |
129 |
130 |
131 |
132 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\Cinder-WebSocketPP\src;..\..\..\..\..\include\asio
133 | WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)
134 | MultiThreaded
135 |
136 | Level3
137 | ProgramDatabase
138 | true
139 |
140 |
141 | true
142 |
143 |
144 | "..\..\..\..\..\include";..\include
145 |
146 |
147 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
148 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)";..\..\..\..\Cinder-WebSocketPP\lib\msw
149 | false
150 | true
151 | Windows
152 | true
153 |
154 | false
155 |
156 | MachineX86
157 |
158 |
159 |
160 |
161 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\Cinder-WebSocketPP\src;..\..\..\..\..\include\asio
162 | WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)
163 | MultiThreaded
164 |
165 | Level3
166 | ProgramDatabase
167 | true
168 |
169 |
170 | true
171 |
172 |
173 | "..\..\..\..\..\include";..\include
174 |
175 |
176 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
177 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)";..\..\..\..\Cinder-WebSocketPP\lib\msw
178 | false
179 | true
180 | Windows
181 | true
182 |
183 | false
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
--------------------------------------------------------------------------------
/samples/Midi2Osc/vc2019/Midi2Osc.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | Win32
6 |
7 |
8 | Debug
9 | x64
10 |
11 |
12 | Release
13 | Win32
14 |
15 |
16 | Release
17 | x64
18 |
19 |
20 |
21 | {7C214F38-EF11-46EF-B1CE-EF5ACC7B7539}
22 | Midi2Osc
23 | Win32Proj
24 | 10.0
25 |
26 |
27 |
28 | Application
29 | false
30 | v142
31 | Unicode
32 | false
33 |
34 |
35 | Application
36 | false
37 | v142
38 | Unicode
39 | false
40 |
41 |
42 | Application
43 | true
44 | v142
45 | Unicode
46 |
47 |
48 | Application
49 | true
50 | v142
51 | Unicode
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | <_ProjectFileVersion>10.0.30319.1
70 | $(ProjectDir)build\$(Platform)\$(Configuration)\
71 | $(ProjectDir)build\$(Platform)\$(Configuration)\intermediate\
72 | true
73 | true
74 | $(ProjectDir)build\$(Platform)\$(Configuration)\
75 | $(ProjectDir)build\$(Platform)\$(Configuration)\intermediate\
76 | false
77 | false
78 |
79 |
80 |
81 | Disabled
82 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\OSC\src
83 | __WINDOWS_MM__;_WEBSOCKETPP_CPP11_RANDOM_DEVICE_;_WEBSOCKETPP_CPP11_TYPE_TRAITS_;ASIO_STANDALONE;_WEBSOCKETPP_CPP11_FUNCTIONAL_;WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)
84 | true
85 | EnableFastChecks
86 | MultiThreadedDebug
87 |
88 | Level3
89 | EditAndContinue
90 | true
91 | stdcpp17
92 |
93 |
94 | "..\..\..\..\..\include";..\include
95 |
96 |
97 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
98 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)"
99 | true
100 | Windows
101 | false
102 |
103 | MachineX86
104 | LIBCMT;LIBCPMT
105 |
106 |
107 |
108 |
109 | Disabled
110 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\OSC\src
111 | __WINDOWS_MM__;_WEBSOCKETPP_CPP11_RANDOM_DEVICE_;_WEBSOCKETPP_CPP11_TYPE_TRAITS_;ASIO_STANDALONE;_WEBSOCKETPP_CPP11_FUNCTIONAL_;WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)
112 | EnableFastChecks
113 | MultiThreadedDebug
114 |
115 | Level3
116 | ProgramDatabase
117 | true
118 | stdcpp17
119 |
120 |
121 | "..\..\..\..\..\include";..\include
122 |
123 |
124 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
125 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)"
126 | true
127 | Windows
128 | false
129 |
130 | LIBCMT;LIBCPMT
131 |
132 |
133 |
134 |
135 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\OSC\src
136 | __WINDOWS_MM__;_WEBSOCKETPP_CPP11_RANDOM_DEVICE_;_WEBSOCKETPP_CPP11_TYPE_TRAITS_;ASIO_STANDALONE;_WEBSOCKETPP_CPP11_FUNCTIONAL_;WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)
137 | MultiThreaded
138 |
139 | Level3
140 | ProgramDatabase
141 | true
142 | stdcpp17
143 |
144 |
145 | true
146 |
147 |
148 | "..\..\..\..\..\include";..\include
149 |
150 |
151 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
152 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)"
153 | false
154 | true
155 | Windows
156 | true
157 |
158 | false
159 |
160 | MachineX86
161 |
162 |
163 |
164 |
165 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\OSC\src
166 | __WINDOWS_MM__;_WEBSOCKETPP_CPP11_RANDOM_DEVICE_;_WEBSOCKETPP_CPP11_TYPE_TRAITS_;ASIO_STANDALONE;_WEBSOCKETPP_CPP11_FUNCTIONAL_;WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)
167 | MultiThreaded
168 |
169 | Level3
170 | ProgramDatabase
171 | true
172 | stdcpp17
173 |
174 |
175 | true
176 |
177 |
178 | "..\..\..\..\..\include";..\include
179 |
180 |
181 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
182 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)"
183 | false
184 | true
185 | Windows
186 | true
187 |
188 | false
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
--------------------------------------------------------------------------------
/samples/Midi2Websocket/vc2017/Midi2Websocket.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | Win32
6 |
7 |
8 | Debug
9 | x64
10 |
11 |
12 | Release
13 | Win32
14 |
15 |
16 | Release
17 | x64
18 |
19 |
20 |
21 | {D3920E1F-039E-4191-B5DA-6DB2051CE0DD}
22 | Midi2Websocket
23 | Win32Proj
24 | 10.0.18362.0
25 |
26 |
27 |
28 | Application
29 | false
30 | v141
31 | Unicode
32 | false
33 |
34 |
35 | Application
36 | false
37 | v141
38 | Unicode
39 | false
40 |
41 |
42 | Application
43 | true
44 | v141
45 | Unicode
46 |
47 |
48 | Application
49 | true
50 | v141
51 | Unicode
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | <_ProjectFileVersion>10.0.30319.1
70 | $(ProjectDir)build\$(Platform)\$(Configuration)\
71 | $(ProjectDir)build\$(Platform)\$(Configuration)\intermediate\
72 | true
73 | true
74 | $(ProjectDir)build\$(Platform)\$(Configuration)\
75 | $(ProjectDir)build\$(Platform)\$(Configuration)\intermediate\
76 | false
77 | false
78 |
79 |
80 |
81 | Disabled
82 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\Cinder-WebSocketPP\src;..\..\..\..\..\include\asio
83 | __WINDOWS_MM__;WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)
84 | true
85 | EnableFastChecks
86 | MultiThreadedDebug
87 |
88 | Level3
89 | EditAndContinue
90 | true
91 |
92 |
93 | "..\..\..\..\..\include";..\include
94 |
95 |
96 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
97 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)";..\..\..\..\Cinder-WebSocketPP\lib\msw
98 | true
99 | Windows
100 | false
101 |
102 | MachineX86
103 | LIBCMT;LIBCPMT
104 |
105 |
106 |
107 |
108 | Disabled
109 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\Cinder-WebSocketPP\src;..\..\..\..\..\include\asio
110 | __WINDOWS_MM__;WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)
111 | EnableFastChecks
112 | MultiThreadedDebug
113 |
114 | Level3
115 | ProgramDatabase
116 | true
117 |
118 |
119 | "..\..\..\..\..\include";..\include
120 |
121 |
122 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
123 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)";..\..\..\..\Cinder-WebSocketPP\lib\msw
124 | true
125 | Windows
126 | false
127 |
128 | LIBCMT;LIBCPMT
129 |
130 |
131 |
132 |
133 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\Cinder-WebSocketPP\src;..\..\..\..\..\include\asio
134 | __WINDOWS_MM__;WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)
135 | MultiThreaded
136 |
137 | Level3
138 | ProgramDatabase
139 | true
140 |
141 |
142 | true
143 |
144 |
145 | "..\..\..\..\..\include";..\include
146 |
147 |
148 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
149 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)";..\..\..\..\Cinder-WebSocketPP\lib\msw
150 | false
151 | true
152 | Windows
153 | true
154 |
155 | false
156 |
157 | MachineX86
158 |
159 |
160 |
161 |
162 | ..\include;"..\..\..\..\..\include";..\..\..\include;..\..\..\lib;..\..\..\src;..\..\..\..\Cinder-WebSocketPP\src;..\..\..\..\..\include\asio
163 | __WINDOWS_MM__;WIN32;_WIN32_WINNT=0x0601;_WINDOWS;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)
164 | MultiThreaded
165 |
166 | Level3
167 | ProgramDatabase
168 | true
169 |
170 |
171 | true
172 |
173 |
174 | "..\..\..\..\..\include";..\include
175 |
176 |
177 | cinder.lib;OpenGL32.lib;%(AdditionalDependencies);winmm.lib
178 | "..\..\..\..\..\lib\msw\$(PlatformTarget)";"..\..\..\..\..\lib\msw\$(PlatformTarget)\$(Configuration)\$(PlatformToolset)";..\..\..\..\Cinder-WebSocketPP\lib\msw
179 | false
180 | true
181 | Windows
182 | true
183 |
184 | false
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
--------------------------------------------------------------------------------