mirror of
https://github.com/AxioDL/boo.git
synced 2025-12-14 15:46:19 +00:00
General: Make use of override where applicable
Continues the override modernizations, but now targeting boo.
This commit is contained in:
@@ -70,11 +70,11 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
|
||||
// IUnknown methods -- AddRef, Release, and QueryInterface
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef() {
|
||||
ULONG STDMETHODCALLTYPE AddRef() override {
|
||||
return InterlockedIncrement(&_cRef);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE Release() {
|
||||
ULONG STDMETHODCALLTYPE Release() override {
|
||||
ULONG ulRef = InterlockedDecrement(&_cRef);
|
||||
if (0 == ulRef) {
|
||||
delete this;
|
||||
@@ -82,7 +82,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
return ulRef;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, VOID** ppvInterface) {
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, VOID** ppvInterface) override {
|
||||
if (IID_IUnknown == riid) {
|
||||
AddRef();
|
||||
*ppvInterface = (IUnknown*)this;
|
||||
@@ -98,18 +98,20 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
|
||||
// Callback methods for device-event notifications.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId) {
|
||||
HRESULT STDMETHODCALLTYPE OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId) override {
|
||||
m_parent.m_rebuild = true;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceAdded(LPCWSTR pwstrDeviceId) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceAdded(LPCWSTR pwstrDeviceId) override { return S_OK; }
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceRemoved(LPCWSTR pwstrDeviceId) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceRemoved(LPCWSTR pwstrDeviceId) override { return S_OK; }
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState) override { return S_OK; }
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key) override {
|
||||
return S_OK;
|
||||
}
|
||||
} m_notificationClient;
|
||||
#endif
|
||||
|
||||
@@ -386,7 +388,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
_resetSampleRate();
|
||||
}
|
||||
|
||||
void pumpAndMixVoices() {
|
||||
void pumpAndMixVoices() override {
|
||||
#if WINDOWS_STORE
|
||||
if (!m_ready)
|
||||
return;
|
||||
@@ -463,9 +465,9 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
}
|
||||
}
|
||||
|
||||
std::string getCurrentAudioOutput() const { return m_sinkName; }
|
||||
std::string getCurrentAudioOutput() const override { return m_sinkName; }
|
||||
|
||||
bool setCurrentAudioOutput(const char* name) {
|
||||
bool setCurrentAudioOutput(const char* name) override {
|
||||
ComPtr<IMMDevice> newDevice;
|
||||
if (FAILED(m_enumerator->GetDevice(MBSTWCS(name).c_str(), &newDevice))) {
|
||||
Log.report(logvisor::Error, fmt("unable to obtain audio device {}"), name);
|
||||
@@ -477,7 +479,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> enumerateAudioOutputs() const {
|
||||
std::vector<std::pair<std::string, std::string>> enumerateAudioOutputs() const override {
|
||||
std::vector<std::pair<std::string, std::string>> ret;
|
||||
|
||||
ComPtr<IMMDeviceCollection> collection;
|
||||
@@ -507,7 +509,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
}
|
||||
|
||||
#if !WINDOWS_STORE
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIInputs() const {
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIInputs() const override {
|
||||
std::vector<std::pair<std::string, std::string>> ret;
|
||||
|
||||
UINT numInDevices = midiInGetNumDevs();
|
||||
@@ -547,7 +549,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool supportsVirtualMIDIIn() const {
|
||||
bool supportsVirtualMIDIIn() const override {
|
||||
#ifdef TE_VIRTUAL_MIDI
|
||||
WORD major, minor, release, build;
|
||||
return virtualMIDIGetDriverVersionPROC &&
|
||||
@@ -588,9 +590,9 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
|
||||
VMIDIIn(WASAPIAudioVoiceEngine* parent, ReceiveFunctor&& receiver) : IMIDIIn(parent, true, std::move(receiver)) {}
|
||||
|
||||
~VMIDIIn() { virtualMIDIClosePortPROC(m_midi); }
|
||||
~VMIDIIn() override { virtualMIDIClosePortPROC(m_midi); }
|
||||
|
||||
std::string description() const { return "Virtual MIDI-In"; }
|
||||
std::string description() const override { return "Virtual MIDI-In"; }
|
||||
};
|
||||
|
||||
struct VMIDIOut : public IMIDIOut {
|
||||
@@ -598,11 +600,11 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
|
||||
VMIDIOut(WASAPIAudioVoiceEngine* parent) : IMIDIOut(parent, true) {}
|
||||
|
||||
~VMIDIOut() { virtualMIDIClosePortPROC(m_midi); }
|
||||
~VMIDIOut() override { virtualMIDIClosePortPROC(m_midi); }
|
||||
|
||||
std::string description() const { return "Virtual MIDI-Out"; }
|
||||
std::string description() const override { return "Virtual MIDI-Out"; }
|
||||
|
||||
size_t send(const void* buf, size_t len) const {
|
||||
size_t send(const void* buf, size_t len) const override {
|
||||
return virtualMIDISendDataPROC(m_midi, (LPBYTE)buf, len) ? len : 0;
|
||||
}
|
||||
};
|
||||
@@ -613,11 +615,11 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
VMIDIInOut(WASAPIAudioVoiceEngine* parent, ReceiveFunctor&& receiver)
|
||||
: IMIDIInOut(parent, true, std::move(receiver)) {}
|
||||
|
||||
~VMIDIInOut() { virtualMIDIClosePortPROC(m_midi); }
|
||||
~VMIDIInOut() override { virtualMIDIClosePortPROC(m_midi); }
|
||||
|
||||
std::string description() const { return "Virtual MIDI-In/Out"; }
|
||||
std::string description() const override { return "Virtual MIDI-In/Out"; }
|
||||
|
||||
size_t send(const void* buf, size_t len) const {
|
||||
size_t send(const void* buf, size_t len) const override {
|
||||
return virtualMIDISendDataPROC(m_midi, (LPBYTE)buf, len) ? len : 0;
|
||||
}
|
||||
};
|
||||
@@ -628,9 +630,9 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
|
||||
MIDIIn(WASAPIAudioVoiceEngine* parent, ReceiveFunctor&& receiver) : IMIDIIn(parent, false, std::move(receiver)) {}
|
||||
|
||||
~MIDIIn() { midiInClose(m_midi); }
|
||||
~MIDIIn() override { midiInClose(m_midi); }
|
||||
|
||||
std::string description() const {
|
||||
std::string description() const override {
|
||||
UINT id = 0;
|
||||
midiInGetID(m_midi, &id);
|
||||
MIDIINCAPS caps;
|
||||
@@ -664,13 +666,13 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
midiStreamOpen(&m_strm, &id, 1, NULL, NULL, CALLBACK_NULL);
|
||||
}
|
||||
|
||||
~MIDIOut() {
|
||||
~MIDIOut() override {
|
||||
midiStreamClose(m_strm);
|
||||
midiOutUnprepareHeader(m_midi, &m_hdr, sizeof(m_hdr));
|
||||
midiOutClose(m_midi);
|
||||
}
|
||||
|
||||
std::string description() const {
|
||||
std::string description() const override {
|
||||
UINT id = 0;
|
||||
midiOutGetID(m_midi, &id);
|
||||
MIDIOUTCAPS caps;
|
||||
@@ -684,7 +686,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t send(const void* buf, size_t len) const {
|
||||
size_t send(const void* buf, size_t len) const override {
|
||||
memcpy(const_cast<MIDIOut*>(this)->m_buf, buf, std::min(len, size_t(512)));
|
||||
const_cast<MIDIOut*>(this)->m_hdr.dwBytesRecorded = len;
|
||||
midiStreamOut(m_strm, LPMIDIHDR(&m_hdr), sizeof(m_hdr));
|
||||
@@ -713,14 +715,14 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
midiStreamOpen(&m_strm, &id, 1, NULL, NULL, CALLBACK_NULL);
|
||||
}
|
||||
|
||||
~MIDIInOut() {
|
||||
~MIDIInOut() override {
|
||||
midiInClose(m_midiIn);
|
||||
midiStreamClose(m_strm);
|
||||
midiOutUnprepareHeader(m_midiOut, &m_hdr, sizeof(m_hdr));
|
||||
midiOutClose(m_midiOut);
|
||||
}
|
||||
|
||||
std::string description() const {
|
||||
std::string description() const override {
|
||||
UINT id = 0;
|
||||
midiOutGetID(m_midiOut, &id);
|
||||
MIDIOUTCAPS caps;
|
||||
@@ -734,7 +736,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t send(const void* buf, size_t len) const {
|
||||
size_t send(const void* buf, size_t len) const override {
|
||||
memcpy(const_cast<uint8_t*>(m_buf), buf, std::min(len, size_t(512)));
|
||||
const_cast<MIDIHDR&>(m_hdr).dwBytesRecorded = len;
|
||||
midiStreamOut(m_strm, LPMIDIHDR(&m_hdr), sizeof(m_hdr));
|
||||
@@ -742,7 +744,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver) override {
|
||||
#ifdef TE_VIRTUAL_MIDI
|
||||
if (!virtualMIDICreatePortEx2PROC)
|
||||
return {};
|
||||
@@ -764,7 +766,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
#endif
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut() {
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut() override {
|
||||
#ifdef TE_VIRTUAL_MIDI
|
||||
if (!virtualMIDICreatePortEx2PROC)
|
||||
return {};
|
||||
@@ -785,7 +787,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
#endif
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver) override {
|
||||
#ifdef TE_VIRTUAL_MIDI
|
||||
if (!virtualMIDICreatePortEx2PROC)
|
||||
return {};
|
||||
@@ -807,7 +809,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
#endif
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) override {
|
||||
if (strncmp(name, "in", 2))
|
||||
return {};
|
||||
long id = strtol(name + 2, nullptr, 10);
|
||||
@@ -824,7 +826,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name) {
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name) override {
|
||||
if (strncmp(name, "out", 3))
|
||||
return {};
|
||||
long id = strtol(name + 3, nullptr, 10);
|
||||
@@ -840,7 +842,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) override {
|
||||
const char* in = strstr(name, "in");
|
||||
const char* out = strstr(name, "out");
|
||||
|
||||
@@ -866,21 +868,21 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool useMIDILock() const { return true; }
|
||||
bool useMIDILock() const override { return true; }
|
||||
#else
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIDevices() const { return {}; }
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIDevices() const override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver) { return {}; }
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver) override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut() { return {}; }
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut() override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver) { return {}; }
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver) override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) { return {}; }
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name) { return {}; }
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name) override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) { return {}; }
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) override { return {}; }
|
||||
|
||||
bool useMIDILock() const { return false; }
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user