| 1 |
/** |
| 2 |
* Furnace Tracker - multi-system chiptune tracker |
| 3 |
* Copyright (C) 2021-2025 tildearrow and contributors |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License along |
| 16 |
* with this program; if not, write to the Free Software Foundation, Inc., |
| 17 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include "taAudio.h" |
| 21 |
#ifdef HAVE_RTMIDI |
| 22 |
#include "rtmidi.h" |
| 23 |
#endif |
| 24 |
|
| 25 |
bool TAAudio::initMidi(bool jack) { |
| 26 |
#ifndef HAVE_RTMIDI |
| 27 |
return false; |
| 28 |
#else |
| 29 |
midiIn=new TAMidiInRtMidi; |
| 30 |
midiOut=new TAMidiOutRtMidi; |
| 31 |
|
| 32 |
if (!midiIn->init()) { |
| 33 |
delete midiIn; |
| 34 |
midiIn=NULL; |
| 35 |
return false; |
| 36 |
} |
| 37 |
|
| 38 |
if (!midiOut->init()) { |
| 39 |
midiIn->quit(); |
| 40 |
delete midiOut; |
| 41 |
delete midiIn; |
| 42 |
midiOut=NULL; |
| 43 |
midiIn=NULL; |
| 44 |
return false; |
| 45 |
} |
| 46 |
return true; |
| 47 |
#endif |
| 48 |
} |
| 49 |
|
| 50 |
void TAAudio::quitMidi() { |
| 51 |
if (midiIn!=NULL) { |
| 52 |
midiIn->quit(); |
| 53 |
delete midiIn; |
| 54 |
midiIn=NULL; |
| 55 |
} |
| 56 |
if (midiOut!=NULL) { |
| 57 |
midiOut->quit(); |
| 58 |
delete midiOut; |
| 59 |
midiOut=NULL; |
| 60 |
} |
| 61 |
} |