diff --git a/samples/blackgui/mainwindow.cpp b/samples/blackgui/mainwindow.cpp index 8f0bd236d..a12a0706e 100644 --- a/samples/blackgui/mainwindow.cpp +++ b/samples/blackgui/mainwindow.cpp @@ -13,7 +13,7 @@ using namespace BlackMisc::Aviation; using namespace BlackMisc::PhysicalQuantities; using namespace BlackMisc::Geo; using namespace BlackMisc::Settings; -using namespace BlackMisc::Voice; +using namespace BlackMisc::Audio; /* * Constructor diff --git a/samples/blackgui/mainwindow_aircraft.cpp b/samples/blackgui/mainwindow_aircraft.cpp index 94583e4b8..14e92ce25 100644 --- a/samples/blackgui/mainwindow_aircraft.cpp +++ b/samples/blackgui/mainwindow_aircraft.cpp @@ -12,7 +12,7 @@ using namespace BlackMisc::Aviation; using namespace BlackMisc::PhysicalQuantities; using namespace BlackMisc::Geo; using namespace BlackMisc::Settings; -using namespace BlackMisc::Voice; +using namespace BlackMisc::Audio; /* * Read aircrafts diff --git a/samples/blackgui/mainwindow_cockpit.cpp b/samples/blackgui/mainwindow_cockpit.cpp index e5c0ea4bb..52adc74fb 100644 --- a/samples/blackgui/mainwindow_cockpit.cpp +++ b/samples/blackgui/mainwindow_cockpit.cpp @@ -3,7 +3,7 @@ #include "blackgui/atcstationlistmodel.h" #include "blackcore/dbus_server.h" #include "blackcore/context_network.h" -#include "blackmisc/vvoiceroom.h" +#include "blackmisc/voiceroom.h" using namespace BlackCore; using namespace BlackMisc; @@ -14,7 +14,7 @@ using namespace BlackMisc::PhysicalQuantities; using namespace BlackMisc::Geo; using namespace BlackMisc::Settings; using namespace BlackMisc::Math; -using namespace BlackMisc::Voice; +using namespace BlackMisc::Audio; /* * Cockpit values diff --git a/samples/blackgui/mainwindow_textmessages.cpp b/samples/blackgui/mainwindow_textmessages.cpp index a022b41c0..631c5bbf4 100644 --- a/samples/blackgui/mainwindow_textmessages.cpp +++ b/samples/blackgui/mainwindow_textmessages.cpp @@ -10,7 +10,7 @@ using namespace BlackMisc::Aviation; using namespace BlackMisc::PhysicalQuantities; using namespace BlackMisc::Geo; using namespace BlackMisc::Settings; -using namespace BlackMisc::Voice; +using namespace BlackMisc::Audio; /* * Text messages received or send, append to GUI diff --git a/samples/blackgui/mainwindow_voice.cpp b/samples/blackgui/mainwindow_voice.cpp index f56fa862d..0451e5e14 100644 --- a/samples/blackgui/mainwindow_voice.cpp +++ b/samples/blackgui/mainwindow_voice.cpp @@ -11,7 +11,7 @@ using namespace BlackMisc; using namespace BlackGui; using namespace BlackSound; using namespace BlackMisc::Network; -using namespace BlackMisc::Voice; +using namespace BlackMisc::Audio; using namespace BlackMisc::Aviation; using namespace BlackMisc::PhysicalQuantities; using namespace BlackMisc::Geo; diff --git a/samples/voiceclient/client.cpp b/samples/voiceclient/client.cpp index 1bfdab9cc..adf5f6751 100644 --- a/samples/voiceclient/client.cpp +++ b/samples/voiceclient/client.cpp @@ -4,10 +4,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "client.h" -#include "blackmisc/vaudiodevicelist.h" +#include "blackmisc/audiodevicelist.h" #include "blackmisc/avcallsignlist.h" -using namespace BlackMisc::Voice; +using namespace BlackMisc::Audio; using namespace BlackMisc::Aviation; @@ -120,7 +120,7 @@ void Client::initiateConnectionCmd(QTextStream &args) QString channel; args >> hostname >> channel; std::cout << "Joining voice room: " << hostname.toStdString() << "/" << channel.toStdString() << std::endl; - m_voiceClient->joinVoiceRoom(BlackCore::IVoice::COM1, BlackMisc::Voice::CVoiceRoom(hostname, channel)); + m_voiceClient->joinVoiceRoom(BlackCore::IVoice::COM1, BlackMisc::Audio::CVoiceRoom(hostname, channel)); printLinePrefix(); } @@ -133,7 +133,7 @@ void Client::terminateConnectionCmd(QTextStream & /** args **/) void Client::inputDevicesCmd(QTextStream & /** args **/) { - foreach(BlackMisc::Voice::CAudioDevice device, this->m_voiceClient->audioDevices().getInputDevices()) + foreach(BlackMisc::Audio::CAudioDevice device, this->m_voiceClient->audioDevices().getInputDevices()) { std::cout << device.getName().toStdString() << std::endl; } @@ -145,7 +145,7 @@ void Client::inputDevicesCmd(QTextStream & /** args **/) */ void Client::outputDevicesCmd(QTextStream & /** args **/) { - foreach(BlackMisc::Voice::CAudioDevice device, this->m_voiceClient->audioDevices().getOutputDevices()) + foreach(BlackMisc::Audio::CAudioDevice device, this->m_voiceClient->audioDevices().getOutputDevices()) { std::cout << device.getName().toStdString() << std::endl; } diff --git a/samples/voiceclient/main.cpp b/samples/voiceclient/main.cpp index a4f14d6b5..0497d47aa 100644 --- a/samples/voiceclient/main.cpp +++ b/samples/voiceclient/main.cpp @@ -11,7 +11,7 @@ #include #include -using namespace BlackMisc::Voice; +using namespace BlackMisc::Audio; int main(int argc, char *argv[]) { diff --git a/src/blackcore/context_network.h b/src/blackcore/context_network.h index 5e09c3127..907b0d5a4 100644 --- a/src/blackcore/context_network.h +++ b/src/blackcore/context_network.h @@ -121,7 +121,7 @@ namespace BlackCore virtual BlackMisc::Aviation::CInformationMessage getMetar(const QString &airportIcaoCode) override; //! \copydoc IContextNetwork::getSelectedVoiceRooms() - virtual BlackMisc::Voice::CVoiceRoomList getSelectedVoiceRooms() const override; + virtual BlackMisc::Audio::CVoiceRoomList getSelectedVoiceRooms() const override; //! \copydoc IContextNetwork::getSelectedAtcStations virtual BlackMisc::Aviation::CAtcStationList getSelectedAtcStations() const override; diff --git a/src/blackcore/context_network_atc.cpp b/src/blackcore/context_network_atc.cpp index 3cbdcca26..6f0812ad4 100644 --- a/src/blackcore/context_network_atc.cpp +++ b/src/blackcore/context_network_atc.cpp @@ -20,7 +20,7 @@ using namespace BlackMisc::PhysicalQuantities; using namespace BlackMisc::Aviation; using namespace BlackMisc::Network; using namespace BlackMisc::Geo; -using namespace BlackMisc::Voice; +using namespace BlackMisc::Audio; namespace BlackCore { diff --git a/src/blackcore/context_network_interface.cpp b/src/blackcore/context_network_interface.cpp index 7a74287e9..42c603647 100644 --- a/src/blackcore/context_network_interface.cpp +++ b/src/blackcore/context_network_interface.cpp @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "blackcore/context_network_interface.h" -#include "blackmisc/vvoiceroomlist.h" +#include "blackmisc/voiceroomlist.h" #include #include #include @@ -91,9 +91,9 @@ namespace BlackCore return this->m_dBusInterface->callDBusRet(QLatin1Literal("getUsersForCallsigns"), callsigns); } - BlackMisc::Voice::CVoiceRoomList IContextNetwork::getSelectedVoiceRooms() const + BlackMisc::Audio::CVoiceRoomList IContextNetwork::getSelectedVoiceRooms() const { - return this->m_dBusInterface->callDBusRet(QLatin1Literal("getSelectedVoiceRooms")); + return this->m_dBusInterface->callDBusRet(QLatin1Literal("getSelectedVoiceRooms")); } BlackMisc::Aviation::CAtcStationList IContextNetwork::getSelectedAtcStations() const diff --git a/src/blackcore/context_network_interface.h b/src/blackcore/context_network_interface.h index 32c00e877..33a78aff4 100644 --- a/src/blackcore/context_network_interface.h +++ b/src/blackcore/context_network_interface.h @@ -13,7 +13,7 @@ #include "blackmisc/nwuserlist.h" #include "blackmisc/genericdbusinterface.h" #include "blackcore/network_vatlib.h" -#include "blackmisc/vvoiceroomlist.h" +#include "blackmisc/voiceroomlist.h" #include #include #include @@ -188,7 +188,7 @@ namespace BlackCore virtual BlackMisc::Aviation::CInformationMessage getMetar(const QString &airportIcaoCode); //! \brief Use the selected COM1/2 frequencies, and get the corresponding voice room for it - virtual BlackMisc::Voice::CVoiceRoomList getSelectedVoiceRooms() const; + virtual BlackMisc::Audio::CVoiceRoomList getSelectedVoiceRooms() const; //! \brief Use the selected COM1/2 frequencies, and get the corresponding ATC stations for it virtual BlackMisc::Aviation::CAtcStationList getSelectedAtcStations() const; diff --git a/src/blackcore/context_voice.cpp b/src/blackcore/context_voice.cpp index 7be46710d..c6ccda114 100644 --- a/src/blackcore/context_voice.cpp +++ b/src/blackcore/context_voice.cpp @@ -10,7 +10,7 @@ using namespace BlackMisc; using namespace BlackMisc::Aviation; -using namespace BlackMisc::Voice; +using namespace BlackMisc::Audio; namespace BlackCore { diff --git a/src/blackcore/context_voice.h b/src/blackcore/context_voice.h index 8446e1e6d..3fa674514 100644 --- a/src/blackcore/context_voice.h +++ b/src/blackcore/context_voice.h @@ -67,19 +67,19 @@ namespace BlackCore virtual void setOwnAircraft(const BlackMisc::Aviation::CAircraft &ownAircraft) override; //! \copydoc IContextVoice::getComVoiceRooms() - virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const override; + virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRooms() const override; //! \copydoc IContextVoice::getComVoiceRoomsWithAudioStatus() - virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const override; + virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const override; //! \copydoc IContextVoice::getCom1VoiceRoom - virtual BlackMisc::Voice::CVoiceRoom getCom1VoiceRoom(bool withAudioStatus) const override; + virtual BlackMisc::Audio::CVoiceRoom getCom1VoiceRoom(bool withAudioStatus) const override; //! \copydoc IContextVoice::getCom2VoiceRoom - virtual BlackMisc::Voice::CVoiceRoom getCom2VoiceRoom(bool withAudioStatus) const override; + virtual BlackMisc::Audio::CVoiceRoom getCom2VoiceRoom(bool withAudioStatus) const override; //! \copydoc IContextVoice::setComVoiceRooms() - virtual void setComVoiceRooms(const BlackMisc::Voice::CVoiceRoom &voiceRoomCom1, const BlackMisc::Voice::CVoiceRoom &voiceRoomCom2) override; + virtual void setComVoiceRooms(const BlackMisc::Audio::CVoiceRoom &voiceRoomCom1, const BlackMisc::Audio::CVoiceRoom &voiceRoomCom2) override; //! \copydoc IContextVoice::getCom1RoomCallsigns() virtual BlackMisc::Aviation::CCallsignList getCom1RoomCallsigns() const override; @@ -97,13 +97,13 @@ namespace BlackCore virtual void leaveAllVoiceRooms() override; //! \copydoc IContextVoice::getAudioDevices() - virtual BlackMisc::Voice::CAudioDeviceList getAudioDevices() const override; + virtual BlackMisc::Audio::CAudioDeviceList getAudioDevices() const override; //! \copydoc IContextVoice::getCurrentAudioDevices() - virtual BlackMisc::Voice::CAudioDeviceList getCurrentAudioDevices() const override; + virtual BlackMisc::Audio::CAudioDeviceList getCurrentAudioDevices() const override; //! \copydoc IContextVoice::setCurrentAudioDevice() - virtual void setCurrentAudioDevice(const BlackMisc::Voice::CAudioDevice &audioDevice) override; + virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDevice &audioDevice) override; //! \copydoc IContextVoice::setVolumes() virtual void setVolumes(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2) override; diff --git a/src/blackcore/context_voice_interface.cpp b/src/blackcore/context_voice_interface.cpp index f31b745db..8c7c2930d 100644 --- a/src/blackcore/context_voice_interface.cpp +++ b/src/blackcore/context_voice_interface.cpp @@ -7,7 +7,7 @@ #include #include -using namespace BlackMisc::Voice; +using namespace BlackMisc::Audio; using namespace BlackMisc::Network; using namespace BlackMisc::Aviation; @@ -91,7 +91,7 @@ namespace BlackCore /* * Get current audio devices */ - BlackMisc::Voice::CAudioDeviceList IContextVoice::getCurrentAudioDevices() const + BlackMisc::Audio::CAudioDeviceList IContextVoice::getCurrentAudioDevices() const { return this->m_dBusInterface->callDBusRet(QLatin1Literal("getCurrentAudioDevices")); } @@ -139,7 +139,7 @@ namespace BlackCore /* * Set voice rooms */ - void IContextVoice::setComVoiceRooms(const BlackMisc::Voice::CVoiceRoom &voiceRoomCom1, const BlackMisc::Voice::CVoiceRoom &voiceRoomCom2) + void IContextVoice::setComVoiceRooms(const BlackMisc::Audio::CVoiceRoom &voiceRoomCom1, const BlackMisc::Audio::CVoiceRoom &voiceRoomCom2) { this->m_dBusInterface->callDBus(QLatin1Literal("setComVoiceRooms"), voiceRoomCom1, voiceRoomCom2); } diff --git a/src/blackcore/context_voice_interface.h b/src/blackcore/context_voice_interface.h index ddb53f6ea..77693d29f 100644 --- a/src/blackcore/context_voice_interface.h +++ b/src/blackcore/context_voice_interface.h @@ -7,8 +7,8 @@ #define BLACKCORE_CONTEXTVOICE_INTERFACE_H #include "blackmisc/genericdbusinterface.h" -#include "blackmisc/vaudiodevicelist.h" -#include "blackmisc/vvoiceroomlist.h" +#include "blackmisc/audiodevicelist.h" +#include "blackmisc/voiceroomlist.h" #include "blackmisc/nwuserlist.h" #include "blackmisc/avaircraft.h" #include "blackcore/voice_vatlib.h" @@ -112,32 +112,32 @@ namespace BlackCore * Get voice rooms for COM1, COM2: * From this connection audio status can be obtained */ - virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const; + virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const; /*! * Get voice rooms for COM1, COM2, but without latest audio status * \return all voice rooms */ - virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const; + virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRooms() const; /*! * \brief COM 1 voice room * \param withAudioStatus update audio status * \return */ - virtual BlackMisc::Voice::CVoiceRoom getCom1VoiceRoom(bool withAudioStatus) const; + virtual BlackMisc::Audio::CVoiceRoom getCom1VoiceRoom(bool withAudioStatus) const; /*! * \brief COM 2 voice room * \param withAudioStatus update audio status * \return */ - virtual BlackMisc::Voice::CVoiceRoom getCom2VoiceRoom(bool withAudioStatus) const; + virtual BlackMisc::Audio::CVoiceRoom getCom2VoiceRoom(bool withAudioStatus) const; /*! * \brief Set voice rooms */ - virtual void setComVoiceRooms(const BlackMisc::Voice::CVoiceRoom &voiceRoomCom1, const BlackMisc::Voice::CVoiceRoom &voiceRoomCom2); + virtual void setComVoiceRooms(const BlackMisc::Audio::CVoiceRoom &voiceRoomCom1, const BlackMisc::Audio::CVoiceRoom &voiceRoomCom2); /*! * Leave all voice rooms @@ -167,19 +167,19 @@ namespace BlackCore /*! * \brief Audio devices */ - virtual BlackMisc::Voice::CAudioDeviceList getAudioDevices() const; + virtual BlackMisc::Audio::CAudioDeviceList getAudioDevices() const; /*! * \brief Get current audio device * \return input and output devices */ - virtual BlackMisc::Voice::CAudioDeviceList getCurrentAudioDevices() const; + virtual BlackMisc::Audio::CAudioDeviceList getCurrentAudioDevices() const; /*! * \brief Set current audio device * \param audioDevice can be input or audio device */ - virtual void setCurrentAudioDevice(const BlackMisc::Voice::CAudioDevice &audioDevice); + virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDevice &audioDevice); /*! * \brief Set volumes via com units, also allows to mute diff --git a/src/blackcore/voice.h b/src/blackcore/voice.h index 1828b24f2..b6c8baa0c 100644 --- a/src/blackcore/voice.h +++ b/src/blackcore/voice.h @@ -10,8 +10,8 @@ #include "../blackmisc/avcallsignlist.h" #include "../blackmisc/avselcal.h" #include "../blackmisc/nwuserlist.h" -#include "../blackmisc/vvoiceroomlist.h" -#include "../blackmisc/vaudiodevicelist.h" +#include "../blackmisc/voiceroomlist.h" +#include "../blackmisc/audiodevicelist.h" #include #include #include @@ -81,19 +81,19 @@ namespace BlackCore * \brief Audio devices * \return */ - virtual const BlackMisc::Voice::CAudioDeviceList &audioDevices() const = 0; + virtual const BlackMisc::Audio::CAudioDeviceList &audioDevices() const = 0; /*! * \brief Default input device * \return */ - virtual const BlackMisc::Voice::CAudioDevice defaultAudioInputDevice() const = 0; + virtual const BlackMisc::Audio::CAudioDevice defaultAudioInputDevice() const = 0; /*! * \brief Default output device * \return */ - virtual const BlackMisc::Voice::CAudioDevice defaultAudioOutputDevice() const = 0; + virtual const BlackMisc::Audio::CAudioDevice defaultAudioOutputDevice() const = 0; /************************************************ * SETUP TESTS @@ -132,40 +132,40 @@ namespace BlackCore /*! * \brief Current input device */ - virtual BlackMisc::Voice::CAudioDevice getCurrentInputDevice() const = 0; + virtual BlackMisc::Audio::CAudioDevice getCurrentInputDevice() const = 0; /*! * \brief Current output device */ - virtual BlackMisc::Voice::CAudioDevice getCurrentOutputDevice() const = 0; + virtual BlackMisc::Audio::CAudioDevice getCurrentOutputDevice() const = 0; /*! * \brief Output device to be used */ - virtual void setOutputDevice(const BlackMisc::Voice::CAudioDevice &device) = 0; + virtual void setOutputDevice(const BlackMisc::Audio::CAudioDevice &device) = 0; /*! * \brief Input device to be used */ - virtual void setInputDevice(const BlackMisc::Voice::CAudioDevice &device) = 0; + virtual void setInputDevice(const BlackMisc::Audio::CAudioDevice &device) = 0; /*! * Get COM1/2 voice rooms, which then allows to retrieve information * such as audio status etc. */ - virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const = 0; + virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const = 0; /*! * Get COM1/2 voice rooms, const and with no status update */ - virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const = 0; + virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRooms() const = 0; /*! * \brief Join voice room * \param comUnit COM1/2 * \param voiceRoom */ - virtual void joinVoiceRoom(const ComUnit comUnit, const BlackMisc::Voice::CVoiceRoom &voiceRoom) = 0; + virtual void joinVoiceRoom(const ComUnit comUnit, const BlackMisc::Audio::CVoiceRoom &voiceRoom) = 0; /*! * \brief Leave voice room diff --git a/src/blackcore/voice_vatlib.cpp b/src/blackcore/voice_vatlib.cpp index ec0788875..16773d7ea 100644 --- a/src/blackcore/voice_vatlib.cpp +++ b/src/blackcore/voice_vatlib.cpp @@ -7,7 +7,7 @@ #include #include -using namespace BlackMisc::Voice; +using namespace BlackMisc::Audio; using namespace BlackMisc::Aviation; namespace BlackCore @@ -67,7 +67,7 @@ namespace BlackCore /* * Devices */ - const BlackMisc::Voice::CAudioDeviceList &CVoiceVatlib::audioDevices() const + const BlackMisc::Audio::CAudioDeviceList &CVoiceVatlib::audioDevices() const { return m_devices; } @@ -75,19 +75,19 @@ namespace BlackCore /* * Default input device */ - const BlackMisc::Voice::CAudioDevice CVoiceVatlib::defaultAudioInputDevice() const + const BlackMisc::Audio::CAudioDevice CVoiceVatlib::defaultAudioInputDevice() const { // Constructor creates already a default device - return BlackMisc::Voice::CAudioDevice(BlackMisc::Voice::CAudioDevice::InputDevice, BlackMisc::Voice::CAudioDevice::defaultDeviceIndex(), "default"); + return BlackMisc::Audio::CAudioDevice(BlackMisc::Audio::CAudioDevice::InputDevice, BlackMisc::Audio::CAudioDevice::defaultDeviceIndex(), "default"); } /* * Default output device */ - const BlackMisc::Voice::CAudioDevice CVoiceVatlib::defaultAudioOutputDevice() const + const BlackMisc::Audio::CAudioDevice CVoiceVatlib::defaultAudioOutputDevice() const { // Constructor creates already a default device - return BlackMisc::Voice::CAudioDevice(BlackMisc::Voice::CAudioDevice::OutputDevice, BlackMisc::Voice::CAudioDevice::defaultDeviceIndex(), "default"); + return BlackMisc::Audio::CAudioDevice(BlackMisc::Audio::CAudioDevice::OutputDevice, BlackMisc::Audio::CAudioDevice::defaultDeviceIndex(), "default"); } /* @@ -109,7 +109,7 @@ namespace BlackCore /* * Set input device */ - void CVoiceVatlib::setInputDevice(const BlackMisc::Voice::CAudioDevice &device) + void CVoiceVatlib::setInputDevice(const BlackMisc::Audio::CAudioDevice &device) { Q_ASSERT_X(m_voice->IsValid() && m_voice->IsSetup(), "CVoiceVatlib", "Cvatlib_Voice_Simple invalid or not setup!"); if (!device.isValid()) @@ -139,7 +139,7 @@ namespace BlackCore /* * Set output device */ - void CVoiceVatlib::setOutputDevice(const BlackMisc::Voice::CAudioDevice &device) + void CVoiceVatlib::setOutputDevice(const BlackMisc::Audio::CAudioDevice &device) { Q_ASSERT_X(m_voice->IsValid() && m_voice->IsSetup(), "CVoiceVatlib", "Cvatlib_Voice_Simple invalid or not setup!"); if (!device.isValid()) @@ -167,7 +167,7 @@ namespace BlackCore /* * Get voice rooms, with the latest status updated */ - BlackMisc::Voice::CVoiceRoomList CVoiceVatlib::getComVoiceRoomsWithAudioStatus() const + BlackMisc::Audio::CVoiceRoomList CVoiceVatlib::getComVoiceRoomsWithAudioStatus() const { Q_ASSERT_X(m_voiceRooms.size() == 2, "CVoiceVatlib", "Wrong numer of COM voice rooms"); CVoiceRoomList voiceRooms; @@ -317,7 +317,7 @@ namespace BlackCore /* * Voice room */ - void CVoiceVatlib::joinVoiceRoom(const ComUnit comUnit, const BlackMisc::Voice::CVoiceRoom &voiceRoom) + void CVoiceVatlib::joinVoiceRoom(const ComUnit comUnit, const BlackMisc::Audio::CVoiceRoom &voiceRoom) { Q_ASSERT_X(m_voice->IsValid() && m_voice->IsSetup(), "CVoiceVatlib", "Cvatlib_Voice_Simple invalid or not setup!"); Q_ASSERT_X(m_voice->IsRoomValid(static_cast(comUnit)), "CVoiceVatlib", "Room index out of bounds!"); @@ -641,7 +641,7 @@ namespace BlackCore void CVoiceVatlib::onInputHardwareDeviceReceived(Cvatlib_Voice_Simple *obj, const char *name, void *cbVar) { Q_UNUSED(obj) - BlackMisc::Voice::CAudioDevice inputDevice(BlackMisc::Voice::CAudioDevice::InputDevice, cbvar_cast_voice(cbVar)->m_devices.count(BlackMisc::Voice::CAudioDevice::InputDevice), QString(name)); + BlackMisc::Audio::CAudioDevice inputDevice(BlackMisc::Audio::CAudioDevice::InputDevice, cbvar_cast_voice(cbVar)->m_devices.count(BlackMisc::Audio::CAudioDevice::InputDevice), QString(name)); cbvar_cast_voice(cbVar)->m_devices.push_back(inputDevice); } @@ -651,7 +651,7 @@ namespace BlackCore void CVoiceVatlib::onOutputHardwareDeviceReceived(Cvatlib_Voice_Simple *obj, const char *name, void *cbVar) { Q_UNUSED(obj) - BlackMisc::Voice::CAudioDevice outputDevice(BlackMisc::Voice::CAudioDevice::OutputDevice, cbvar_cast_voice(cbVar)->m_devices.count(BlackMisc::Voice::CAudioDevice::OutputDevice), QString(name)); + BlackMisc::Audio::CAudioDevice outputDevice(BlackMisc::Audio::CAudioDevice::OutputDevice, cbvar_cast_voice(cbVar)->m_devices.count(BlackMisc::Audio::CAudioDevice::OutputDevice), QString(name)); cbvar_cast_voice(cbVar)->m_devices.push_back(outputDevice); } diff --git a/src/blackcore/voice_vatlib.h b/src/blackcore/voice_vatlib.h index 1383321a3..78d0cf2d3 100644 --- a/src/blackcore/voice_vatlib.h +++ b/src/blackcore/voice_vatlib.h @@ -8,7 +8,7 @@ #include "voice.h" #include "../blacksound/soundgenerator.h" -#include "../blackmisc/vaudiodevicelist.h" +#include "../blackmisc/audiodevicelist.h" #include "../blackmisc/nwuserlist.h" #include "../blackmisc/avcallsignlist.h" @@ -49,13 +49,13 @@ namespace BlackCore // and ATC to headspeakers. Is not important to implement that now, if ever. //! \copydoc IVoice::audioDevices() - virtual const BlackMisc::Voice::CAudioDeviceList &audioDevices() const override; + virtual const BlackMisc::Audio::CAudioDeviceList &audioDevices() const override; //! \copydoc IVoice::defaultAudioInputDevice() - virtual const BlackMisc::Voice::CAudioDevice defaultAudioInputDevice() const override; + virtual const BlackMisc::Audio::CAudioDevice defaultAudioInputDevice() const override; //! \copydoc IVoice::defaultAudioOutputDevice() - virtual const BlackMisc::Voice::CAudioDevice defaultAudioOutputDevice() const override; + virtual const BlackMisc::Audio::CAudioDevice defaultAudioOutputDevice() const override; /************************************************ * SETUP TESTS @@ -81,7 +81,7 @@ namespace BlackCore virtual void setMyAircraftCallsign(const BlackMisc::Aviation::CCallsign &callsign) override; //! \copydoc IVoice::joinVoiceRoom() - virtual void joinVoiceRoom(const ComUnit comUnit, const BlackMisc::Voice::CVoiceRoom &voiceRoom) override; + virtual void joinVoiceRoom(const ComUnit comUnit, const BlackMisc::Audio::CVoiceRoom &voiceRoom) override; //! \copydoc IVoice::leaveVoiceRoom() virtual void leaveVoiceRoom(const ComUnit comUnit) override; @@ -99,10 +99,10 @@ namespace BlackCore virtual void stopTransmitting(const ComUnit comUnit) override; //! \copydoc IVoice::getComVoiceRoomsWithAudioStatus() - virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const override; + virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const override; //! \copydoc IVoice::getComVoiceRooms() - virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const override + virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRooms() const override { return this->m_voiceRooms; } @@ -111,16 +111,16 @@ namespace BlackCore virtual BlackMisc::Aviation::CCallsignList getVoiceRoomCallsigns(const ComUnit comUnit) const override; //! \copydoc IVoice::setInputDevice - virtual void setInputDevice(const BlackMisc::Voice::CAudioDevice &device) override; + virtual void setInputDevice(const BlackMisc::Audio::CAudioDevice &device) override; //! \copydoc IVoice::setOutputDevice - virtual void setOutputDevice(const BlackMisc::Voice::CAudioDevice &device) override; + virtual void setOutputDevice(const BlackMisc::Audio::CAudioDevice &device) override; //! \copydoc IVoice::getCurrentInputDevice() - virtual BlackMisc::Voice::CAudioDevice getCurrentInputDevice() const override; + virtual BlackMisc::Audio::CAudioDevice getCurrentInputDevice() const override; //! \copydoc IVoice::getCurrentOutputDevice() - virtual BlackMisc::Voice::CAudioDevice getCurrentOutputDevice() const override; + virtual BlackMisc::Audio::CAudioDevice getCurrentOutputDevice() const override; //! \copydoc IVoice::switchAudioOutput virtual void switchAudioOutput(const ComUnit comUnit, bool enable) override; @@ -189,8 +189,8 @@ namespace BlackCore static void onInputHardwareDeviceReceived(Cvatlib_Voice_Simple *obj, const char *name, void *cbVar); static void onOutputHardwareDeviceReceived(Cvatlib_Voice_Simple *obj, const char *name, void *cbVar); - BlackMisc::Voice::CVoiceRoom voiceRoomForUnit(const ComUnit comUnit) const; - void setVoiceRoomForUnit(const IVoice::ComUnit comUnit, const BlackMisc::Voice::CVoiceRoom &voiceRoom); + BlackMisc::Audio::CVoiceRoom voiceRoomForUnit(const ComUnit comUnit) const; + void setVoiceRoomForUnit(const IVoice::ComUnit comUnit, const BlackMisc::Audio::CVoiceRoom &voiceRoom); void addTemporaryCallsignForRoom(const ComUnit comUnit, const BlackMisc::Aviation::CCallsign &callsign); void removeUserFromRoom(const ComUnit comUnit, const QString &callsign); void exceptionDispatcher(const char *caller); @@ -279,10 +279,10 @@ namespace BlackCore QScopedPointer m_voice; QScopedPointer m_audioOutput; BlackMisc::Aviation::CCallsign m_aircraftCallsign; /*!< own callsign to join voice rooms */ - BlackMisc::Voice::CVoiceRoomList m_voiceRooms; - BlackMisc::Voice::CAudioDeviceList m_devices; /*!< in and output devices */ - BlackMisc::Voice::CAudioDevice m_currentOutputDevice; - BlackMisc::Voice::CAudioDevice m_currentInputDevice; + BlackMisc::Audio::CVoiceRoomList m_voiceRooms; + BlackMisc::Audio::CAudioDeviceList m_devices; /*!< in and output devices */ + BlackMisc::Audio::CAudioDevice m_currentOutputDevice; + BlackMisc::Audio::CAudioDevice m_currentInputDevice; QScopedPointer m_keyboardPtt; /*!< handler for PTT */ bool m_pushToTalk; /*!< flag, PTT pressed */ float m_inputSquelch; diff --git a/src/blackcore/voice_vatlib_ptt.cpp b/src/blackcore/voice_vatlib_ptt.cpp index 9eb883081..ae03ac9ed 100644 --- a/src/blackcore/voice_vatlib_ptt.cpp +++ b/src/blackcore/voice_vatlib_ptt.cpp @@ -6,7 +6,7 @@ #include "voice_vatlib.h" #include -using namespace BlackMisc::Voice; +using namespace BlackMisc::Audio; namespace BlackCore { diff --git a/src/blackmisc/voiceallclasses.h b/src/blackmisc/audioallclasses.h similarity index 70% rename from src/blackmisc/voiceallclasses.h rename to src/blackmisc/audioallclasses.h index 4fae9ff83..e1e07c9d9 100644 --- a/src/blackmisc/voiceallclasses.h +++ b/src/blackmisc/audioallclasses.h @@ -6,9 +6,9 @@ #ifndef BLACKMISC_VOICEALLCLASSES_H #define BLACKMISC_VOICEALLCLASSES_H -#include "blackmisc/vaudiodevice.h" -#include "blackmisc/vaudiodevicelist.h" -#include "blackmisc/vvoiceroom.h" -#include "blackmisc/vvoiceroomlist.h" +#include "blackmisc/audiodevice.h" +#include "blackmisc/audiodevicelist.h" +#include "blackmisc/voiceroom.h" +#include "blackmisc/voiceroomlist.h" #endif // guard diff --git a/src/blackmisc/vaudiodevicelist.cpp b/src/blackmisc/audiodevicelist.cpp similarity index 97% rename from src/blackmisc/vaudiodevicelist.cpp rename to src/blackmisc/audiodevicelist.cpp index 9e699d069..b1ccaa7cc 100644 --- a/src/blackmisc/vaudiodevicelist.cpp +++ b/src/blackmisc/audiodevicelist.cpp @@ -3,12 +3,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "vaudiodevicelist.h" +#include "audiodevicelist.h" #include "predicates.h" namespace BlackMisc { - namespace Voice + namespace Audio { /* * Default constructor diff --git a/src/blackmisc/vaudiodevicelist.h b/src/blackmisc/audiodevicelist.h similarity index 89% rename from src/blackmisc/vaudiodevicelist.h rename to src/blackmisc/audiodevicelist.h index 0c0045bcf..1fe814ba0 100644 --- a/src/blackmisc/vaudiodevicelist.h +++ b/src/blackmisc/audiodevicelist.h @@ -10,7 +10,7 @@ #ifndef BLACKMISC_AUDIODEVICELIST_H #define BLACKMISC_AUDIODEVICELIST_H -#include "vaudiodevice.h" +#include "audiodevice.h" #include "sequence.h" #include "collection.h" #include @@ -19,7 +19,7 @@ namespace BlackMisc { - namespace Voice + namespace Audio { /*! * Value object encapsulating a list of audio devices. @@ -76,8 +76,8 @@ namespace BlackMisc } //namespace } // namespace -Q_DECLARE_METATYPE(BlackMisc::Voice::CAudioDeviceList) -Q_DECLARE_METATYPE(BlackMisc::CCollection) -Q_DECLARE_METATYPE(BlackMisc::CSequence) +Q_DECLARE_METATYPE(BlackMisc::Audio::CAudioDeviceList) +Q_DECLARE_METATYPE(BlackMisc::CCollection) +Q_DECLARE_METATYPE(BlackMisc::CSequence) #endif //guard diff --git a/src/blackmisc/blackmiscallvalueclasses.h b/src/blackmisc/blackmiscallvalueclasses.h index 13498b830..1f4c83325 100644 --- a/src/blackmisc/blackmiscallvalueclasses.h +++ b/src/blackmisc/blackmiscallvalueclasses.h @@ -14,6 +14,6 @@ #include "blackmisc/networkallclasses.h" #include "blackmisc/statusmessagelist.h" #include "blackmisc/statusmessage.h" -#include "blackmisc/voiceallclasses.h" +#include "blackmisc/audioallclasses.h" #endif // guard diff --git a/src/blackmisc/blackmiscfreefunctions.cpp b/src/blackmisc/blackmiscfreefunctions.cpp index cbd9771b3..0905e08d3 100644 --- a/src/blackmisc/blackmiscfreefunctions.cpp +++ b/src/blackmisc/blackmiscfreefunctions.cpp @@ -13,7 +13,7 @@ #include "hwallclasses.h" #include "valuemap.h" #include "statusmessagelist.h" -#include "voiceallclasses.h" +#include "audioallclasses.h" /* * Metadata for PQs @@ -103,7 +103,7 @@ void BlackMisc::Settings::registerMetadata() /* * Metadata for Voice */ -void BlackMisc::Voice::registerMetadata() +void BlackMisc::Audio::registerMetadata() { CAudioDevice::registerMetadata(); CAudioDeviceList::registerMetadata(); @@ -139,7 +139,7 @@ void BlackMisc::registerMetadata() Geo::registerMetadata(); Network::registerMetadata(); Settings::registerMetadata(); - Voice::registerMetadata(); + Audio::registerMetadata(); Hardware::registerMetadata(); } diff --git a/src/blackmisc/blackmiscfreefunctions.h b/src/blackmisc/blackmiscfreefunctions.h index aee6656ce..45f568661 100644 --- a/src/blackmisc/blackmiscfreefunctions.h +++ b/src/blackmisc/blackmiscfreefunctions.h @@ -87,10 +87,10 @@ namespace BlackMisc void registerMetadata(); } - namespace Voice + namespace Audio { /*! - * \brief Register metadata for voice + * \brief Register metadata for audio / voice */ void registerMetadata(); } diff --git a/src/blackmisc/vaudiodevice.cpp b/src/blackmisc/vaudiodevice.cpp deleted file mode 100644 index ada682c6c..000000000 --- a/src/blackmisc/vaudiodevice.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* Copyright (C) 2013 VATSIM Community / authors - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/*! - \file -*/ - -#include "vaudiodevice.h" -#include "blackmisc/blackmiscfreefunctions.h" -#include -#include - -namespace BlackMisc -{ - namespace Voice - { - /* - * Constructor - */ - CAudioDevice::CAudioDevice() : - m_type(Unknown), m_deviceIndex(invalidDeviceIndex()), - m_deviceName(""), m_hostName(CAudioDevice::hostName()) - { - // void - } - - /* - * Constructor - */ - CAudioDevice::CAudioDevice(DeviceType type, const qint16 index, const QString &name) : - m_type(type), m_deviceIndex(index), - m_deviceName(name), m_hostName(CAudioDevice::hostName()) - { - // void - } - - /* - * Host name - */ - QString CAudioDevice::hostName() - { - QHostInfo hostInfo = QHostInfo::fromName(QHostInfo::localHostName()); - return hostInfo.localHostName(); - } - - /* - * Same device? - */ - bool CAudioDevice::operator ==(const CAudioDevice &other) const - { - if (&other == this) return true; - if (m_deviceIndex == other.m_deviceIndex && m_type == other.m_type) return true; - - // otherwise - return false; - } - - /* - * Unequal? - */ - bool CAudioDevice::operator !=(const CAudioDevice &other) const - { - return !((*this) == other); - } - - /* - * Hash - */ - uint CAudioDevice::getValueHash() const - { - QList hashs; - hashs << qHash(static_cast(m_type)); - hashs << qHash(m_deviceIndex); - hashs << qHash(m_deviceName); - hashs << qHash(m_hostName); - return BlackMisc::calculateHash(hashs, "CAudioDevice"); - } - - /* - * As String - */ - QString CAudioDevice::convertToQString(bool /* i18n */) const - { - if (this->m_hostName.isEmpty()) return m_deviceName; - QString s(this->m_deviceName); - s.append(" ["); - s.append(this->hostName()); - s.append("]"); - return s; - } - - /* - * metaTypeId - */ - int CAudioDevice::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CAudioDevice::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - - return this->CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CAudioDevice::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - - const auto lhs = std::tie(this->m_type, this->m_deviceIndex, this->m_deviceName, this->m_hostName); - const auto rhs = std::tie(other.m_type, other.m_deviceIndex, other.m_deviceName, other.m_hostName); - - if (lhs < rhs) { return -1; } - if (lhs > rhs) { return 1; } - return 0; - } - - /* - * Marshall to DBus - */ - void CAudioDevice::marshallToDbus(QDBusArgument &argument) const - { - argument << static_cast(m_type); - argument << m_deviceIndex; - argument << m_deviceName; - argument << m_hostName; - } - - /* - * Unmarshall from DBus - */ - void CAudioDevice::unmarshallFromDbus(const QDBusArgument &argument) - { - uint t; - argument >> t; - this->m_type = static_cast(t); - argument >> m_deviceIndex; - argument >> m_deviceName; - argument >> m_hostName; - } - - /* - * Register - */ - void CAudioDevice::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - } // Voice -} // BlackMisc diff --git a/src/blackmisc/vaudiodevice.h b/src/blackmisc/vaudiodevice.h deleted file mode 100644 index 3fbf5a5a7..000000000 --- a/src/blackmisc/vaudiodevice.h +++ /dev/null @@ -1,163 +0,0 @@ -/* Copyright (C) 2013 VATSIM Community / authors - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef BLACKMISC_AUDIODEVICE_H -#define BLACKMISC_AUDIODEVICE_H - -/*! - \file -*/ - -#include "valueobject.h" -#include - -namespace BlackMisc -{ - namespace Voice - { - /*! - * Value object encapsulating information of a audio device. - * If you want to safe this object, use the name instead of the index, since the index can change after - * a restart. - */ - class CAudioDevice : public BlackMisc::CValueObject - { - public: - - /*! - * \brief Type - */ - enum DeviceType - { - InputDevice, - OutputDevice, - Unknown - }; - - /*! - * Default constructor. - * If m_deviceIndex is -1, default should be used. However on Windows this doesnt work. Needs - * to be checked in Vatlib. - */ - CAudioDevice(); - - /*! - * Constructor. - */ - CAudioDevice(DeviceType type, const qint16 index, const QString &getName); - - /*! - * \copydoc CValueObject::toQVariant - */ - virtual QVariant toQVariant() const override - { - return QVariant::fromValue(*this); - } - - /*! - * Get the device index - * \return - */ - qint16 getIndex() const { return m_deviceIndex; } - - /*! - * Get the device name - * \return - */ - const QString &getName() const { return m_deviceName; } - - /*! - * \brief Type - * \return - */ - DeviceType getType() const { return m_type; } - - //! \brief Valid audio device object? - bool isValid() const { return m_deviceIndex >= -1 && !m_deviceName.isEmpty(); } - - //! \brief Equal operator == - bool operator ==(const CAudioDevice &other) const; - - //! \brief Unequal operator != - bool operator !=(const CAudioDevice &other) const; - - //! \copydoc CValueObject::getValueHash - virtual uint getValueHash() const override; - - //! \brief Register metadata - static void registerMetadata(); - - //! \brief Device index for default device - static qint16 defaultDeviceIndex() {return -1;} - - //! \brief Invalid device index - static qint16 invalidDeviceIndex() {return -2;} - - //! \brief default output device - static CAudioDevice getDefaultOutputDevice() - { - return CAudioDevice(OutputDevice, defaultDeviceIndex(), "default"); - } - - //! \brief default input device - static CAudioDevice getDefaultInputDevice() - { - return CAudioDevice(InputDevice, defaultDeviceIndex(), "default"); - } - - protected: - - //! \copydoc CValueObject::convertToQString - virtual QString convertToQString(bool i18n = false) const override; - - //! \copydoc CValueObject::getMetaTypeId - virtual int getMetaTypeId() const override; - - //! \copydoc CValueObject::isA - virtual bool isA(int metaTypeId) const override; - - //! \copydoc CValueObject::compareImpl - virtual int compareImpl(const CValueObject &other) const override; - - //! \copydoc CValueObject::marshallToDbus() - virtual void marshallToDbus(QDBusArgument &argument) const override; - - //! \copydoc CValueObject::unmarshallFromDbus() - virtual void unmarshallFromDbus(const QDBusArgument &argument) override; - - protected: - /*! - * \brief Device type, @see CAudioDevice::DeviceType - */ - DeviceType m_type; - /*! - * deviceIndex is the number is the reference for the VVL. The device is selected by this index. - * The managing class needs to take care, that indexes are valid. - */ - qint16 m_deviceIndex; - /*! - * \brief Device name - */ - QString m_deviceName; - /*! - * We use a DBus based system. Hence an audio device can reside on a different - * computer, this here is its name - */ - QString m_hostName; - - private: - /*! - * \brief Own host name - * \return - */ - static QString hostName(); - }; - - } // Voice -} // BlackMisc - -Q_DECLARE_METATYPE(BlackMisc::Voice::CAudioDevice) - -#endif // guard diff --git a/src/blackmisc/vvoiceroomlist.cpp b/src/blackmisc/voiceroomlist.cpp similarity index 94% rename from src/blackmisc/vvoiceroomlist.cpp rename to src/blackmisc/voiceroomlist.cpp index 6760ccf3f..f5df787d3 100644 --- a/src/blackmisc/vvoiceroomlist.cpp +++ b/src/blackmisc/voiceroomlist.cpp @@ -3,12 +3,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "vvoiceroomlist.h" +#include "voiceroomlist.h" #include "predicates.h" namespace BlackMisc { - namespace Voice + namespace Audio { /* * Default constructor diff --git a/src/blackmisc/vvoiceroomlist.h b/src/blackmisc/voiceroomlist.h similarity index 85% rename from src/blackmisc/vvoiceroomlist.h rename to src/blackmisc/voiceroomlist.h index 5337ef413..362c789e7 100644 --- a/src/blackmisc/vvoiceroomlist.h +++ b/src/blackmisc/voiceroomlist.h @@ -10,7 +10,7 @@ #ifndef BLACKMISC_VOICEROOMLIST_H #define BLACKMISC_VOICEROOMLIST_H -#include "vvoiceroom.h" +#include "voiceroom.h" #include "sequence.h" #include "collection.h" #include @@ -19,7 +19,7 @@ namespace BlackMisc { - namespace Voice + namespace Audio { /*! * Value object encapsulating a list of voice rooms. @@ -57,8 +57,8 @@ namespace BlackMisc } //namespace } // namespace -Q_DECLARE_METATYPE(BlackMisc::Voice::CVoiceRoomList) -Q_DECLARE_METATYPE(BlackMisc::CCollection) -Q_DECLARE_METATYPE(BlackMisc::CSequence) +Q_DECLARE_METATYPE(BlackMisc::Audio::CVoiceRoomList) +Q_DECLARE_METATYPE(BlackMisc::CCollection) +Q_DECLARE_METATYPE(BlackMisc::CSequence) #endif //guard diff --git a/src/blackmisc/vvoiceroom.cpp b/src/blackmisc/vvoiceroom.cpp deleted file mode 100644 index 7ac54d2ab..000000000 --- a/src/blackmisc/vvoiceroom.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* Copyright (C) 2013 VATSIM Community / authors - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/*! - \file -*/ - -#include "vvoiceroom.h" -#include "blackmisc/blackmiscfreefunctions.h" -#include -#include -#include - -namespace BlackMisc -{ - namespace Voice - { - CVoiceRoom::CVoiceRoom(const QString &serverUrl, bool connected) : - m_connected(connected), m_audioPlaying(false) - { - if (serverUrl.contains("/")) - { - QString url = serverUrl.trimmed().toLower(); - url.replace(CVoiceRoom::protocolComplete(), ""); - url.replace(CVoiceRoom::protocol(), ""); - QStringList splitParts = serverUrl.split("/"); - m_hostname = splitParts.at(0); - m_channel = splitParts.at(1); - } - } - - /* - * Equal? - */ - bool CVoiceRoom::operator ==(const CVoiceRoom &other) const - { - if (&other == this) return true; - return (m_hostname == other.m_hostname && - m_channel == other.m_channel && - m_connected == other.m_connected && - m_audioPlaying == other.m_audioPlaying); - } - - /* - * Unequal? - */ - bool CVoiceRoom::operator !=(const CVoiceRoom &other) const - { - return !((*this) == other); - } - - /* - * Value hash - */ - uint CVoiceRoom::getValueHash() const - { - QList hashs; - hashs << qHash(m_hostname); - hashs << qHash(m_channel); - hashs << qHash(m_connected); - hashs << qHash(m_audioPlaying); - return BlackMisc::calculateHash(hashs, "CVoiceRoom"); - } - - /* - * Metadata - */ - void CVoiceRoom::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * To string - */ - QString CVoiceRoom::convertToQString(bool /* i18n */) const - { - if (!this->isValid()) return "Invalid"; - QString s = this->getVoiceRoomUrl(false); - s.append(this ->isConnected() ? " connected" : " unconnected"); - if (this->m_audioPlaying) s.append(" playing"); - return s; - } - - /* - * metaTypeId - */ - int CVoiceRoom::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CVoiceRoom::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - - return CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CVoiceRoom::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - - const auto lhs = std::tie(m_hostname, m_channel, m_connected, m_audioPlaying); - const auto rhs = std::tie(other.m_hostname, other.m_channel, other.m_connected, other.m_audioPlaying); - - if (lhs < rhs) { return -1; } - if (lhs > rhs) { return 1; } - return 0; - } - - /* - * Marshall to DBus - */ - void CVoiceRoom::marshallToDbus(QDBusArgument &argument) const - { - argument << m_hostname; - argument << m_channel; - argument << m_connected; - argument << m_audioPlaying; - } - - /* - * Unmarshall from DBus - */ - void CVoiceRoom::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> m_hostname; - argument >> m_channel; - argument >> m_connected; - argument >> m_audioPlaying; - } - - /* - * Server URL - */ - QString CVoiceRoom::getVoiceRoomUrl(bool noProtocol) const - { - if (!this->isValid()) return ""; - QString url(noProtocol ? "" : CVoiceRoom::protocolComplete()); - url.append(this->m_hostname); - url.append("/"); - url.append(this->m_channel); - return url; - } - - /* - * ATIS voice channel - */ - bool CVoiceRoom::isAtis() const - { - return (this->m_channel.contains("ATIS", Qt::CaseInsensitive)); - } - } // Voice -} // BlackMisc diff --git a/src/blackmisc/vvoiceroom.h b/src/blackmisc/vvoiceroom.h deleted file mode 100644 index b42f8cffa..000000000 --- a/src/blackmisc/vvoiceroom.h +++ /dev/null @@ -1,187 +0,0 @@ -/* Copyright (C) 2013 VATSIM Community / authors - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/*! - \file -*/ - -#include "valueobject.h" -#include - -#ifndef BLACKMISC_VOICEROOM_H -#define BLACKMISC_VOICEROOM_H - -namespace BlackMisc -{ - namespace Voice - { - /*! - * Value object encapsulating information of a voice room - */ - class CVoiceRoom : public BlackMisc::CValueObject - { - public: - - /*! - * Default constructor. - */ - CVoiceRoom() : - m_connected(false), m_audioPlaying(false) {} - - /*! - * Constructor. - * \param hostname - * \param channel - */ - CVoiceRoom(const QString &hostname, const QString &channel) : - m_hostname(hostname), m_channel(channel), m_connected(false), m_audioPlaying(false) {} - - /*! - * Constructor. - * \param serverUrl - * \param connected - */ - CVoiceRoom(const QString &serverUrl, bool connected = false); - - /*! - * \copydoc CValueObject::toQVariant - */ - virtual QVariant toQVariant() const override - { - return QVariant::fromValue(*this); - } - - /*! - * Get the host name - * \return - */ - const QString &getHostName() const { return m_hostname; } - - /*! - * Get the voice room - */ - const QString &getChannel() const { return m_channel; } - - /*! - * \brief Set the host name - */ - void setHostName(const QString &hostName) { m_hostname = hostName; } - - /*! - * \brief Set the voice channel - */ - void setChannel(const QString &channel) { m_channel = channel; } - - /*! - * \brief Server URL - * \param noProtocol either with (pseudo) protocol prefix or without - * \return - */ - QString getVoiceRoomUrl(bool noProtocol = true) const; - - /*! - * \brief Valid voice room object? - * \return - */ - bool isValid() const { return !this->m_hostname.isEmpty() && !this->m_channel.isEmpty(); } - - /*! - * \brief Is connected - * \return - */ - bool isConnected() const { return this->isValid() && this->m_connected; } - - /*! - * \brief Set connected status - * \param isConnected - */ - void setConnected(bool isConnected) { this->m_connected = isConnected; } - - /*! - * \brief Is audio playing in this room? - * \return - */ - bool isAudioPlaying() const { return this->m_audioPlaying; } - - /*! - * \brief Set audio playing - * \param playing - */ - void setAudioPlaying(bool playing) { this->m_audioPlaying = playing; } - - /*! - * \brief Is ATIS voice channel - * \return - */ - bool isAtis() const; - - /*! - * \brief Equal operator == - * \param other - * @return - */ - bool operator ==(const CVoiceRoom &other) const; - - /*! - * \brief Unequal operator == - * \param other - * @return - */ - bool operator !=(const CVoiceRoom &other) const; - - /*! - * \copydoc CValueObject::getValueHash - */ - virtual uint getValueHash() const override; - - /*! - * \brief Register metadata - */ - static void registerMetadata(); - - /*! - * \brief Protocol prefix - * \return - */ - static const QString &protocol() { static QString p("vvl"); return p; } - - /*! - * \brief Protocol - * \return with protocol prefix or without - */ - static const QString &protocolComplete() { static QString p("vvl://"); return p; } - - protected: - - //! \copydoc CValueObject::convertToQString - virtual QString convertToQString(bool i18n = false) const override; - - //! \copydoc CValueObject::getMetaTypeId - virtual int getMetaTypeId() const override; - - //! \copydoc CValueObject::isA - virtual bool isA(int metaTypeId) const override; - - //! \copydoc CValueObject::compareImpl - virtual int compareImpl(const CValueObject &other) const override; - - //! \copydoc CValueObject::marshallToDbus - virtual void marshallToDbus(QDBusArgument &argument) const override; - - //! \copydoc CValueObject::unmarshallFromDbus - virtual void unmarshallFromDbus(const QDBusArgument &argument) override; - - private: - QString m_hostname; - QString m_channel; - bool m_connected; - bool m_audioPlaying; - }; - } // Voice -} // BlackMisc - -Q_DECLARE_METATYPE(BlackMisc::Voice::CVoiceRoom) - -#endif // guard diff --git a/src/blacksound/soundgenerator.cpp b/src/blacksound/soundgenerator.cpp index 453d3f951..11b9ad829 100644 --- a/src/blacksound/soundgenerator.cpp +++ b/src/blacksound/soundgenerator.cpp @@ -15,7 +15,7 @@ using namespace BlackMisc::Aviation; using namespace BlackMisc::PhysicalQuantities; -using namespace BlackMisc::Voice; +using namespace BlackMisc::Audio; namespace BlackSound { @@ -122,10 +122,10 @@ namespace BlackSound { // periodSize-> Returns the period size in bytes. const qint64 len = this->read(m_buffer.data(), this->m_audioOutput->periodSize()); - if (len) + if (len >= 0) this->m_pushModeIODevice->write(m_buffer.data(), len); if (len != this->m_audioOutput->periodSize()) - break; + break; // not a complete period, so buffer is completely read --chunks; } } @@ -361,7 +361,7 @@ namespace BlackSound /* * BlackMisc to Qt audio device */ - QAudioDeviceInfo CSoundGenerator::findClosestOutputDevice(const BlackMisc::Voice::CAudioDevice &audioDevice) + QAudioDeviceInfo CSoundGenerator::findClosestOutputDevice(const BlackMisc::Audio::CAudioDevice &audioDevice) { Q_ASSERT(audioDevice.getType() == CAudioDevice::OutputDevice); const QString lookFor = audioDevice.getName().toLower(); diff --git a/src/blacksound/soundgenerator.h b/src/blacksound/soundgenerator.h index ca76807ab..e88fe46c8 100644 --- a/src/blacksound/soundgenerator.h +++ b/src/blacksound/soundgenerator.h @@ -7,7 +7,7 @@ #define BLACKSOUND_SOUNDGENERATOR_H #include "blackmisc/avselcal.h" -#include "blackmisc/vaudiodevice.h" +#include "blackmisc/audiodevice.h" #include "blackmisc/pqtime.h" #include #include @@ -167,7 +167,7 @@ namespace BlackSound * \param audioDevice output audio device * \return */ - static QAudioDeviceInfo findClosestOutputDevice(const BlackMisc::Voice::CAudioDevice &audioDevice); + static QAudioDeviceInfo findClosestOutputDevice(const BlackMisc::Audio::CAudioDevice &audioDevice); /*! * \brief Play signal of tones once @@ -211,7 +211,7 @@ namespace BlackSound * \param audioDevice device to be used * \see BlackMisc::Aviation::CSelcal */ - static void playSelcal(qint32 volume, const BlackMisc::Aviation::CSelcal &selcal, const BlackMisc::Voice::CAudioDevice &audioDevice); + static void playSelcal(qint32 volume, const BlackMisc::Aviation::CSelcal &selcal, const BlackMisc::Audio::CAudioDevice &audioDevice); /*! * \brief Play notification @@ -247,7 +247,7 @@ namespace BlackSound /*! * \brief Play sound, open device * \param volume 0..100 - * \param pull if false push mode + * \param pull pull/push, if false push mode */ void start(int volume, bool pull = true);