Code review changes
* String handling * Initialize member with `nullptr` * Use `constexpr` * Remove `inline` * Fix Whitespace
This commit is contained in:
@@ -357,7 +357,7 @@ private:
|
||||
AudioDevice * tryAudioDevices();
|
||||
MidiClient * tryMidiClients();
|
||||
|
||||
inline const AudioDevice* audioDev() const
|
||||
const AudioDevice* audioDev() const
|
||||
{
|
||||
return m_audioDev;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
void saveSettings() override;
|
||||
|
||||
private:
|
||||
QComboBox* m_playbackDeviceComboBox;
|
||||
QComboBox* m_playbackDeviceComboBox = nullptr;
|
||||
QComboBox* m_inputDeviceComboBox = nullptr;
|
||||
|
||||
static QString s_systemDefaultDevice;
|
||||
|
||||
@@ -54,7 +54,7 @@ SampleRecordHandle::~SampleRecordHandle()
|
||||
{
|
||||
if (!m_buffers.empty()) { m_clip->setSampleBuffer(createSampleBuffer()); }
|
||||
|
||||
m_clip->setStartTimeOffset(m_startRecordTimeOffset);
|
||||
m_clip->setStartTimeOffset(m_startRecordTimeOffset);
|
||||
|
||||
while( !m_buffers.empty() )
|
||||
{
|
||||
|
||||
@@ -82,11 +82,11 @@ AudioSdl::AudioSdl( bool & _success_ful, AudioEngine* _audioEngine ) :
|
||||
SDL_AudioSpec actual;
|
||||
|
||||
#ifdef LMMS_HAVE_SDL2
|
||||
const auto playbackDevice = ConfigManager::inst()->value(SectionSDL, PlaybackDeviceSDL);
|
||||
const bool isDefaultPlayback = playbackDevice.isEmpty();
|
||||
const auto playbackDevice = ConfigManager::inst()->value(SectionSDL, PlaybackDeviceSDL).toStdString();
|
||||
const bool isDefaultPlayback = playbackDevice.empty();
|
||||
|
||||
// Try with the configured device
|
||||
const auto playbackDeviceCStr = isDefaultPlayback ? nullptr : playbackDevice.toLocal8Bit().data();
|
||||
const auto playbackDeviceCStr = isDefaultPlayback ? nullptr : playbackDevice.c_str();
|
||||
m_outputDevice = SDL_OpenAudioDevice(playbackDeviceCStr, 0, &m_audioHandle, &actual, 0);
|
||||
|
||||
// If we did not get a device ID try again with the default device if we did not try that before
|
||||
@@ -120,11 +120,11 @@ AudioSdl::AudioSdl( bool & _success_ful, AudioEngine* _audioEngine ) :
|
||||
m_inputAudioHandle = m_audioHandle;
|
||||
m_inputAudioHandle.callback = sdlInputAudioCallback;
|
||||
|
||||
const auto inputDevice = ConfigManager::inst()->value(SectionSDL, InputDeviceSDL);
|
||||
const bool isDefaultInput = inputDevice.isEmpty();
|
||||
const auto inputDevice = ConfigManager::inst()->value(SectionSDL, InputDeviceSDL).toStdString();
|
||||
const bool isDefaultInput = inputDevice.empty();
|
||||
|
||||
// Try with the configured device
|
||||
const auto inputDeviceCStr = isDefaultInput ? nullptr : inputDevice.toLocal8Bit().data();
|
||||
const auto inputDeviceCStr = isDefaultInput ? nullptr : inputDevice.c_str();
|
||||
m_inputDevice = SDL_OpenAudioDevice (inputDeviceCStr, 1, &m_inputAudioHandle, &actual, 0);
|
||||
|
||||
// If we did not get a device ID try again with the default device if we did not try that before
|
||||
|
||||
@@ -319,11 +319,11 @@ void SampleClipView::paintEvent( QPaintEvent * pe )
|
||||
|
||||
const auto baseLine = height() - 3;
|
||||
|
||||
const int recordSymbolRadius = 3;
|
||||
const int recordSymbolCenterX = recordSymbolRadius + 4;
|
||||
constexpr int recordSymbolRadius = 3;
|
||||
constexpr int recordSymbolCenterX = recordSymbolRadius + 4;
|
||||
const int recordSymbolCenterY = baseLine - fontHeight / 2 + 1;
|
||||
|
||||
const int textStartX = recordSymbolCenterX + recordSymbolRadius + 4;
|
||||
constexpr int textStartX = recordSymbolCenterX + recordSymbolRadius + 4;
|
||||
|
||||
auto textPos = QPoint(textStartX, baseLine);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user