Apply code review
This commit is contained in:
@@ -37,9 +37,9 @@
|
||||
namespace lmms
|
||||
{
|
||||
|
||||
constexpr char const* const c_sectionSDL = "audiosdl";
|
||||
constexpr char const* const c_playbackDeviceSDL = "device";
|
||||
constexpr char const* const c_inputDeviceSDL = "inputdevice";
|
||||
constexpr char const* const SectionSDL = "audiosdl";
|
||||
constexpr char const* const PlaybackDeviceSDL = "device";
|
||||
constexpr char const* const InputDeviceSDL = "inputdevice";
|
||||
|
||||
AudioSdl::AudioSdl( bool & _success_ful, AudioEngine* _audioEngine ) :
|
||||
AudioDevice( DEFAULT_CHANNELS, _audioEngine ),
|
||||
@@ -82,7 +82,7 @@ AudioSdl::AudioSdl( bool & _success_ful, AudioEngine* _audioEngine ) :
|
||||
SDL_AudioSpec actual;
|
||||
|
||||
#ifdef LMMS_HAVE_SDL2
|
||||
const QString playbackDevice = ConfigManager::inst()->value(c_sectionSDL, c_playbackDeviceSDL);
|
||||
const auto playbackDevice = ConfigManager::inst()->value(SectionSDL, PlaybackDeviceSDL);
|
||||
const bool isDefaultPlayback = playbackDevice.isEmpty();
|
||||
|
||||
// Try with the configured device
|
||||
@@ -120,7 +120,7 @@ AudioSdl::AudioSdl( bool & _success_ful, AudioEngine* _audioEngine ) :
|
||||
m_inputAudioHandle = m_audioHandle;
|
||||
m_inputAudioHandle.callback = sdlInputAudioCallback;
|
||||
|
||||
const QString inputDevice = ConfigManager::inst()->value(c_sectionSDL, c_inputDeviceSDL);
|
||||
const auto inputDevice = ConfigManager::inst()->value(SectionSDL, InputDeviceSDL);
|
||||
const bool isDefaultInput = inputDevice.isEmpty();
|
||||
|
||||
// Try with the configured device
|
||||
@@ -323,15 +323,8 @@ AudioSdl::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
m_playbackDeviceComboBox->addItem(deviceName);
|
||||
}
|
||||
|
||||
QString playbackDevice = ConfigManager::inst()->value(c_sectionSDL, c_playbackDeviceSDL);
|
||||
if (playbackDevice.isEmpty())
|
||||
{
|
||||
m_playbackDeviceComboBox->setCurrentText(s_systemDefaultDevice);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_playbackDeviceComboBox->setCurrentText(playbackDevice);
|
||||
}
|
||||
const auto playbackDevice = ConfigManager::inst()->value(SectionSDL, PlaybackDeviceSDL);
|
||||
m_playbackDeviceComboBox->setCurrentText(playbackDevice.isEmpty() ? s_systemDefaultDevice : playbackDevice);
|
||||
#endif
|
||||
|
||||
form->addRow(tr("Playback device"), m_playbackDeviceComboBox);
|
||||
@@ -349,7 +342,7 @@ AudioSdl::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
}
|
||||
|
||||
// Set the current device to the one in the configuration
|
||||
const auto inputDevice = ConfigManager::inst()->value(c_sectionSDL, c_inputDeviceSDL);
|
||||
const auto inputDevice = ConfigManager::inst()->value(SectionSDL, InputDeviceSDL);
|
||||
if (inputDevice.isEmpty())
|
||||
{
|
||||
m_inputDeviceComboBox->setCurrentText(s_systemDefaultDevice);
|
||||
@@ -372,22 +365,22 @@ void AudioSdl::setupWidget::saveSettings()
|
||||
if (currentPlaybackDevice == s_systemDefaultDevice)
|
||||
{
|
||||
// Represent the default input device with an empty string
|
||||
ConfigManager::inst()->setValue(c_sectionSDL, c_playbackDeviceSDL, "");
|
||||
ConfigManager::inst()->setValue(SectionSDL, PlaybackDeviceSDL, "");
|
||||
}
|
||||
else if (!currentPlaybackDevice.isEmpty())
|
||||
{
|
||||
ConfigManager::inst()->setValue(c_sectionSDL, c_playbackDeviceSDL, currentPlaybackDevice);
|
||||
ConfigManager::inst()->setValue(SectionSDL, PlaybackDeviceSDL, currentPlaybackDevice);
|
||||
}
|
||||
|
||||
const auto currentInputDevice = m_inputDeviceComboBox->currentText();
|
||||
if (currentInputDevice == s_systemDefaultDevice)
|
||||
{
|
||||
// Represent the default input device with an empty string
|
||||
ConfigManager::inst()->setValue(c_sectionSDL, c_inputDeviceSDL, "");
|
||||
ConfigManager::inst()->setValue(SectionSDL, InputDeviceSDL, "");
|
||||
}
|
||||
else if (!currentInputDevice.isEmpty())
|
||||
{
|
||||
ConfigManager::inst()->setValue(c_sectionSDL, c_inputDeviceSDL, currentInputDevice);
|
||||
ConfigManager::inst()->setValue(SectionSDL, InputDeviceSDL, currentInputDevice);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <QPainter>
|
||||
|
||||
#include "AudioEngine.h"
|
||||
#include "ClipView.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "AutomationEditor.h"
|
||||
#include "embed.h"
|
||||
@@ -63,7 +64,7 @@ SampleClipView::SampleClipView( SampleClip * _clip, TrackView * _tv ) :
|
||||
setStyle( QApplication::style() );
|
||||
|
||||
// To simplify the code we always create the widget but we do not always show it
|
||||
m_recordWidget = buildRecordWidget(_clip->getRecordModel());
|
||||
m_recordWidget = buildRecordWidget(_clip->recordModel());
|
||||
m_recordWidget->setVisible(recordingCapabilitiesAvailable());
|
||||
|
||||
adjustRecordWidget();
|
||||
@@ -91,7 +92,7 @@ void SampleClipView::constructContextMenu(QMenu* cm)
|
||||
|
||||
QAction* recordToggleAction = cm->addAction(embed::getIconPixmap("record"),
|
||||
tr("Toggle record"),
|
||||
m_clip, SLOT(toggleRecord()));
|
||||
m_clip, &SampleClip::toggleRecord);
|
||||
|
||||
recordToggleAction->setEnabled(recordingCapabilitiesAvailable());
|
||||
|
||||
@@ -328,7 +329,6 @@ void SampleClipView::paintEvent( QPaintEvent * pe )
|
||||
void SampleClipView::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
adjustRecordWidget();
|
||||
|
||||
ClipView::resizeEvent(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -1024,8 +1024,10 @@ SongEditorWindow::SongEditorWindow(Song* song) :
|
||||
|
||||
// In case our current audio device does not support capture,
|
||||
// disable the record buttons.
|
||||
if(!Engine::audioEngine()->captureDeviceAvailable()) {
|
||||
for (auto &recordAction : {m_recordAccompanyAction, m_recordAction}) {
|
||||
if (!Engine::audioEngine()->captureDeviceAvailable())
|
||||
{
|
||||
for (auto &recordAction : {m_recordAccompanyAction, m_recordAction})
|
||||
{
|
||||
recordAction->setEnabled(false);
|
||||
recordAction->setToolTip(tr("Recording is unavailable: try connecting an input device or switching backend"));
|
||||
}
|
||||
|
||||
@@ -118,7 +118,8 @@ bool SampleTrack::play( const TimePos & _start, const fpp_t _frames,
|
||||
f_cnt_t samplePlayLength = clipFrameLength > sampleBufferLength ? sampleBufferLength : clipFrameLength;
|
||||
|
||||
// In case we are recoding, "play" the whole TCO.
|
||||
if (sClip->isRecord()) {
|
||||
if (sClip->isRecord())
|
||||
{
|
||||
samplePlayLength = clipFrameLength;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user