Skip to content

Commit

Permalink
Merge pull request #553 from microsoft/buildfixes
Browse files Browse the repository at this point in the history
fix driver test hang when switching state fast, fix build issues due to missing headers
  • Loading branch information
Psychlist1972 authored Feb 19, 2025
2 parents 7ca0062 + 27d070a commit abc0bb3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/api/Drivers/MinMidi/Driver/MidiPin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,6 @@ MidiPin::HandleIo()

// start with the even reset to indicate that the thread is running
m_ThreadExitedEvent.clear();
m_ThreadExitEvent.clear();

if (m_Pin->DataFlow == KSPIN_DATAFLOW_IN)
{
Expand Down Expand Up @@ -753,7 +752,7 @@ MidiPin::HandleIo()
PVOID midiInWaitObjects[] = { m_ThreadExitEvent.get(), g_MidiInPin->m_ReadEvent };

// Wait for either room in the output buffer, or thread exit.
status = KeWaitForMultipleObjects(2, waitObjects, WaitAny, Executive, KernelMode, FALSE, nullptr, nullptr);
status = KeWaitForMultipleObjects(2, midiInWaitObjects, WaitAny, Executive, KernelMode, FALSE, nullptr, nullptr);
if (STATUS_WAIT_1 == status)
{
// we have room, retry writing this pass
Expand Down Expand Up @@ -884,6 +883,8 @@ MidiPin::SetDeviceState(
// midi out
if (This->m_IsLooped)
{
This->m_ThreadExitEvent.clear();

// Create and start the midi out worker thread for the cyclic buffer.
HANDLE handle = NULL;
NT_RETURN_IF_NTSTATUS_FAILED(PsCreateSystemThread(&handle, THREAD_ALL_ACCESS, 0, 0, 0, MidiPin::WorkerThread, This));
Expand Down
2 changes: 1 addition & 1 deletion src/api/Drivers/MinMidi2/Driver/StreamEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ StreamEngine::HandleIo()
PVOID midiInWaitObjects[] = { m_ThreadExitEvent.get(), g_MidiInStreamEngine->m_ReadEvent };

// Wait for either room in the output buffer, or thread exit.
status = KeWaitForMultipleObjects(2, waitObjects, WaitAny, Executive, KernelMode, FALSE, nullptr, nullptr);
status = KeWaitForMultipleObjects(2, midiInWaitObjects, WaitAny, Executive, KernelMode, FALSE, nullptr, nullptr);
if (STATUS_WAIT_1 == status)
{
// we have room in the input pin buffer, set the write event and break
Expand Down
3 changes: 2 additions & 1 deletion src/api/Drivers/USBMIDI2/Driver/StreamEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ StreamEngine::HandleIo()

// start with the even reset to indicate that the thread is running
m_ThreadExitedEvent.clear();
m_ThreadExitEvent.clear();

if (AcxPinGetId(m_Pin) == MidiPinTypeMidiOut)
{
Expand Down Expand Up @@ -574,6 +573,8 @@ StreamEngine::Run()
// transition from paused to run
if (AcxPinGetId(m_Pin) == MidiPinTypeMidiOut)
{
m_ThreadExitEvent.clear();

// Create and start the midi out worker thread for the cyclic buffer.
HANDLE handle = nullptr;
NT_RETURN_IF_NTSTATUS_FAILED(PsCreateSystemThread(&handle, THREAD_ALL_ACCESS, 0, 0, 0, StreamEngine::WorkerThread, this));
Expand Down
1 change: 1 addition & 0 deletions src/api/Service/Exe/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <string>
#include <iterator>
#include <strsafe.h>
#include <mmsystem.h>
#include <wrl\module.h>
#include <wrl\event.h>
#include <avrt.h>
Expand Down
2 changes: 2 additions & 0 deletions src/api/Transport/KSAggregateTransport/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.Devices.Enumeration.h>

#include <mmsystem.h>
#include <wrl\module.h>
#include <wrl\event.h>
#include <devioctl.h>
#include <ks.h>
#include <ksmedia.h>
#include <avrt.h>
Expand Down

0 comments on commit abc0bb3

Please sign in to comment.