Skip to content

Commit

Permalink
Merge pull request #532 from microsoft/pete-dev
Browse files Browse the repository at this point in the history
Sync up last of winmm changes for this weekend
  • Loading branch information
Psychlist1972 authored Feb 9, 2025
2 parents b4f4060 + c7ddc7e commit 6183d93
Show file tree
Hide file tree
Showing 28 changed files with 48 additions and 35 deletions.
2 changes: 1 addition & 1 deletion build/staging/version/BundleInfo.wxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Include>
<?define SetupVersionName="Customer Preview 2 Arm64" ?>
<?define SetupVersionNumber="1.0.3-preview-11.250209-214" ?>
<?define SetupVersionNumber="1.0.3-preview-11.250209-429" ?>
</Include>
4 changes: 2 additions & 2 deletions build/staging/version/WindowsMidiServicesVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ public static class MidiBuildInformation
{
public const string Source = "GitHub Preview";
public const string Name = "Customer Preview 2";
public const string BuildFullVersion = "1.0.3-preview-11.250209-214";
public const string BuildFullVersion = "1.0.3-preview-11.250209-429";
public const string VersionMajor = "1";
public const string VersionMinor = "0";
public const string VersionRevision = "3";
public const string VersionDateNumber = "250209";
public const string VersionTimeNumber = "214";
public const string VersionTimeNumber = "429";
}
}

4 changes: 2 additions & 2 deletions build/staging/version/WindowsMidiServicesVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

#define WINDOWS_MIDI_SERVICES_BUILD_SOURCE L"GitHub Preview"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_NAME L"Customer Preview 2"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_FULL L"1.0.3-preview-11.250209-214"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_FULL L"1.0.3-preview-11.250209-429"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_MAJOR L"1"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_MINOR L"0"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_REVISION L"3"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_DATE_NUMBER L"250209"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_TIME_NUMBER L"214"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_TIME_NUMBER L"429"

#endif

2 changes: 1 addition & 1 deletion samples/cpp-winrt/basics/client-basics-cpp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-214</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-429</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>false</CppWinRTGenerateWindowsMetadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp-winrt/basics/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-214" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-429" targetFramework="native" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-214</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-429</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp-winrt/loopback-endpoints/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-214" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-429" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion samples/cpp-winrt/send-speed/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-214" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-429" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion samples/cpp-winrt/send-speed/send-speed-cpp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-214</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-429</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp-winrt/simple-app-to-app-midi/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-214" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-429" targetFramework="native" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-214</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-429</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp-winrt/static-enum-endpoints/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-214" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-429" targetFramework="native" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-214</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-429</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp-winrt/watch-endpoints/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-214" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-429" targetFramework="native" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-214</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-429</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
Expand Down
5 changes: 5 additions & 0 deletions src/api/Client/WinMM/MidiSrvPorts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ CMidiPorts::RuntimeClassInitialize()

RETURN_IF_FAILED(UuidCreate(&m_SessionId));


WCHAR sessionName[MIDI_MAX_SESSION_NAME_LENGTH];
::LoadStringW(HINST_WDMAUD2, IDS_MIDI_DEFAULT_WINMM_SESSION_NAME, sessionName, MIDI_MAX_SESSION_NAME_LENGTH);
m_SessionName = sessionName;

std::unique_ptr<CMidi2MidiSrv> midiSrv(new (std::nothrow) CMidi2MidiSrv());
RETURN_IF_NULL_ALLOC(midiSrv);

Expand Down
5 changes: 4 additions & 1 deletion src/api/Client/WinMM/MidiSrvPorts.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ typedef struct _PORT_INFO
MIDIOUTCAPSW MidiOutCaps {0};
} PORT_INFO;


#define MIDI_MAX_SESSION_NAME_LENGTH 50

// global singleton created on dll load, cleaned up on dllunload
class CMidiPorts :
public Microsoft::WRL::RuntimeClass<
Expand Down Expand Up @@ -49,7 +52,7 @@ class CMidiPorts :
// The session guid created for all ports opened by this client, a single guid is used for all sessions.
GUID m_SessionId {0};
// Default session name for winmm clients.
std::wstring m_SessionName { L"Winmm client session" };
std::wstring m_SessionName { };

// map of midi port information ordered by the port number.
// For each flow, the port number must be unique, but the port numbers
Expand Down
4 changes: 3 additions & 1 deletion src/api/Client/WinMM/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
#define IDS_SUBMIXER_CDLINE_SHORT 111
#define IDS_SUBMIXER_CDLINE_LONG 112

#define IDS_MIDI_UNAVAILABLE_ENDPOINT 200
#define IDS_MIDI_UNAVAILABLE_ENDPOINT 200

#define IDS_MIDI_DEFAULT_WINMM_SESSION_NAME 300

// Next default values for new objects
//
Expand Down
3 changes: 2 additions & 1 deletion src/api/Client/WinMM/winmmdrv.rc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ BEGIN
IDS_SUBMIXER_MUTE_SHORT "Mute"
IDS_SUBMIXER_MUTE_LONG "Mute"

IDS_MIDI_UNAVAILABLE_ENDPOINT "(unavailable)"
IDS_MIDI_UNAVAILABLE_ENDPOINT "(unavailable)"
IDS_MIDI_DEFAULT_WINMM_SESSION_NAME "WinMM client"
END

Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ CMidi2LoopbackMidiEndpointManager::DeleteSingleEndpoint(
TraceLoggingWideString(definition.EndpointDescription.c_str(), "description")
);

return m_MidiDeviceManager->DeactivateEndpoint(definition.CreatedShortClientInstanceId.c_str());
return m_MidiDeviceManager->RemoveEndpoint(definition.CreatedShortClientInstanceId.c_str());
}


Expand Down
2 changes: 1 addition & 1 deletion src/app-sdk/mididiag/mididiag.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-214</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-429</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
Expand Down
2 changes: 1 addition & 1 deletion src/app-sdk/mididiag/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-214" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-429" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.240803.1" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion src/app-sdk/midimdnsinfo/midimdnsinfo.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-214</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-429</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
Expand Down
2 changes: 1 addition & 1 deletion src/app-sdk/midimdnsinfo/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-214" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-429" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.240803.1" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion src/app-sdk/midiusbinfo/midiusbinfo.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-214</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250209-429</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
Expand Down
2 changes: 1 addition & 1 deletion src/app-sdk/midiusbinfo/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-214" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250209-429" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.240803.1" targetFramework="native" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ internal class EndpointMonitorCommand : Command<EndpointMonitorCommand.Settings>
{
// we have this struct so we can separate the relatively fast received processing
// and its calculations from the comparatively slow displays processing
private Queue<ReceivedMidiMessage> m_receivedMessagesQueue = new Queue<ReceivedMidiMessage>(2000);
private Queue<ReceivedMidiMessage> m_displayMessageQueue = new Queue<ReceivedMidiMessage>(1000);
private Queue<ReceivedMidiMessage> m_receivedMessagesQueue = new Queue<ReceivedMidiMessage>(4000);
private Queue<ReceivedMidiMessage> m_displayMessageQueue = new Queue<ReceivedMidiMessage>(2000);
private Queue<ReceivedMidiMessage> m_fileWriterMessagesQueue = new Queue<ReceivedMidiMessage>(1000);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,21 +187,22 @@ public override int Execute(CommandContext context, Settings settings)

if (settings.Midi2)
{
UInt32 velocity = (UInt32)(settings.Velocity / 100.0) * UInt32.MaxValue;
UInt32 velocity = (UInt32)(((float)settings.Velocity / 100.0) * UInt16.MaxValue) << 16;
UInt16 note = (UInt16)((UInt16)settings.NoteIndexes![noteArrayIndex] << 8);

var noteOnMessage = MidiMessageBuilder.BuildMidi2ChannelVoiceMessage(
MidiClock.TimestampConstantSendImmediately,
group,
Midi2ChannelVoiceMessageStatus.NoteOn,
channel,
(ushort)settings.NoteIndexes![noteArrayIndex],
note,
velocity);

noteOnSendResult = connection.SendSingleMessagePacket(noteOnMessage);
}
else
{
byte velocity = (byte)settings.Velocity;
byte velocity = (byte)((float)(settings.Velocity / 100.0) * 127);

var noteOnMessage = MidiMessageBuilder.BuildMidi1ChannelVoiceMessage(
MidiClock.TimestampConstantSendImmediately,
Expand Down Expand Up @@ -231,21 +232,22 @@ public override int Execute(CommandContext context, Settings settings)

if (settings.Midi2)
{
UInt32 velocity = (UInt32)(settings.Velocity / 100.0) * UInt32.MaxValue;
UInt32 velocity = (UInt32)((float)(settings.Velocity / 100.0) * UInt16.MaxValue) << 16;
UInt16 note = (UInt16)((UInt16)settings.NoteIndexes![noteArrayIndex] << 8);

var noteOffMessage = MidiMessageBuilder.BuildMidi2ChannelVoiceMessage(
MidiClock.TimestampConstantSendImmediately,
group,
Midi2ChannelVoiceMessageStatus.NoteOff,
channel,
(ushort)settings.NoteIndexes![noteArrayIndex],
note,
velocity);

noteOffSendResult = connection.SendSingleMessagePacket(noteOffMessage);
}
else
{
byte velocity = (byte)settings.Velocity;
byte velocity = (byte)((float)(settings.Velocity / 100.0) * 127);

var noteOffMessage = MidiMessageBuilder.BuildMidi1ChannelVoiceMessage(
MidiClock.TimestampConstantSendImmediately,
Expand Down

0 comments on commit 6183d93

Please sign in to comment.