|
1 | | -/* |
2 | | - ============================================================================== |
3 | | -
|
4 | | - This file is part of the YUP library. |
5 | | - Copyright (c) 2024 - [email protected] |
6 | | -
|
7 | | - YUP is an open source library subject to open-source licensing. |
8 | | -
|
9 | | - The code included in this file is provided under the terms of the ISC license |
10 | | - http://www.isc.org/downloads/software-support-policy/isc-license. Permission |
11 | | - to use, copy, modify, and/or distribute this software for any purpose with or |
12 | | - without fee is hereby granted provided that the above copyright notice and |
13 | | - this permission notice appear in all copies. |
14 | | -
|
15 | | - YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER |
16 | | - EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE |
17 | | - DISCLAIMED. |
18 | | -
|
19 | | - ============================================================================== |
20 | | -
|
21 | | - This file is part of the JUCE library. |
22 | | - Copyright (c) 2022 - Raw Material Software Limited |
23 | | -
|
24 | | - JUCE is an open source library subject to commercial or open-source |
25 | | - licensing. |
26 | | -
|
27 | | - The code included in this file is provided under the terms of the ISC license |
28 | | - http://www.isc.org/downloads/software-support-policy/isc-license. Permission |
29 | | - To use, copy, modify, and/or distribute this software for any purpose with or |
30 | | - without fee is hereby granted provided that the above copyright notice and |
31 | | - this permission notice appear in all copies. |
32 | | -
|
33 | | - JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER |
34 | | - EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE |
35 | | - DISCLAIMED. |
36 | | -
|
37 | | - ============================================================================== |
38 | | -*/ |
| 1 | +/* |
| 2 | + ============================================================================== |
39 | 3 |
|
40 | | -#include <array> |
41 | | -#include <cstring> |
42 | | -#include <poll.h> |
43 | | -#include <unistd.h> |
44 | | -#include <fcntl.h> |
| 4 | + This file is part of the YUP library. |
| 5 | + Copyright (c) 2024 - [email protected] |
45 | 6 |
|
46 | | -#if defined(__has_include) |
47 | | -#if __has_include(<alsa/ump.h>) |
48 | | -#include <alsa/ump.h> |
49 | | -#define YUP_HAS_ALSA_UMP 1 |
50 | | -#endif |
51 | | -#endif |
| 7 | + YUP is an open source library subject to open-source licensing. |
52 | 8 |
|
53 | | -#ifndef YUP_HAS_ALSA_UMP |
54 | | -#define YUP_HAS_ALSA_UMP 0 |
55 | | -#endif |
| 9 | + The code included in this file is provided under the terms of the ISC license |
| 10 | + http://www.isc.org/downloads/software-support-policy/isc-license. Permission |
| 11 | + to use, copy, modify, and/or distribute this software for any purpose with or |
| 12 | + without fee is hereby granted provided that the above copyright notice and |
| 13 | + this permission notice appear in all copies. |
| 14 | +
|
| 15 | + YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER |
| 16 | + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE |
| 17 | + DISCLAIMED. |
| 18 | +
|
| 19 | + ============================================================================== |
| 20 | +
|
| 21 | + This file is part of the JUCE library. |
| 22 | + Copyright (c) 2022 - Raw Material Software Limited |
| 23 | +
|
| 24 | + JUCE is an open source library subject to commercial or open-source |
| 25 | + licensing. |
| 26 | +
|
| 27 | + The code included in this file is provided under the terms of the ISC license |
| 28 | + http://www.isc.org/downloads/software-support-policy/isc-license. Permission |
| 29 | + To use, copy, modify, and/or distribute this software for any purpose with or |
| 30 | + without fee is hereby granted provided that the above copyright notice and |
| 31 | + this permission notice appear in all copies. |
| 32 | +
|
| 33 | + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER |
| 34 | + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE |
| 35 | + DISCLAIMED. |
| 36 | +
|
| 37 | + ============================================================================== |
| 38 | +*/ |
56 | 39 |
|
57 | 40 | namespace yup |
58 | 41 | { |
@@ -432,6 +415,20 @@ class AlsaClient |
432 | 415 |
|
433 | 416 | int getId() const noexcept { return clientId; } |
434 | 417 |
|
| 418 | + void configureForUmp() |
| 419 | + { |
| 420 | +#if defined(SND_SEQ_EVENT_UMP) |
| 421 | + if (! umpConfigured && handle != nullptr) |
| 422 | + { |
| 423 | + snd_seq_set_client_midi_version (handle, 2); |
| 424 | +#if defined(snd_seq_set_client_ump_conversion) |
| 425 | + snd_seq_set_client_ump_conversion (handle, 1); |
| 426 | +#endif |
| 427 | + umpConfigured = true; |
| 428 | + } |
| 429 | +#endif |
| 430 | + } |
| 431 | + |
435 | 432 | Port* createPort (const String& name, bool forInput, bool enableSubscription) |
436 | 433 | { |
437 | 434 | const ScopedLock sl (callbackLock); |
@@ -766,20 +763,6 @@ struct AlsaPortPtr |
766 | 763 | class MidiInput::Pimpl |
767 | 764 | { |
768 | 765 | public: |
769 | | - void configureForUmp() |
770 | | - { |
771 | | -#if defined(SND_SEQ_EVENT_UMP) |
772 | | - if (! umpConfigured && handle != nullptr) |
773 | | - { |
774 | | - snd_seq_set_client_midi_version (handle, 2); |
775 | | -#if defined(snd_seq_set_client_ump_conversion) |
776 | | - snd_seq_set_client_ump_conversion (handle, 1); |
777 | | -#endif |
778 | | - umpConfigured = true; |
779 | | - } |
780 | | -#endif |
781 | | - } |
782 | | - |
783 | 766 | virtual ~Pimpl() = default; |
784 | 767 | virtual void start() = 0; |
785 | 768 | virtual void stop() = 0; |
@@ -954,31 +937,6 @@ class UmpReceiverCallback final : public MidiInputCallback |
954 | 937 | ump::GenericUMPConverter converter; |
955 | 938 | }; |
956 | 939 |
|
957 | | -class UmpReceiverCallback final : public MidiInputCallback |
958 | | -{ |
959 | | -public: |
960 | | - UmpReceiverCallback (ump::PacketProtocol protocolIn, ump::Receiver& receiverIn) |
961 | | - : receiver (receiverIn) |
962 | | - , converter (protocolIn) |
963 | | - { |
964 | | - } |
965 | | - |
966 | | - void handleIncomingMidiMessage (MidiInput*, const MidiMessage& message) override |
967 | | - { |
968 | | - const auto timestamp = message.getTimeStamp(); |
969 | | - converter.convert (ump::BytestreamMidiView (&message), [&] (const ump::View& view) |
970 | | - { |
971 | | - receiver.packetReceived (view, timestamp); |
972 | | - }); |
973 | | - } |
974 | | - |
975 | | - void handlePartialSysexMessage (MidiInput*, const uint8*, int, double) override {} |
976 | | - |
977 | | -private: |
978 | | - ump::Receiver& receiver; |
979 | | - ump::GenericUMPConverter converter; |
980 | | -}; |
981 | | - |
982 | 940 | Array<MidiDeviceInfo> MidiInput::getAvailableDevices() |
983 | 941 | { |
984 | 942 | Array<MidiDeviceInfo> devices; |
|
0 commit comments