Skip to content

Commit

Permalink
Merged keijiro#37 and modified for MIDI OUT
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagitch committed May 11, 2019
1 parent cb7a635 commit e9b6a60
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 16 deletions.
Binary file modified Assets/MidiJack/Plugins/x64/MidiJackPlugin.dll
Binary file not shown.
10 changes: 8 additions & 2 deletions ProjectSettings/EditorBuildSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes:
- enabled: 1
- enabled: 0
path: Assets/Example CC/Example CC.unity
- enabled: 1
guid: dd90cdcc6bec24b9298f05ad9a506876
- enabled: 0
path: Assets/Example Note/Example Note.unity
guid: f07186d979a1f410e8ff0a278b6b779c
- enabled: 1
path: Assets/Example Send/ExampleSend.unity
guid: 11d6059a623c51f4696e8f76254c43eb
m_configObjects: {}
42 changes: 38 additions & 4 deletions ProjectSettings/GraphicsSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,61 @@
--- !u!30 &1
GraphicsSettings:
m_ObjectHideFlags: 0
serializedVersion: 3
serializedVersion: 12
m_Deferred:
m_Mode: 1
m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
m_DeferredReflections:
m_Mode: 1
m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0}
m_ScreenSpaceShadows:
m_Mode: 1
m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0}
m_LegacyDeferred:
m_Mode: 1
m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
m_DepthNormals:
m_Mode: 1
m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0}
m_MotionVectors:
m_Mode: 1
m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0}
m_LightHalo:
m_Mode: 1
m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0}
m_LensFlare:
m_Mode: 1
m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0}
m_AlwaysIncludedShaders:
- {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
m_CustomRenderPipeline: {fileID: 0}
m_TransparencySortMode: 0
m_TransparencySortAxis: {x: 0, y: 0, z: 1}
m_DefaultRenderingPath: 1
m_DefaultMobileRenderingPath: 1
m_TierSettings: []
m_LightmapStripping: 0
m_FogStripping: 0
m_InstancingStripping: 0
m_LightmapKeepPlain: 1
m_LightmapKeepDirCombined: 1
m_LightmapKeepDirSeparate: 1
m_LightmapKeepDynamic: 1
m_FogStripping: 0
m_LightmapKeepDynamicPlain: 1
m_LightmapKeepDynamicDirCombined: 1
m_LightmapKeepShadowMask: 1
m_LightmapKeepSubtractive: 1
m_FogKeepLinear: 1
m_FogKeepExp: 1
m_FogKeepExp2: 1
m_AlbedoSwatchInfos: []
m_LightsUseLinearIntensity: 0
m_LightsUseColorTemperature: 0
18 changes: 10 additions & 8 deletions ProjectSettings/UnityConnectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,32 @@
--- !u!310 &1
UnityConnectSettings:
m_ObjectHideFlags: 0
m_Enabled: 0
serializedVersion: 1
m_Enabled: 1
m_TestMode: 0
m_TestEventUrl:
m_TestConfigUrl:
m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
m_EventUrl: https://cdp.cloud.unity3d.com/v1/events
m_ConfigUrl: https://config.uca.cloud.unity3d.com
m_TestInitMode: 0
CrashReportingSettings:
m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes
m_EventUrl: https://perf-events.cloud.unity3d.com
m_Enabled: 0
m_LogBufferSize: 10
m_CaptureEditorExceptions: 1
UnityPurchasingSettings:
m_Enabled: 0
m_TestMode: 0
UnityAnalyticsSettings:
m_Enabled: 0
m_InitializeOnStartup: 1
m_TestMode: 0
m_TestEventUrl:
m_TestConfigUrl:
m_InitializeOnStartup: 1
UnityAdsSettings:
m_Enabled: 0
m_InitializeOnStartup: 1
m_TestMode: 0
m_EnabledPlatforms: 4294967295
m_IosGameId:
m_AndroidGameId:
m_GameIds: {}
m_GameId:
PerformanceReportingSettings:
m_Enabled: 0
28 changes: 26 additions & 2 deletions VisualStudio/MidiJackPlugin/MidiJackPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ namespace
using DeviceHandle = HMIDIIN;
using DeviceHandleSend = HMIDIOUT;
using DeviceID = uint32_t;
const DeviceHandle INVALID_DEVICE_HANDLE = reinterpret_cast<DeviceHandle>(static_cast<intptr_t>(-1));
const DeviceHandleSend INVALID_DEVICE_HANDLE_SEND = reinterpret_cast<DeviceHandleSend>(static_cast<intptr_t>(-1));

// Utility functions for Win32/64 compatibility
#ifdef _WIN64
Expand All @@ -17,13 +19,27 @@ namespace
{
return static_cast<DeviceID>(reinterpret_cast<uint64_t>(handle));
}
std::map<DeviceID, DeviceHandle> device_id_to_handle;
DeviceHandle DeviceIDToHandle(DeviceID id)
{
return reinterpret_cast<DeviceHandle>(static_cast<uint64_t>(id));
// return reinterpret_cast<DeviceHandle>(static_cast<uint64_t>(id));
auto itor = device_id_to_handle.find(id);
if (itor != device_id_to_handle.end())
{
return (*itor).second;
}
return INVALID_DEVICE_HANDLE;
}
std::map<DeviceID, DeviceHandleSend> device_id_to_handle_send;
DeviceHandleSend DeviceIDToHandleSend(DeviceID id)
{
return reinterpret_cast<DeviceHandleSend>(static_cast<uint64_t>(id));
// return reinterpret_cast<DeviceHandleSend>(static_cast<uint64_t>(id));
auto itor = device_id_to_handle_send.find(id);
if (itor != device_id_to_handle_send.end())
{
return (*itor).second;
}
return INVALID_DEVICE_HANDLE_SEND;
}
#else
DeviceID DeviceHandleToID(DeviceHandle handle)
Expand Down Expand Up @@ -189,6 +205,8 @@ namespace
{
resource_lock.lock();
active_handles.push_back(handle);
DeviceID id = DeviceHandleToID(handle);
device_id_to_handle[id] = handle;
resource_lock.unlock();
}
else
Expand All @@ -208,6 +226,8 @@ namespace
{
resource_lock_send.lock();
active_handles_send.push_back(handle);
DeviceID id = DeviceHandleToID(handle);
device_id_to_handle_send[id] = handle;
resource_lock_send.unlock();
}
else {
Expand All @@ -223,6 +243,8 @@ namespace

resource_lock.lock();
active_handles.remove(handle);
DeviceID id = DeviceHandleToID(handle);
device_id_to_handle.erase(id);
resource_lock.unlock();
}

Expand All @@ -233,6 +255,8 @@ namespace

resource_lock_send.lock();
active_handles_send.remove(handle);
DeviceID id = DeviceHandleToID(handle);
device_id_to_handle_send.erase(id);
resource_lock_send.unlock();
}

Expand Down
1 change: 1 addition & 0 deletions VisualStudio/MidiJackPlugin/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <cstdio>
#include <cstdlib>
#include <string>
#include <map>
#include <mutex>
#include <queue>
#include <list>
Expand Down

0 comments on commit e9b6a60

Please sign in to comment.