Skip to content

Commit

Permalink
Updates to console to increase buffer sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
Psychlist1972 committed Feb 9, 2025
1 parent 5e9cf29 commit 50b79cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
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 50b79cc

Please sign in to comment.