diff options
-rw-r--r-- | icons/config_dsound.png | bin | 9644 -> 0 bytes | |||
-rw-r--r-- | src/mumble/PAAudioConfig.cpp | 171 | ||||
-rw-r--r-- | src/mumble/PAAudioConfig.h | 58 | ||||
-rw-r--r-- | src/mumble/PAAudioConfig.ui | 59 | ||||
-rw-r--r-- | src/mumble/PositionalSound.cpp | 287 | ||||
-rw-r--r-- | src/mumble/PositionalSound.h | 94 | ||||
-rw-r--r-- | src/mumble/mumble.qrc | 113 |
7 files changed, 56 insertions, 726 deletions
diff --git a/icons/config_dsound.png b/icons/config_dsound.png Binary files differdeleted file mode 100644 index c05d97308..000000000 --- a/icons/config_dsound.png +++ /dev/null diff --git a/src/mumble/PAAudioConfig.cpp b/src/mumble/PAAudioConfig.cpp deleted file mode 100644 index 37b35fe40..000000000 --- a/src/mumble/PAAudioConfig.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* Copyright (C) 2005-2011, Thorvald Natvig <thorvald@natvig.com> - Copyright (C) 2007, Stefan Gehn <mETz AT gehn DOT net> - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the Mumble Developers nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "mumble_pch.hpp" - -#include "PAAudioConfig.h" -#include "PAAudio.h" - - -static ConfigWidget *PAAudioConfigNew(Settings &st) { - return new PAAudioConfig(st); -} - -static ConfigRegistrar registrar(2005, PAAudioConfigNew); - -PAAudioConfig::PAAudioConfig(Settings &st) : ConfigWidget(st) { - setupUi(this); - setupDevicesList(); - - connect(lwInput->selectionModel(), - SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), - SLOT(fixSelection(const QItemSelection &, const QItemSelection &))); - connect(lwOutput->selectionModel(), - SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), - SLOT(fixSelection(const QItemSelection &, const QItemSelection &))); -} - -QString PAAudioConfig::title() const { - return tr("PortAudio"); -} - -QIcon PAAudioConfig::icon() const { - return QIcon(QLatin1String("skin:config_dsound.png")); -} - -void PAAudioConfig::load(const Settings &r) { - QList<QListWidgetItem *> qlItems; - - qWarning() << "PAAudioConfig::load()"; - - int idx = 0; - QListWidgetItem *qlwi = NULL; - do { - qlwi = lwInput->item(idx); - if (qlwi && (qlwi->data(Qt::UserRole).toInt() == r.iPortAudioInput)) { - qlwi->setSelected(true); - break; - } - ++idx; - } while (qlwi); - - qlwi = NULL; - idx = 0; - do { - qlwi = lwOutput->item(idx); - if (qlwi && (qlwi->data(Qt::UserRole).toInt() == r.iPortAudioOutput)) { - qlwi->setSelected(true); - break; - } - ++idx; - } while (qlwi); -} - -void PAAudioConfig::save() const { - QListWidgetItem *lwi; - QList<QListWidgetItem *> qlSel; - - qlSel = lwInput->selectedItems(); - lwi = (qlSel.isEmpty() ? NULL : qlSel.first()); - if (lwi) - s.iPortAudioInput = lwi->data(Qt::UserRole).toInt(); - - qlSel = lwOutput->selectedItems(); - lwi = (qlSel.isEmpty() ? NULL : qlSel.first()); - if (lwi) - s.iPortAudioOutput = lwi->data(Qt::UserRole).toInt(); - - qWarning() << "PAAudioConfig::save(); saved input device index :" << s.iPortAudioInput; - qWarning() << "PAAudioConfig::save(); saved output device index :" << s.iPortAudioOutput; -} - -bool PAAudioConfig::expert(bool) { - return true; -} - -void PAAudioConfig::setupDevicesList() { - PortAudioSystemPtr pSys = PortAudioSystem::self(); - - QHash<PaHostApiIndex, PortAudioSystem::HostApiDevices>::const_iterator apiIt; - QHash<PaHostApiIndex, PortAudioSystem::HostApiDevices>::const_iterator apiItEnd = pSys->qhHostApis.constEnd(); - for (apiIt = pSys->qhHostApis.constBegin(); apiIt != apiItEnd; ++apiIt) { - QHash<PaDeviceIndex, QString>::const_iterator devIt; - QHash<PaDeviceIndex, QString>::const_iterator devItEnd; - - const PortAudioSystem::HostApiDevices devs = apiIt.value(); - - if (!devs.qhInputs.isEmpty()) { - devItEnd = devs.qhInputs.constEnd(); - for (devIt = devs.qhInputs.constBegin(); devIt != devItEnd; ++devIt) { - QString devName; - // special case default device, there's no real hostapi behind it - if (apiIt.key() == -1) - devName = devIt.value(); - else - devName = QString("%1 (%2)").arg(devIt.value(), devs.qsHostApiName); - - QListWidgetItem *lwiInputDev = new QListWidgetItem(lwInput); - lwiInputDev->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - lwiInputDev->setText(devName); - lwiInputDev->setData(Qt::UserRole, devIt.key()); - } - } - - if (!devs.qhOutputs.isEmpty()) { - devItEnd = devs.qhOutputs.constEnd(); - for (devIt = devs.qhOutputs.constBegin(); devIt != devItEnd; ++devIt) { - QString devName; - // special case default device, there's no real hostapi behind it - if (apiIt.key() == -1) - devName = devIt.value(); - else - devName = QString("%1 (%2)").arg(devIt.value(), devs.qsHostApiName); - - QListWidgetItem *lwiOutputDevice = new QListWidgetItem(lwOutput); - lwiOutputDevice->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - lwiOutputDevice->setText(devName); - lwiOutputDevice->setData(Qt::UserRole, devIt.key()); - } - } - } -} - -void PAAudioConfig::fixSelection(const QItemSelection &, const QItemSelection &deSel) { - QItemSelectionModel *selModel = qobject_cast<QItemSelectionModel *>(sender()); - if (!selModel) - return; - - if (selModel->hasSelection()) - return; - - // re-select the deselected items - selModel->select(deSel, QItemSelectionModel::Select); -} diff --git a/src/mumble/PAAudioConfig.h b/src/mumble/PAAudioConfig.h deleted file mode 100644 index 5c545d8cc..000000000 --- a/src/mumble/PAAudioConfig.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 2005-2011, Thorvald Natvig <thorvald@natvig.com> - Copyright (C) 2007, Stefan Gehn <mETz AT gehn DOT net> - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the Mumble Developers nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef MUMBLE_MUMBLE_PAAUDIOCONFIG_H_ -#define MUMBLE_MUMBLE_PAAUDIOCONFIG_H_ - -#include "ConfigDialog.h" -#include "ui_PAAudioConfig.h" - -class PAAudioConfig : public ConfigWidget, public Ui::PAAudioConfig { - private: - Q_OBJECT - Q_DISABLE_COPY(PAAudioConfig) - public: - PAAudioConfig(Settings &s); - QString title() const; - QIcon icon() const; - public Q_SLOTS: - void save() const; - void load(const Settings &r); - bool expert(bool); - protected: - void setupDevicesList(); - protected Q_SLOTS: - void fixSelection(const QItemSelection &sel, const QItemSelection &deSel); -}; - -#else -class PAAudioConfig; -#endif diff --git a/src/mumble/PAAudioConfig.ui b/src/mumble/PAAudioConfig.ui deleted file mode 100644 index f6f2e4230..000000000 --- a/src/mumble/PAAudioConfig.ui +++ /dev/null @@ -1,59 +0,0 @@ -<ui version="4.0" > - <class>PAAudioConfig</class> - <widget class="QWidget" name="PAAudioConfig" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>126</width> - <height>252</height> - </rect> - </property> - <layout class="QVBoxLayout" > - <item> - <widget class="QGroupBox" name="gbInput" > - <property name="title" > - <string>Input Device</string> - </property> - <layout class="QVBoxLayout" > - <item> - <widget class="QListWidget" name="lwInput" > - <property name="alternatingRowColors" > - <bool>true</bool> - </property> - <property name="uniformItemSizes" > - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="gbOutput" > - <property name="title" > - <string>Output Device</string> - </property> - <layout class="QVBoxLayout" > - <item> - <widget class="QListWidget" name="lwOutput" > - <property name="alternatingRowColors" > - <bool>true</bool> - </property> - <property name="uniformItemSizes" > - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <tabstops> - <tabstop>lwInput</tabstop> - <tabstop>lwOutput</tabstop> - </tabstops> - <resources/> - <connections/> -</ui> diff --git a/src/mumble/PositionalSound.cpp b/src/mumble/PositionalSound.cpp deleted file mode 100644 index 1a5aa2970..000000000 --- a/src/mumble/PositionalSound.cpp +++ /dev/null @@ -1,287 +0,0 @@ -/* Copyright (C) 2005-2011, Thorvald Natvig <thorvald@natvig.com> - Copyright (C) 2008, Andreas Messer <andi@bupfen.de> - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the Mumble Developers nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "mumble_pch.hpp" - -#include "PositionalSound.h" - -#include "Global.h" - - -PlotWidget::PlotWidget(QWidget *p, const QList<float> &xl,const QList<float> &yl) : QWidget(p), xdata(xl), ydata(yl) { - setPalette(QPalette(QColor(255,255,255))); - setAutoFillBackground(true); - setMinimumSize(20,20); - setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); -} - -void PlotWidget::paintEvent(QPaintEvent *) { - QPainter painter(this); - if (xdata.size() < 2 || ydata.size() < 2) - return; - - float minx = xdata.front(); - float maxx = xdata.back(); - - float miny = ydata.front(); - float maxy = ydata.back(); - - float f; - - foreach(f,ydata) { - miny = qMin(miny,f); - maxy = qMax(maxy,f); - } - - if (miny == maxy) { - miny -= 1; - maxy += 1; - } - - const int hght = this->height(); - const int wdth = this->width(); - - painter.drawLine(15,hght - 20, wdth, hght -20); - painter.drawLine(20,hght - 15, 20, 0); - - float ticstep = 1; - - while ((maxx - minx) / ticstep > 10.9) - ticstep *= 2; - - for (f = (lround(minx / ticstep) + 1) * ticstep; f < maxx; f += ticstep) { - const int ipos = lround(20 + (wdth-20) * (f-minx) / (maxx-minx)); - - painter.drawLine(ipos,hght - 20, ipos, hght -17); - painter.drawText(QRect(ipos-20,hght-17,40,17),Qt::AlignCenter,QString::number(lroundf(f))); - } - - ticstep = 1; - - while ((maxy - miny) / ticstep > 10.9) - ticstep *= 2; - - for (f = (lround(miny / ticstep) + 1) * ticstep; f < maxy; f += ticstep) { - const int ipos = lround((hght-20) *(1 - (f - miny) / (maxy-miny))); - - painter.drawLine(17 ,ipos , 20, ipos); - painter.drawText(QRect(0,ipos-10,17,20),Qt::AlignCenter,QString::number(lroundf(f))); - } - - QList<float>::const_iterator xit = xdata.begin(); - QList<float>::const_iterator yit = ydata.begin(); - - float xold = *(xit++); - float yold = *(yit++); - - painter.setPen(QColor(255,0,0)); - while (xit != xdata.end() && yit != ydata.end()) { - painter.drawLine( - lround(20 + (wdth-20) * (xold-minx) / (maxx-minx)), - lround((hght-20) *(1 - (yold - miny) / (maxy-miny))), - lround(20 + (wdth-20) * (*xit-minx) / (maxx-minx)), - lround((hght-20) * (1 - (*yit - miny) / (maxy-miny)))); - xold = *(xit++); - yold = *(yit++); - } - -} - -int PlotWidget::heightForWidth(int w) const { - return w * 3 / 4; -} - -static ConfigWidget *PositionalSoundConfigDialogNew(Settings &st) { - return new PositionalSoundConfig(st); -} - -static ConfigRegistrar registrar(29, PositionalSoundConfigDialogNew); - - -PositionalSoundConfig::PositionalSoundConfig(Settings &st) : ConfigWidget(st) { - setupUi(this); - - plot = new PlotWidget(qgbVolume,xdata,ydata); - plot->setObjectName(QString::fromUtf8("Plot")); - - gridLayout->addWidget(plot, 3, 1, 1, 3); - - qcbModel->addItem(tr("constant"),Settings::CONSTANT); - qcbModel->addItem(tr("linear"),Settings::LINEAR); - - update(); -} - -PositionalSoundConfig::~PositionalSoundConfig() { - delete plot; -} - -QString PositionalSoundConfig::title() const { - return tr("Positional Sound"); -} - -QIcon PositionalSoundConfig::icon() const { - return QIcon(QLatin1String("skin:config_dsound.png")); -} - -void PositionalSoundConfig::save() const { - s.ePositionalSoundModel = static_cast<Settings::PositionalSoundModels>(qcbModel->itemData(qcbModel->currentIndex()).toInt()); - - s.fPositionalSoundDistance = qdsbDistance->value(); - s.fPositionalSoundPreGain = qdsbPreGain->value(); - s.fPositionalSoundMaxAtt = qdsbMaxAtt->value(); - - s.bPositionalSoundEnable = qcbEnable->checkState() == Qt::Checked; - s.bPositionalSoundSwap = qcbSwap->checkState() == Qt::Checked; -} - -void PositionalSoundConfig::load(const Settings &r) { - for (int i=0;i<qcbModel->count();i++) { - if (qcbModel->itemData(i).toInt() == r.ePositionalSoundModel) { - loadComboBox(qcbModel, i); - break; - } - } - - qdsbDistance->setValue(r.fPositionalSoundDistance); - qdsbPreGain->setValue(r.fPositionalSoundPreGain); - qdsbMaxAtt->setValue(r.fPositionalSoundMaxAtt); - - qcbEnable->setCheckState(r.bPositionalSoundEnable ? Qt::Checked : Qt::Unchecked); - qcbSwap->setCheckState(r.bPositionalSoundSwap ? Qt::Checked : Qt::Unchecked); - - update(); -} - -bool PositionalSoundConfig::expert(bool) { - return false; -} - -void PositionalSoundConfig::update() { - - const Settings::PositionalSoundModels model = - static_cast<Settings::PositionalSoundModels>(qcbModel->itemData(qcbModel->currentIndex()).toInt()); - - const float distance = qdsbDistance->value(); - const float pregain = qdsbPreGain->value(); - const float maxatt = qdsbMaxAtt->value(); - - float yold = pregain; - float xmax = 1000; - - xdata.clear(); - ydata.clear(); - - for (float xv = 0; xv < xmax; xv+= 1) { - xdata << xv; - - float yv = 0; - switch (model) { - case Settings::CONSTANT: - yv = PositionalSound::ModelConstant(pregain); - break; - case Settings::LINEAR: - yv = PositionalSound::ModelLinear(pregain,maxatt,distance,xv); - break; - } - - ydata << yv; - - if (yold - yv < 1e-10 && xmax >= 1000 && xv > 0) - xmax = 1.1*xv+1; - - yold = yv; - } - - plot->update(); -} - -void PositionalSoundConfig::on_qcbEnable_stateChanged(int state) { - if (state == Qt::Checked) { - qcbSwap->setEnabled(true); - qgbVolume->setEnabled(true); - } else { - qcbSwap->setEnabled(false); - qgbVolume->setEnabled(false); - } -} - -void PositionalSoundConfig::on_qcbModel_currentIndexChanged(int i) { - if (qcbModel->itemData(i).toInt() == Settings::CONSTANT) { - qdsbDistance->setEnabled(false); - qdsbMaxAtt->setEnabled(false); - } else { - qdsbDistance->setEnabled(true); - qdsbMaxAtt->setEnabled(true); - } - - update(); -} - -void PositionalSoundConfig::on_qdsbDistance_valueChanged(double) { - update(); -} - -void PositionalSoundConfig::on_qdsbPreGain_valueChanged(double) { - update(); -} -void PositionalSoundConfig::on_qdsbMaxAtt_valueChanged(double) { - update(); -} - -float PositionalSound::todB(float ratio) { - return 20.0f * log10f(ratio); -} - -float PositionalSound::toRatio(float dB) { - return powf(10.0f, dB / 20.0f); -} - -float PositionalSound::ModelConstant(float pregain) { - return pregain; -} - -float PositionalSound::ModelLinear(float pregain, float maxatt, float distance, float d) { - float att = 10.0f * d/distance; - return pregain - (att < maxatt ? att : maxatt); -} - -float PositionalSound::calcdB(float d) { - switch (g.s.ePositionalSoundModel) { - case Settings::CONSTANT: - return ModelConstant(g.s.fPositionalSoundPreGain); - case Settings::LINEAR: - return ModelLinear(g.s.fPositionalSoundPreGain, g.s.fPositionalSoundMaxAtt, g.s.fPositionalSoundDistance, d); - default: - break; - } - return 0.0f; -} diff --git a/src/mumble/PositionalSound.h b/src/mumble/PositionalSound.h deleted file mode 100644 index 5509713a4..000000000 --- a/src/mumble/PositionalSound.h +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright (C) 2005-2011, Thorvald Natvig <thorvald@natvig.com> - Copyright (C) 2008, Andreas Messer <andi@bupfen.de> - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the Mumble Developers nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef MUMBLE_MUMBLE_POSITIONALSOUND_H_ -#define MUMBLE_MUMBLE_POSITIONALSOUND_H_ - -#include "ConfigDialog.h" -#include "Global.h" - -#include "ui_PositionalSound.h" - -class Settings; - -class PlotWidget : public QWidget { - private: - Q_OBJECT - Q_DISABLE_COPY(PlotWidget) - protected: - const QList<float> &xdata; - const QList<float> &ydata; - void paintEvent(QPaintEvent*); - public: - PlotWidget(QWidget *parent, const QList<float> &x, const QList<float> &y); - int heightForWidth(int) const; -}; - -class PositionalSoundConfig : public ConfigWidget, public Ui::PositionalSoundConfig { - private: - Q_OBJECT - Q_DISABLE_COPY(PositionalSoundConfig) - protected: - QList<float> xdata; - QList<float> ydata; - - PlotWidget* plot; - public: - PositionalSoundConfig(Settings &st); - ~PositionalSoundConfig(); - virtual QString title() const; - virtual QIcon icon() const; - public slots: - void save() const; - void load(const Settings &r); - bool expert(bool); - - void on_qcbEnable_stateChanged(int); - void on_qcbModel_currentIndexChanged(int); - void on_qdsbDistance_valueChanged(double); - void on_qdsbPreGain_valueChanged(double); - void on_qdsbMaxAtt_valueChanged(double); - - void update(); -}; - -class PositionalSound { - public: - static float todB(float ratio); - static float toRatio(float dB); - static float ModelConstant(float pregain); - static float ModelLinear(float pregain, float maxatt, float distance, float d); - static float calcdB(float d); -}; - -#else -class PositionalSoundConfig; -#endif diff --git a/src/mumble/mumble.qrc b/src/mumble/mumble.qrc index 9379be5dd..212f6f1b3 100644 --- a/src/mumble/mumble.qrc +++ b/src/mumble/mumble.qrc @@ -1,58 +1,57 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> - <file alias="Information_icon.svg">../../icons/publicdomain/Information_icon.svg</file> - <file alias="self_undeafened.svg">../../icons/self_undeafened.svg</file> - <file alias="mumble.svg">../../icons/mumble.svg</file> - <file alias="mumble.icns">../../icons/mumble.icns</file> - <file alias="mumble.osx.png">../../icons/mumble.osx.png</file> - <file alias="talking_on.svg">../../icons/talking_on.svg</file> - <file alias="talking_alt.svg">../../icons/talking_alt.svg</file> - <file alias="talking_off.svg">../../icons/talking_off.svg</file> - <file alias="talking_whisper.svg">../../icons/talking_whisper.svg</file> - <file alias="deafened_self.svg">../../icons/deafened_self.svg</file> - <file alias="deafened_server.svg">../../icons/deafened_server.svg</file> - <file alias="muted_self.svg">../../icons/muted_self.svg</file> - <file alias="muted_server.svg">../../icons/muted_server.svg</file> - <file alias="muted_local.svg">../../icons/muted_local.svg</file> - <file alias="muted_suppressed.svg">../../icons/muted_suppressed.svg</file> - <file alias="authenticated.svg">../../icons/authenticated.svg</file> - <file alias="channel.svg">../../icons/channel.svg</file> - <file alias="channel_active.svg">../../icons/channel_active.svg</file> - <file alias="channel_linked.svg">../../icons/channel_linked.svg</file> - <file alias="config_basic.png">../../icons/config_basic.png</file> - <file alias="config_audio_input.png">../../icons/config_audio_input.png</file> - <file alias="config_audio_output.png">../../icons/config_audio_output.png</file> - <file alias="config_dsound.png">../../icons/config_dsound.png</file> - <file alias="config_msgs.png">../../icons/config_msgs.png</file> - <file alias="config_plugin.png">../../icons/config_plugin.png</file> - <file alias="config_asio.png">../../icons/config_asio.png</file> - <file alias="config_osd.png">../../icons/config_osd.png</file> - <file alias="config_network.png">../../icons/config_network.png</file> - <file alias="config_shortcuts.png">../../icons/config_shortcuts.png</file> - <file alias="config_ui.png">../../icons/config_ui.png</file> - <file alias="config_lcd.png">../../icons/config_lcd.png</file> - <file alias="layout_classic.svg">../../icons/layout_classic.svg</file> - <file alias="layout_stacked.svg">../../icons/layout_stacked.svg</file> - <file alias="layout_hybrid.svg">../../icons/layout_hybrid.svg</file> - <file alias="layout_custom.svg">../../icons/layout_custom.svg</file> - <file alias="comment.svg">../../icons/comment.svg</file> - <file alias="comment_seen.svg">../../icons/comment_seen.svg</file> - <file alias="default_avatar.svg">../../icons/default_avatar.svg</file> - <file alias="rec.svg">../../icons/rec.svg</file> - <file alias="wb_male.oga">../../samples/wb_male.oga</file> - <file alias="on.ogg">../../samples/on.ogg</file> - <file alias="off.ogg">../../samples/off.ogg</file> - <file alias="Critical.ogg">../../samples/Critical.ogg</file> - <file alias="PermissionDenied.ogg">../../samples/PermissionDenied.ogg</file> - <file alias="SelfMutedDeafened.ogg">../../samples/SelfMutedDeafened.ogg</file> - <file alias="ServerConnected.ogg">../../samples/ServerConnected.ogg</file> - <file alias="ServerDisconnected.ogg">../../samples/ServerDisconnected.ogg</file> - <file alias="TextMessage.ogg">../../samples/TextMessage.ogg</file> - <file alias="UserJoinedChannel.ogg">../../samples/UserJoinedChannel.ogg</file> - <file alias="UserKickedYouOrByYou.ogg">../../samples/UserKickedYouOrByYou.ogg</file> - <file alias="UserLeftChannel.ogg">../../samples/UserLeftChannel.ogg</file> - <file alias="UserMutedYouOrByYou.ogg">../../samples/UserMutedYouOrByYou.ogg</file> - <file alias="RecordingStateChanged.ogg">../../samples/RecordingStateChanged.ogg</file> - <file alias="filter.svg">../../icons/filter.svg</file> -</qresource> +<RCC> + <qresource prefix="/"> + <file alias="Information_icon.svg">../../icons/publicdomain/Information_icon.svg</file> + <file alias="self_undeafened.svg">../../icons/self_undeafened.svg</file> + <file alias="mumble.svg">../../icons/mumble.svg</file> + <file alias="mumble.icns">../../icons/mumble.icns</file> + <file alias="mumble.osx.png">../../icons/mumble.osx.png</file> + <file alias="talking_on.svg">../../icons/talking_on.svg</file> + <file alias="talking_alt.svg">../../icons/talking_alt.svg</file> + <file alias="talking_off.svg">../../icons/talking_off.svg</file> + <file alias="talking_whisper.svg">../../icons/talking_whisper.svg</file> + <file alias="deafened_self.svg">../../icons/deafened_self.svg</file> + <file alias="deafened_server.svg">../../icons/deafened_server.svg</file> + <file alias="muted_self.svg">../../icons/muted_self.svg</file> + <file alias="muted_server.svg">../../icons/muted_server.svg</file> + <file alias="muted_local.svg">../../icons/muted_local.svg</file> + <file alias="muted_suppressed.svg">../../icons/muted_suppressed.svg</file> + <file alias="authenticated.svg">../../icons/authenticated.svg</file> + <file alias="channel.svg">../../icons/channel.svg</file> + <file alias="channel_active.svg">../../icons/channel_active.svg</file> + <file alias="channel_linked.svg">../../icons/channel_linked.svg</file> + <file alias="config_basic.png">../../icons/config_basic.png</file> + <file alias="config_audio_input.png">../../icons/config_audio_input.png</file> + <file alias="config_audio_output.png">../../icons/config_audio_output.png</file> + <file alias="config_msgs.png">../../icons/config_msgs.png</file> + <file alias="config_plugin.png">../../icons/config_plugin.png</file> + <file alias="config_asio.png">../../icons/config_asio.png</file> + <file alias="config_osd.png">../../icons/config_osd.png</file> + <file alias="config_network.png">../../icons/config_network.png</file> + <file alias="config_shortcuts.png">../../icons/config_shortcuts.png</file> + <file alias="config_ui.png">../../icons/config_ui.png</file> + <file alias="config_lcd.png">../../icons/config_lcd.png</file> + <file alias="layout_classic.svg">../../icons/layout_classic.svg</file> + <file alias="layout_stacked.svg">../../icons/layout_stacked.svg</file> + <file alias="layout_hybrid.svg">../../icons/layout_hybrid.svg</file> + <file alias="layout_custom.svg">../../icons/layout_custom.svg</file> + <file alias="comment.svg">../../icons/comment.svg</file> + <file alias="comment_seen.svg">../../icons/comment_seen.svg</file> + <file alias="default_avatar.svg">../../icons/default_avatar.svg</file> + <file alias="rec.svg">../../icons/rec.svg</file> + <file alias="wb_male.oga">../../samples/wb_male.oga</file> + <file alias="on.ogg">../../samples/on.ogg</file> + <file alias="off.ogg">../../samples/off.ogg</file> + <file alias="Critical.ogg">../../samples/Critical.ogg</file> + <file alias="PermissionDenied.ogg">../../samples/PermissionDenied.ogg</file> + <file alias="SelfMutedDeafened.ogg">../../samples/SelfMutedDeafened.ogg</file> + <file alias="ServerConnected.ogg">../../samples/ServerConnected.ogg</file> + <file alias="ServerDisconnected.ogg">../../samples/ServerDisconnected.ogg</file> + <file alias="TextMessage.ogg">../../samples/TextMessage.ogg</file> + <file alias="UserJoinedChannel.ogg">../../samples/UserJoinedChannel.ogg</file> + <file alias="UserKickedYouOrByYou.ogg">../../samples/UserKickedYouOrByYou.ogg</file> + <file alias="UserLeftChannel.ogg">../../samples/UserLeftChannel.ogg</file> + <file alias="UserMutedYouOrByYou.ogg">../../samples/UserMutedYouOrByYou.ogg</file> + <file alias="RecordingStateChanged.ogg">../../samples/RecordingStateChanged.ogg</file> + <file alias="filter.svg">../../icons/filter.svg</file> + </qresource> </RCC> |