Skip to content

Commit

Permalink
Move WinMM session name to resource
Browse files Browse the repository at this point in the history
  • Loading branch information
Psychlist1972 committed Feb 9, 2025
1 parent 50b79cc commit fc45ac7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
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

0 comments on commit fc45ac7

Please sign in to comment.