Browse Source

macOS: Use the endpoint info when setting MidiInput/MidiOutput device name in ::openDevice()

tags/2021-05-28
ed 6 years ago
parent
commit
452863e7fa
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      modules/juce_audio_devices/native/juce_mac_CoreMidi.cpp

+ 8
- 4
modules/juce_audio_devices/native/juce_mac_CoreMidi.cpp View File

@@ -420,7 +420,9 @@ MidiInput* MidiInput::openDevice (const String& deviceIdentifier, MidiInputCallb
{
for (auto& endpoint : getEndpoints (true))
{
if (deviceIdentifier == getConnectedEndpointInfo (endpoint).identifier)
auto endpointInfo = getConnectedEndpointInfo (endpoint);
if (deviceIdentifier == endpointInfo.identifier)
{
ScopedCFString cfName;
@@ -435,7 +437,7 @@ MidiInput* MidiInput::openDevice (const String& deviceIdentifier, MidiInputCallb
{
mpc->portAndEndpoint.reset (new MidiPortAndEndpoint (port, endpoint));
std::unique_ptr<MidiInput> midiInput (new MidiInput (String::fromCFString (cfName.cfString), deviceIdentifier));
std::unique_ptr<MidiInput> midiInput (new MidiInput (endpointInfo.name, endpointInfo.identifier));
mpc->input = midiInput.get();
midiInput->internal = mpc.get();
@@ -559,7 +561,9 @@ MidiOutput* MidiOutput::openDevice (const String& deviceIdentifier)
{
for (auto& endpoint : getEndpoints (false))
{
if (deviceIdentifier == getConnectedEndpointInfo (endpoint).identifier)
auto endpointInfo = getConnectedEndpointInfo (endpoint);
if (deviceIdentifier == endpointInfo.identifier)
{
ScopedCFString cfName;
@@ -569,7 +573,7 @@ MidiOutput* MidiOutput::openDevice (const String& deviceIdentifier)
if (CHECK_ERROR (MIDIOutputPortCreate (client, cfName.cfString, &port)))
{
std::unique_ptr<MidiOutput> midiOutput (new MidiOutput (String::fromCFString (cfName.cfString), deviceIdentifier));
std::unique_ptr<MidiOutput> midiOutput (new MidiOutput (endpointInfo.name, endpointInfo.identifier));
midiOutput->internal = new MidiPortAndEndpoint (port, endpoint);
return midiOutput.release();


Loading…
Cancel
Save