Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/Qt6 - Fixing the audio settings #660

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
url = https://github.com/shotgunsoftware/openrv-WFObj.git
[submodule "src/pub"]
path = src/pub
url = git@github.com:cedrik-fuoco-adsk/openrv-pub.git
url = https://github.com/cedrik-fuoco-adsk/openrv-pub.git
branch = qt6
12 changes: 10 additions & 2 deletions src/lib/app/RvCommon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ ENDIF()

FILE(GLOB _ui_sources ui/*.ui)

IF(RV_VFX_PLATFORM STREQUAL CY2024)
FILE(GLOB _ui_sources_extra ui/RvPreferences/Qt6/RvPreferences.ui)
ELSEIF(RV_VFX_PLATFORM STREQUAL CY2023)
FILE(GLOB _ui_sources_extra ui/RvPreferences/Qt5/RvPreferences.ui)
ENDIF()

LIST(APPEND _ui_sources ${_ui_sources_extra})

IF(RV_VFX_PLATFORM STREQUAL CY2024)
# Use Qt6 connections syntax because it generates the wrong QObject::connect for RvConsoleWindow.ui. TODO_QT: Could remove the connections from the UI XML and
# add them to RvConsoleWindow.cpp
Expand Down Expand Up @@ -162,14 +170,14 @@ FOREACH(
IF(RV_VFX_PLATFORM STREQUAL CY2023)
ADD_CUSTOM_COMMAND(
OUTPUT ${outfile}
COMMAND ${Qt5Core_MOC_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR} -o ${outfile} ${infile}
COMMAND ${Qt5Core_MOC_EXECUTABLE} -DRV_VFX_CY2023 -I ${CMAKE_CURRENT_SOURCE_DIR} -o ${outfile} ${infile}
MAIN_DEPENDENCY ${infile}
VERBATIM
)
ELSEIF(RV_VFX_PLATFORM STREQUAL CY2024)
ADD_CUSTOM_COMMAND(
OUTPUT ${outfile}
COMMAND ${QT_MOC_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR} -o ${outfile} ${infile}
COMMAND ${QT_MOC_EXECUTABLE} -DRV_VFX_CY2024 -I ${CMAKE_CURRENT_SOURCE_DIR} -o ${outfile} ${infile}
MAIN_DEPENDENCY ${infile}
VERBATIM
)
Expand Down
4 changes: 4 additions & 0 deletions src/lib/app/RvCommon/RvCommon/RvPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ public slots:
void audioDeviceChanged(int index);
void audioChannelsChanged(int index);
void audioFormatChanged(int index);
#if defined( RV_VFX_CY2023 )
void audioRateChanged(int index);
#else
void audioRateChanged();
#endif
void audioHoldOpenChanged(int);
void audioVideoSyncChanged(int);
void audioPreRollChanged(int);
Expand Down
77 changes: 61 additions & 16 deletions src/lib/app/RvCommon/RvPreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,14 @@ RvPreferences::RvPreferences(QWidget* parent)
this, SLOT(audioDeviceChanged(int)));
m_ui.audioDeviceCombo->installEventFilter(scrollEventEater);

connect(m_ui.audioDeviceRateCombo, SIGNAL(activated(int)),
#if defined( RV_VFX_CY2023 )
connect(m_ui.audioDeviceRateWidget, SIGNAL(activated(int)),
this, SLOT(audioRateChanged(int)));
m_ui.audioDeviceRateCombo->installEventFilter(scrollEventEater);
#else
connect(m_ui.audioDeviceRateWidget, SIGNAL(editingFinished()),
this, SLOT(audioRateChanged()));
#endif
m_ui.audioDeviceRateWidget->installEventFilter(scrollEventEater);

connect(m_ui.audioDeviceFormatCombo, SIGNAL(activated(int)),
this, SLOT(audioFormatChanged(int)));
Expand Down Expand Up @@ -590,13 +595,13 @@ RvPreferences::update()
m_ui.audioDeviceCombo->clear();
m_ui.audioDeviceLayoutCombo->clear();
m_ui.audioDeviceFormatCombo->clear();
m_ui.audioDeviceRateCombo->clear();
m_ui.audioDeviceRateWidget->clear();
m_ui.audioModuleCombo->addItem("Audio Disabled");
m_ui.audioModuleCombo->setItemIcon(0, colorAdjustedIcon(":images/mute_32x32.png"));
m_ui.audioDeviceCombo->setEnabled(false);
m_ui.audioDeviceLayoutCombo->setEnabled(false);
m_ui.audioDeviceFormatCombo->setEnabled(false);
m_ui.audioDeviceRateCombo->setEnabled(false);
m_ui.audioDeviceRateWidget->setEnabled(false);
}
else if (!m_ui.audioModuleCombo->count())
{
Expand Down Expand Up @@ -1268,7 +1273,11 @@ RvPreferences::write()
m_ui.audioDeviceLayoutCombo->currentText() != "Unavailable" &&
m_ui.audioDeviceLayoutCombo->currentText() != "")
{
settings.setValue("outputRate", m_ui.audioDeviceRateCombo->currentText().toDouble());
#if defined( RV_VFX_CY2023 )
settings.setValue("outputRate", m_ui.audioDeviceRateWidget->currentText().toDouble());
#else
settings.setValue("outputRate", (double) 1.0 * m_ui.audioDeviceRateWidget->value());
#endif
settings.setValue("outputModule", m_ui.audioModuleCombo->currentText());
settings.setValue("outputDevice", m_ui.audioDeviceCombo->currentText());

Expand Down Expand Up @@ -2139,31 +2148,41 @@ RvPreferences::initAudioRatesMenu(AudioRenderer::RendererParameters &params,
const AudioRenderer::RateVector &rates,
const size_t &currentRate)
{
m_ui.audioDeviceRateCombo->clear();
m_ui.audioDeviceRateWidget->clear();

if (rates.empty())
{
m_ui.audioDeviceRateCombo->clear();
m_ui.audioDeviceRateCombo->addItem("Unavailable");
m_ui.audioDeviceRateCombo->setItemIcon(0, colorAdjustedIcon(":images/mute_32x32.png"));
m_ui.audioDeviceRateCombo->setCurrentIndex(0);
m_ui.audioDeviceRateCombo->setEnabled(false);
m_ui.audioDeviceRateWidget->clear();
#if defined( RV_VFX_CY2023 )
m_ui.audioDeviceRateWidget->addItem("Unavailable");
m_ui.audioDeviceRateWidget->setItemIcon(0, colorAdjustedIcon(":images/mute_32x32.png"));
m_ui.audioDeviceRateWidget->setCurrentIndex(0);
#else
m_ui.audioDeviceRateWidget->setValue((int)currentRate);
#endif
m_ui.audioDeviceRateWidget->setEnabled(false);
return false;
}
else
{
#if defined( RV_VFX_CY2023 )
int current = 0;
for (size_t i = 0; i < rates.size(); i++)
{
QString s = QString("%1").arg((unsigned int)(rates[i]));
m_ui.audioDeviceRateCombo->addItem(s, (unsigned int)rates[i]);
m_ui.audioDeviceRateWidget->addItem(s, (unsigned int)rates[i]);

if (rates[i] == currentRate) current = i;
}

m_ui.audioDeviceRateCombo->setEnabled(true);
m_ui.audioDeviceRateCombo->setCurrentIndex(current);
m_ui.audioDeviceRateWidget->setEnabled(true);
m_ui.audioDeviceRateWidget->setCurrentIndex(current);
params.rate = rates[current];
#else
m_ui.audioDeviceRateWidget->setEnabled(true);
m_ui.audioDeviceRateWidget->setValue((int)currentRate);
params.rate = currentRate;
#endif
}

return true;
Expand Down Expand Up @@ -2283,6 +2302,11 @@ RvPreferences::audioModuleChanged(int index)
}
renderer->availableRates(d, currentFormat, rates);
}
#if defined( RV_VFX_CY2024 )
m_ui.audioDeviceRateWidget->setMinimum(rates.front());
m_ui.audioDeviceRateWidget->setMaximum(rates.back());
#endif

IPCore::App()->resumeAll();

// Create the channel layout choice list
Expand Down Expand Up @@ -2386,6 +2410,11 @@ RvPreferences::audioDeviceChanged(int index)
}
renderer->availableRates(d, currentFormat, rates);
}
#if defined( RV_VFX_CY2024 )
m_ui.audioDeviceRateWidget->setMinimum(rates.front());
m_ui.audioDeviceRateWidget->setMaximum(rates.back());
#endif

IPCore::App()->resumeAll();

// Create the channel layout choice list
Expand Down Expand Up @@ -2465,6 +2494,11 @@ RvPreferences::audioChannelsChanged(int index)
}
renderer->availableRates(d, currentFormat, rates);
}
#if defined( RV_VFX_CY2024 )
m_ui.audioDeviceRateWidget->setMinimum(rates.front());
m_ui.audioDeviceRateWidget->setMaximum(rates.back());
#endif

IPCore::App()->resumeAll();

// Create format choice list
Expand Down Expand Up @@ -2527,6 +2561,10 @@ RvPreferences::audioFormatChanged(int index)
IPCore::App()->stopAll();
renderer->shutdown();
renderer->availableRates(d, currentFormat, rates);
#if defined( RV_VFX_CY2024 )
m_ui.audioDeviceRateWidget->setMinimum(rates.front());
m_ui.audioDeviceRateWidget->setMaximum(rates.back());
#endif
IPCore::App()->resumeAll();

// Create rates choice list
Expand All @@ -2541,11 +2579,18 @@ RvPreferences::audioFormatChanged(int index)


void
#if defined( RV_VFX_CY2023 )
RvPreferences::audioRateChanged(int index)
#else
RvPreferences::audioRateChanged()
#endif
{
if (AudioRenderer::audioDisabledAlways()) return;
size_t rate = m_ui.audioDeviceRateCombo->currentText().toInt();

#if defined( RV_VFX_CY2023 )
size_t rate = m_ui.audioDeviceRateWidget->currentText().toInt();
#else
size_t rate = m_ui.audioDeviceRateWidget->value();
#endif
AudioRenderer::RendererParameters params = AudioRenderer::defaultParameters();
params.rate = rate;
AudioRenderer::setDefaultParameters(params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,7 @@
<widget class="QComboBox" name="audioDeviceFormatCombo"/>
</item>
<item>
<widget class="QComboBox" name="audioDeviceRateCombo"/>
<widget class="QComboBox" name="audioDeviceRateWidget"/>
</item>
<item>
<widget class="QLabel" name="label_61">
Expand Down Expand Up @@ -3442,7 +3442,7 @@
<tabstop>audioDeviceCombo</tabstop>
<tabstop>audioDeviceLayoutCombo</tabstop>
<tabstop>audioDeviceFormatCombo</tabstop>
<tabstop>audioDeviceRateCombo</tabstop>
<tabstop>audioDeviceRateWidget</tabstop>
<tabstop>volumeSlider</tabstop>
<tabstop>audioGlobalOffsetEdit</tabstop>
<tabstop>audioDevicePacketEdit</tabstop>
Expand Down
Loading
Loading