summaryrefslogtreecommitdiff
path: root/drivers/alsamidi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/alsamidi')
-rw-r--r--drivers/alsamidi/midi_driver_alsamidi.cpp13
-rw-r--r--drivers/alsamidi/midi_driver_alsamidi.h2
2 files changed, 3 insertions, 12 deletions
diff --git a/drivers/alsamidi/midi_driver_alsamidi.cpp b/drivers/alsamidi/midi_driver_alsamidi.cpp
index 670d7e0a4a..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,14 +173,12 @@ void MIDIDriverALSAMidi::close() {
void MIDIDriverALSAMidi::lock() const {
- if (mutex)
- mutex->lock();
+ mutex.lock();
}
void MIDIDriverALSAMidi::unlock() const {
- if (mutex)
- mutex->unlock();
+ mutex.unlock();
}
PackedStringArray MIDIDriverALSAMidi::get_connected_inputs() {
@@ -210,7 +202,6 @@ PackedStringArray 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 9900d90553..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;