|
|
|
@@ -38,6 +38,37 @@ namespace |
|
|
|
class AlsaClient : public ReferenceCountedObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
AlsaClient()
|
|
|
|
{
|
|
|
|
jassert (instance == nullptr);
|
|
|
|
|
|
|
|
snd_seq_open (&handle, "default", SND_SEQ_OPEN_DUPLEX, 0);
|
|
|
|
|
|
|
|
if (handle != nullptr)
|
|
|
|
{
|
|
|
|
snd_seq_nonblock (handle, SND_SEQ_NONBLOCK);
|
|
|
|
snd_seq_set_client_name (handle, JUCE_ALSA_MIDI_NAME);
|
|
|
|
clientId = snd_seq_client_id (handle);
|
|
|
|
|
|
|
|
// It's good idea to pre-allocate a good number of elements
|
|
|
|
ports.ensureStorageAllocated (32);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
~AlsaClient()
|
|
|
|
{
|
|
|
|
jassert (instance != nullptr);
|
|
|
|
instance = nullptr;
|
|
|
|
|
|
|
|
if (handle != nullptr)
|
|
|
|
snd_seq_close (handle);
|
|
|
|
|
|
|
|
jassert (activeCallbacks.get() == 0);
|
|
|
|
|
|
|
|
if (inputThread)
|
|
|
|
inputThread->stopThread (3000);
|
|
|
|
}
|
|
|
|
|
|
|
|
using Ptr = ReferenceCountedObjectPtr<AlsaClient>;
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
@@ -251,42 +282,6 @@ private: |
|
|
|
|
|
|
|
static AlsaClient* instance;
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
friend class ReferenceCountedObjectPtr<AlsaClient>;
|
|
|
|
friend struct ContainerDeletePolicy<AlsaClient>;
|
|
|
|
|
|
|
|
AlsaClient()
|
|
|
|
{
|
|
|
|
jassert (instance == nullptr);
|
|
|
|
|
|
|
|
snd_seq_open (&handle, "default", SND_SEQ_OPEN_DUPLEX, 0);
|
|
|
|
|
|
|
|
if (handle != nullptr)
|
|
|
|
{
|
|
|
|
snd_seq_nonblock (handle, SND_SEQ_NONBLOCK);
|
|
|
|
snd_seq_set_client_name (handle, JUCE_ALSA_MIDI_NAME);
|
|
|
|
clientId = snd_seq_client_id (handle);
|
|
|
|
|
|
|
|
// It's good idea to pre-allocate a good number of elements
|
|
|
|
ports.ensureStorageAllocated (32);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
~AlsaClient()
|
|
|
|
{
|
|
|
|
jassert (instance != nullptr);
|
|
|
|
|
|
|
|
instance = nullptr;
|
|
|
|
|
|
|
|
if (handle != nullptr)
|
|
|
|
snd_seq_close (handle);
|
|
|
|
|
|
|
|
jassert (activeCallbacks.get() == 0);
|
|
|
|
|
|
|
|
if (inputThread)
|
|
|
|
inputThread->stopThread (3000);
|
|
|
|
}
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
class MidiInputThread : public Thread
|
|
|
|
{
|
|
|
|
|