summaryrefslogtreecommitdiff
path: root/drivers/alsamidi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/alsamidi')
-rw-r--r--drivers/alsamidi/midi_driver_alsamidi.cpp17
-rw-r--r--drivers/alsamidi/midi_driver_alsamidi.h4
2 files changed, 6 insertions, 15 deletions
diff --git a/drivers/alsamidi/midi_driver_alsamidi.cpp b/drivers/alsamidi/midi_driver_alsamidi.cpp
index 6121a44b36..0cecf1de3e 100644
--- a/drivers/alsamidi/midi_driver_alsamidi.cpp
+++ b/drivers/alsamidi/midi_driver_alsamidi.cpp
@@ -148,7 +148,6 @@ Error MIDIDriverALSAMidi::open() {
}
snd_device_name_free_hint(hints);
- mutex = Mutex::create();
exit_thread = false;
thread = Thread::create(MIDIDriverALSAMidi::thread_func, this);
@@ -165,11 +164,6 @@ void MIDIDriverALSAMidi::close() {
thread = NULL;
}
- if (mutex) {
- memdelete(mutex);
- mutex = NULL;
- }
-
for (int i = 0; i < connected_inputs.size(); i++) {
snd_rawmidi_t *midi_in = connected_inputs[i];
snd_rawmidi_close(midi_in);
@@ -179,19 +173,17 @@ void MIDIDriverALSAMidi::close() {
void MIDIDriverALSAMidi::lock() const {
- if (mutex)
- mutex->lock();
+ mutex.lock();
}
void MIDIDriverALSAMidi::unlock() const {
- if (mutex)
- mutex->unlock();
+ mutex.unlock();
}
-PoolStringArray MIDIDriverALSAMidi::get_connected_inputs() {
+PackedStringArray MIDIDriverALSAMidi::get_connected_inputs() {
- PoolStringArray list;
+ PackedStringArray list;
lock();
for (int i = 0; i < connected_inputs.size(); i++) {
@@ -210,7 +202,6 @@ PoolStringArray MIDIDriverALSAMidi::get_connected_inputs() {
MIDIDriverALSAMidi::MIDIDriverALSAMidi() {
- mutex = NULL;
thread = NULL;
exit_thread = false;
diff --git a/drivers/alsamidi/midi_driver_alsamidi.h b/drivers/alsamidi/midi_driver_alsamidi.h
index 354fcce147..6797c7c138 100644
--- a/drivers/alsamidi/midi_driver_alsamidi.h
+++ b/drivers/alsamidi/midi_driver_alsamidi.h
@@ -44,7 +44,7 @@
class MIDIDriverALSAMidi : public MIDIDriver {
Thread *thread;
- Mutex *mutex;
+ Mutex mutex;
Vector<snd_rawmidi_t *> connected_inputs;
@@ -59,7 +59,7 @@ public:
virtual Error open();
virtual void close();
- virtual PoolStringArray get_connected_inputs();
+ virtual PackedStringArray get_connected_inputs();
MIDIDriverALSAMidi();
virtual ~MIDIDriverALSAMidi();