From 3f72121ac41741d53e4916f1275cbd4f93259c4d Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sat, 25 May 2019 22:40:15 +0800 Subject: Massive code refactor en cours! Less complain from compilers: - use nullptr instead of NULL - use types for event fields - explicit type casting added Stop saving parameters of meta events in p1/p2 fields of SEvent. callback_t now uses std::function, deprecating ICallback. Not recommended for daily usage, or even testing: the code refactor is still a work in progress. --- core/qmpmidioutrtmidi.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'core/qmpmidioutrtmidi.cpp') diff --git a/core/qmpmidioutrtmidi.cpp b/core/qmpmidioutrtmidi.cpp index 1b897df..2d6d41f 100644 --- a/core/qmpmidioutrtmidi.cpp +++ b/core/qmpmidioutrtmidi.cpp @@ -6,13 +6,13 @@ qmpMidiOutRtMidi::qmpMidiOutRtMidi(unsigned _portid) { portid=_portid; - outport=NULL; + outport=nullptr; } qmpMidiOutRtMidi::~qmpMidiOutRtMidi() { if(!outport)return; if(outport->isPortOpen())outport->closePort(); - delete outport;outport=NULL; + delete outport;outport=nullptr; } void qmpMidiOutRtMidi::deviceInit() { @@ -23,7 +23,7 @@ void qmpMidiOutRtMidi::deviceInit() catch(RtMidiError &e) { printf("Cannot create RtMidi Output instance: %s\n",e.what()); - outport=NULL; + outport=nullptr; } } void qmpMidiOutRtMidi::deviceDeinit() @@ -92,14 +92,14 @@ void qmpMidiOutRtMidi::onUnmapped(uint8_t ch,int refcnt) if(!refcnt&&outport)outport->closePort(); } -RtMidiOut* qmpRtMidiManager::dummy=NULL; +RtMidiOut* qmpRtMidiManager::dummy=nullptr; void qmpRtMidiManager::createDevices() { try{dummy=new RtMidiOut();} catch(RtMidiError &e) { printf("Failed to initialize the dummy device: %s\n",e.what()); - dummy=NULL;return; + dummy=nullptr;return; } for(unsigned i=0;igetPortCount();++i) devices.push_back(std::make_pair(new qmpMidiOutRtMidi(i),dummy->getPortName(i))); -- cgit v1.2.3