Skip to content

Commit

Permalink
Option to use TeamTalk sound Output device for default sound event pl…
Browse files Browse the repository at this point in the history
…ayback mode
  • Loading branch information
CoBC committed Aug 16, 2024
1 parent 0272778 commit 080dbf1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Version 5.17.1, unreleased
Default Qt Client
-
- Option to use TeamTalk Sound Output device for default sound event playback mode
Android Client
-
iOS Client
Expand Down
7 changes: 7 additions & 0 deletions Client/qtTeamTalk/preferences.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,13 @@
<item>
<widget class="QComboBox" name="sndeventPlaybackComboBox"/>
</item>
<item>
<widget class="QCheckBox" name="ttDeviceChkBox">
<property name="text">
<string>Use TeamTalk Sound Output Device for Sound Events Playback</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down
6 changes: 6 additions & 0 deletions Client/qtTeamTalk/preferencesdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ PreferencesDlg::PreferencesDlg(SoundDevice& devin, SoundDevice& devout, QWidget
//sound events
m_soundmodel = new SoundEventsModel(this);
ui.soundEventsTableView->setModel(m_soundmodel);
connect(ui.sndeventPlaybackComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [&]()
{
ui.ttDeviceChkBox->setVisible(PlaybackMode(ui.sndeventPlaybackComboBox->currentData().toInt()) == PLAYBACKMODE_DEFAULT);
});
connect(ui.soundEventsTableView, &QAbstractItemView::doubleClicked, this, &PreferencesDlg::slotSoundEventToggled);
connect(ui.soundEventsTableView->selectionModel(), &QItemSelectionModel::currentChanged, this, &PreferencesDlg::SoundEventSelected);
connect(ui.soundEventsBrowseButton, &QPushButton::clicked, this, &PreferencesDlg::slotBrowseSoundEvent);
Expand Down Expand Up @@ -578,6 +582,7 @@ void PreferencesDlg::initSoundEventsTab()
ui.sndeventPlaybackComboBox->addItem(tr("One by One"), PLAYBACKMODE_ONEBYONE);
ui.sndeventPlaybackComboBox->addItem(tr("Overlapping"), PLAYBACKMODE_OVERLAPPING);
setCurrentItemData(ui.sndeventPlaybackComboBox, ttSettings->value(SETTINGS_SOUNDEVENT_PLAYBACKMODE, SETTINGS_SOUNDEVENT_PLAYBACKMODE_DEFAULT));
ui.ttDeviceChkBox->setChecked(ttSettings->value(SETTINGS_SOUNDEVENT_TTDEVICE, SETTINGS_SOUNDEVENT_TTDEVICE_DEFAULT).toBool());
SoundEvents events = ttSettings->value(SETTINGS_SOUNDEVENT_ACTIVEEVENTS, SETTINGS_SOUNDEVENT_ACTIVEEVENTS_DEFAULT).toULongLong();
m_soundmodel->setSoundEvents(events);
}
Expand Down Expand Up @@ -923,6 +928,7 @@ void PreferencesDlg::slotSaveChanges()
{
ttSettings->setValue(SETTINGS_SOUNDEVENT_VOLUME, ui.sndVolSpinBox->value());
ttSettings->setValue(SETTINGS_SOUNDEVENT_PLAYBACKMODE, getCurrentItemData(ui.sndeventPlaybackComboBox));
ttSettings->setValue(SETTINGS_SOUNDEVENT_TTDEVICE, ui.ttDeviceChkBox->isChecked());
ttSettings->setValue(SETTINGS_SOUNDEVENT_ACTIVEEVENTS, m_soundmodel->getSoundEvents());
ttSettings->setValue(SETTINGS_DISPLAY_SOUNDEVENTSHEADER, ui.soundEventsTableView->horizontalHeader()->saveState());
saveCurrentFile();
Expand Down
2 changes: 2 additions & 0 deletions Client/qtTeamTalk/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@
#define SETTINGS_SOUNDEVENT_VOLUME_DEFAULT 100
#define SETTINGS_SOUNDEVENT_PLAYBACKMODE "soundevents/playback-mode"
#define SETTINGS_SOUNDEVENT_PLAYBACKMODE_DEFAULT PLAYBACKMODE_DEFAULT
#define SETTINGS_SOUNDEVENT_TTDEVICE "soundevents/use-tt-device"
#define SETTINGS_SOUNDEVENT_TTDEVICE_DEFAULT true
#define SETTINGS_SOUNDEVENT_ACTIVEEVENTS "soundevents/active-events"
#define SETTINGS_SOUNDEVENT_ACTIVEEVENTS_DEFAULT SoundEvents(SOUNDEVENT_NEWUSER | \
SOUNDEVENT_REMOVEUSER | \
Expand Down
3 changes: 2 additions & 1 deletion Client/qtTeamTalk/utilsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,8 @@ void PlaySoundEvent::playDefaultSoundEvent(const QString& filename)
static QSoundEffect* effect = nullptr;
delete effect;
effect = new QSoundEffect(ttSettings);
effect->setAudioDevice(getSelectedOutputAudioDevice());
if (ttSettings->value(SETTINGS_SOUNDEVENT_TTDEVICE, SETTINGS_SOUNDEVENT_TTDEVICE_DEFAULT).toBool() == true)
effect->setAudioDevice(getSelectedOutputAudioDevice());
effect->setSource(QUrl::fromLocalFile(filename));
effect->setVolume(ttSettings->value(SETTINGS_SOUNDEVENT_VOLUME, SETTINGS_SOUNDEVENT_VOLUME_DEFAULT).toInt()/100.0);
effect->play();
Expand Down

0 comments on commit 080dbf1

Please sign in to comment.