diff options
author | Chris Xiong <chirs241097@gmail.com> | 2019-10-05 23:04:53 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2019-10-05 23:04:53 +0800 |
commit | 8cf35c5ceb10d5c54e933127fb60c5034ef8a149 (patch) | |
tree | 21d68963030f0fca87eef2e8503e32c97ceb0553 /core/qmpmidioutrtmidi.cpp | |
parent | 5ad76bb13ecc29aeb5b2b71cb33a00add44c5b35 (diff) | |
download | QMidiPlayer-8cf35c5ceb10d5c54e933127fb60c5034ef8a149.tar.xz |
Replaced the option "default output device" with a more powerful one.
Old code for default output device completely removed.
Diffstat (limited to 'core/qmpmidioutrtmidi.cpp')
-rw-r--r-- | core/qmpmidioutrtmidi.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/core/qmpmidioutrtmidi.cpp b/core/qmpmidioutrtmidi.cpp index c37fadc..fba8e03 100644 --- a/core/qmpmidioutrtmidi.cpp +++ b/core/qmpmidioutrtmidi.cpp @@ -312,26 +312,19 @@ void qmpMidiOutRtMidi::setInitializerFile(const char* path) devinit=qmpDeviceInitializer::parse(path); } -RtMidiOut* qmpRtMidiManager::dummy=nullptr; -void qmpRtMidiManager::createDevices() +std::vector<std::pair<qmpMidiOutRtMidi*,std::string>> qmpRtMidiManager::devices; +std::vector<std::pair<qmpMidiOutRtMidi*,std::string>> qmpRtMidiManager::getDevices() { + if(devices.size())return devices; + RtMidiOut *dummy; try{dummy=new RtMidiOut();} catch(RtMidiError &e) { printf("Failed to initialize the dummy device: %s\n",e.what()); - dummy=nullptr;return; + return{}; } for(unsigned i=0;i<dummy->getPortCount();++i) devices.push_back(std::make_pair(new qmpMidiOutRtMidi(i),dummy->getPortName(i))); -} -void qmpRtMidiManager::deleteDevices() -{ - for(size_t i=0;i<devices.size();++i) - delete devices[i].first; - devices.clear(); delete dummy; -} -std::vector<std::pair<qmpMidiOutRtMidi*,std::string>> qmpRtMidiManager::getDevices() -{ return devices; } |