clang-tidy: Apply modernize-avoid-c-arrays everywhere (#6564)
Co-authored-by: Dominic Clark <mrdomclark@gmail.com> Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
This commit is contained in:
@@ -89,19 +89,27 @@ const std::vector<ProjectVersion> DataFile::UPGRADE_VERSIONS = {
|
||||
"1.2.0-rc3" , "1.3.0"
|
||||
};
|
||||
|
||||
DataFile::typeDescStruct
|
||||
DataFile::s_types[DataFile::TypeCount] =
|
||||
namespace
|
||||
{
|
||||
{ DataFile::UnknownType, "unknown" },
|
||||
{ DataFile::SongProject, "song" },
|
||||
{ DataFile::SongProjectTemplate, "songtemplate" },
|
||||
{ DataFile::InstrumentTrackSettings, "instrumenttracksettings" },
|
||||
{ DataFile::DragNDropData, "dnddata" },
|
||||
{ DataFile::ClipboardData, "clipboard-data" },
|
||||
{ DataFile::JournalData, "journaldata" },
|
||||
{ DataFile::EffectSettings, "effectsettings" },
|
||||
{ DataFile::MidiClip, "midiclip" }
|
||||
} ;
|
||||
struct TypeDescStruct
|
||||
{
|
||||
DataFile::Type m_type;
|
||||
QString m_name;
|
||||
};
|
||||
|
||||
const auto s_types = std::array<TypeDescStruct, DataFile::TypeCount>
|
||||
{
|
||||
TypeDescStruct{ DataFile::UnknownType, "unknown" },
|
||||
TypeDescStruct{ DataFile::SongProject, "song" },
|
||||
TypeDescStruct{ DataFile::SongProjectTemplate, "songtemplate" },
|
||||
TypeDescStruct{ DataFile::InstrumentTrackSettings, "instrumenttracksettings" },
|
||||
TypeDescStruct{ DataFile::DragNDropData, "dnddata" },
|
||||
TypeDescStruct{ DataFile::ClipboardData, "clipboard-data" },
|
||||
TypeDescStruct{ DataFile::JournalData, "journaldata" },
|
||||
TypeDescStruct{ DataFile::EffectSettings, "effectsettings" },
|
||||
TypeDescStruct{ DataFile::MidiClip, "midiclip" }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ bool Instrument::isFromTrack( const Track * _track ) const
|
||||
static int countZeroCrossings(sampleFrame *buf, fpp_t start, fpp_t frames)
|
||||
{
|
||||
// zero point crossing counts of all channels
|
||||
int zeroCrossings[DEFAULT_CHANNELS] = {0};
|
||||
auto zeroCrossings = std::array<int, DEFAULT_CHANNELS>{};
|
||||
// maximum zero point crossing of all channels
|
||||
int maxZeroCrossings = 0;
|
||||
|
||||
|
||||
@@ -34,9 +34,10 @@
|
||||
namespace lmms
|
||||
{
|
||||
|
||||
|
||||
InstrumentFunctionNoteStacking::ChordTable::Init InstrumentFunctionNoteStacking::ChordTable::s_initTable[] =
|
||||
{
|
||||
std::array<InstrumentFunctionNoteStacking::ChordTable::Init, InstrumentFunctionNoteStacking::NUM_CHORD_TABLES>
|
||||
InstrumentFunctionNoteStacking::ChordTable::s_initTable =
|
||||
std::array<InstrumentFunctionNoteStacking::ChordTable::Init, NUM_CHORD_TABLES>
|
||||
{{
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "octave" ), { 0, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Major" ), { 0, 4, 7, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Majb5" ), { 0, 4, 6, -1 } },
|
||||
@@ -139,7 +140,7 @@ InstrumentFunctionNoteStacking::ChordTable::Init InstrumentFunctionNoteStacking:
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "5" ), { 0, 7, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Phrygian dominant" ), { 0, 1, 4, 5, 7, 8, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Persian" ), { 0, 1, 4, 5, 6, 8, 11, -1 } }
|
||||
} ;
|
||||
}};
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ struct AddMultipliedStereoOp
|
||||
dst[1] += src[1] * m_coeffs[1];
|
||||
}
|
||||
|
||||
float m_coeffs[2];
|
||||
std::array<float, 2> m_coeffs;
|
||||
} ;
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ struct MultiplyAndAddMultipliedOp
|
||||
dst[1] = dst[1]*m_coeffs[0] + src[1]*m_coeffs[1];
|
||||
}
|
||||
|
||||
float m_coeffs[2];
|
||||
std::array<float, 2> m_coeffs;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ void Oscillator::generateFromFFT(int bands, sample_t* table)
|
||||
//ifft
|
||||
fftwf_execute(s_ifftPlan);
|
||||
//normalize and copy to result buffer
|
||||
normalize(s_sampleBuffer, table, OscillatorConstants::WAVETABLE_LENGTH, 2*OscillatorConstants::WAVETABLE_LENGTH + 1);
|
||||
normalize(s_sampleBuffer.data(), table, OscillatorConstants::WAVETABLE_LENGTH, 2*OscillatorConstants::WAVETABLE_LENGTH + 1);
|
||||
}
|
||||
|
||||
void Oscillator::generateAntiAliasUserWaveTable(SampleBuffer *sampleBuffer)
|
||||
@@ -205,15 +205,15 @@ sample_t Oscillator::s_waveTables
|
||||
fftwf_plan Oscillator::s_fftPlan;
|
||||
fftwf_plan Oscillator::s_ifftPlan;
|
||||
fftwf_complex * Oscillator::s_specBuf;
|
||||
float Oscillator::s_sampleBuffer[OscillatorConstants::WAVETABLE_LENGTH];
|
||||
std::array<float, OscillatorConstants::WAVETABLE_LENGTH> Oscillator::s_sampleBuffer;
|
||||
|
||||
|
||||
|
||||
void Oscillator::createFFTPlans()
|
||||
{
|
||||
Oscillator::s_specBuf = ( fftwf_complex * ) fftwf_malloc( ( OscillatorConstants::WAVETABLE_LENGTH * 2 + 1 ) * sizeof( fftwf_complex ) );
|
||||
Oscillator::s_fftPlan = fftwf_plan_dft_r2c_1d(OscillatorConstants::WAVETABLE_LENGTH, s_sampleBuffer, s_specBuf, FFTW_MEASURE );
|
||||
Oscillator::s_ifftPlan = fftwf_plan_dft_c2r_1d(OscillatorConstants::WAVETABLE_LENGTH, s_specBuf, s_sampleBuffer, FFTW_MEASURE);
|
||||
Oscillator::s_fftPlan = fftwf_plan_dft_r2c_1d(OscillatorConstants::WAVETABLE_LENGTH, s_sampleBuffer.data(), s_specBuf, FFTW_MEASURE );
|
||||
Oscillator::s_ifftPlan = fftwf_plan_dft_c2r_1d(OscillatorConstants::WAVETABLE_LENGTH, s_specBuf, s_sampleBuffer.data(), FFTW_MEASURE);
|
||||
// initialize s_specBuf content to zero, since the values are used in a condition inside generateFromFFT()
|
||||
for (int i = 0; i < OscillatorConstants::WAVETABLE_LENGTH * 2 + 1; i++)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace lmms::PathUtil
|
||||
{
|
||||
Base relativeBases[] = { Base::ProjectDir, Base::FactorySample, Base::UserSample, Base::UserVST, Base::Preset,
|
||||
auto relativeBases = std::array{ Base::ProjectDir, Base::FactorySample, Base::UserSample, Base::UserVST, Base::Preset,
|
||||
Base::UserLADSPA, Base::DefaultLADSPA, Base::UserSoundfont, Base::DefaultSoundfont, Base::UserGIG, Base::DefaultGIG,
|
||||
Base::LocalDir };
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace lmms::PathUtil
|
||||
//Check if it's a factory sample
|
||||
QString factoryPath = baseLocation(Base::FactorySample) + input;
|
||||
QFileInfo factoryInfo(factoryPath);
|
||||
if (factoryInfo.exists()) { assumedBase = Base::FactorySample; }
|
||||
if (factoryInfo.exists()) { assumedBase = Base::FactorySample; }
|
||||
|
||||
//Check if it's a VST
|
||||
QString vstPath = baseLocation(Base::UserVST) + input;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace lmms
|
||||
|
||||
/*! The black / white order of keys as they appear on the keyboard.
|
||||
*/
|
||||
static const Piano::KeyTypes KEY_ORDER[] =
|
||||
static const auto KEY_ORDER = std::array
|
||||
{
|
||||
// C CIS D DIS
|
||||
Piano::WhiteKey, Piano::BlackKey, Piano::WhiteKey, Piano::BlackKey,
|
||||
|
||||
@@ -39,18 +39,18 @@ namespace lmms
|
||||
{
|
||||
|
||||
|
||||
const ProjectRenderer::FileEncodeDevice ProjectRenderer::fileEncodeDevices[] =
|
||||
const std::array<ProjectRenderer::FileEncodeDevice, 5> ProjectRenderer::fileEncodeDevices
|
||||
{
|
||||
|
||||
{ ProjectRenderer::WaveFile,
|
||||
FileEncodeDevice{ ProjectRenderer::WaveFile,
|
||||
QT_TRANSLATE_NOOP( "ProjectRenderer", "WAV (*.wav)" ),
|
||||
".wav", &AudioFileWave::getInst },
|
||||
{ ProjectRenderer::FlacFile,
|
||||
FileEncodeDevice{ ProjectRenderer::FlacFile,
|
||||
QT_TRANSLATE_NOOP("ProjectRenderer", "FLAC (*.flac)"),
|
||||
".flac",
|
||||
&AudioFileFlac::getInst
|
||||
},
|
||||
{ ProjectRenderer::OggFile,
|
||||
FileEncodeDevice{ ProjectRenderer::OggFile,
|
||||
QT_TRANSLATE_NOOP( "ProjectRenderer", "OGG (*.ogg)" ),
|
||||
".ogg",
|
||||
#ifdef LMMS_HAVE_OGGVORBIS
|
||||
@@ -59,7 +59,7 @@ const ProjectRenderer::FileEncodeDevice ProjectRenderer::fileEncodeDevices[] =
|
||||
nullptr
|
||||
#endif
|
||||
},
|
||||
{ ProjectRenderer::MP3File,
|
||||
FileEncodeDevice{ ProjectRenderer::MP3File,
|
||||
QT_TRANSLATE_NOOP( "ProjectRenderer", "MP3 (*.mp3)" ),
|
||||
".mp3",
|
||||
#ifdef LMMS_HAVE_MP3LAME
|
||||
@@ -71,7 +71,7 @@ const ProjectRenderer::FileEncodeDevice ProjectRenderer::fileEncodeDevices[] =
|
||||
// Insert your own file-encoder infos here.
|
||||
// Maybe one day the user can add own encoders inside the program.
|
||||
|
||||
{ ProjectRenderer::NumFileFormats, nullptr, nullptr, nullptr }
|
||||
FileEncodeDevice{ ProjectRenderer::NumFileFormats, nullptr, nullptr, nullptr }
|
||||
|
||||
} ;
|
||||
|
||||
@@ -224,8 +224,8 @@ void ProjectRenderer::updateConsoleProgress()
|
||||
{
|
||||
const int cols = 50;
|
||||
static int rot = 0;
|
||||
char buf[80];
|
||||
char prog[cols+1];
|
||||
auto buf = std::array<char, 80>{};
|
||||
auto prog = std::array<char, cols + 1>{};
|
||||
|
||||
for( int i = 0; i < cols; ++i )
|
||||
{
|
||||
@@ -234,12 +234,12 @@ void ProjectRenderer::updateConsoleProgress()
|
||||
prog[cols] = 0;
|
||||
|
||||
const auto activity = (const char*)"|/-\\";
|
||||
memset( buf, 0, sizeof( buf ) );
|
||||
sprintf( buf, "\r|%s| %3d%% %c ", prog, m_progress,
|
||||
std::fill(buf.begin(), buf.end(), 0);
|
||||
sprintf(buf.data(), "\r|%s| %3d%% %c ", prog.data(), m_progress,
|
||||
activity[rot] );
|
||||
rot = ( rot+1 ) % 4;
|
||||
|
||||
fprintf( stderr, "%s", buf );
|
||||
fprintf( stderr, "%s", buf.data() );
|
||||
fflush( stderr );
|
||||
}
|
||||
|
||||
|
||||
@@ -1067,7 +1067,7 @@ void SampleBuffer::visualize(
|
||||
float maxData = -1;
|
||||
float minData = 1;
|
||||
|
||||
float rmsData[2] = {0, 0};
|
||||
auto rmsData = std::array<float, 2>{};
|
||||
|
||||
// Find maximum and minimum samples within range
|
||||
for (int i = 0; i < fpp && frame + i <= last; ++i)
|
||||
|
||||
@@ -96,7 +96,7 @@ void AudioFileFlac::writeBuffer(surroundSampleFrame const* _ab, fpp_t const fram
|
||||
|
||||
if (depth == OutputSettings::Depth_24Bit || depth == OutputSettings::Depth_32Bit) // Float encoding
|
||||
{
|
||||
std::unique_ptr<sample_t[]> buf{ new sample_t[frames*channels()] };
|
||||
auto buf = std::vector<sample_t>(frames * channels());
|
||||
for(fpp_t frame = 0; frame < frames; ++frame)
|
||||
{
|
||||
for(ch_cnt_t channel=0; channel<channels(); ++channel)
|
||||
@@ -107,13 +107,13 @@ void AudioFileFlac::writeBuffer(surroundSampleFrame const* _ab, fpp_t const fram
|
||||
buf[frame*channels() + channel] = qMax( clipvalue, _ab[frame][channel] * master_gain );
|
||||
}
|
||||
}
|
||||
sf_writef_float(m_sf,static_cast<float*>(buf.get()),frames);
|
||||
sf_writef_float(m_sf, static_cast<float*>(buf.data()), frames);
|
||||
}
|
||||
else // integer PCM encoding
|
||||
{
|
||||
std::unique_ptr<int_sample_t[]> buf{ new int_sample_t[frames*channels()] };
|
||||
convertToS16(_ab, frames, master_gain, buf.get(), !isLittleEndian());
|
||||
sf_writef_short(m_sf, static_cast<short*>(buf.get()), frames);
|
||||
auto buf = std::vector<int_sample_t>(frames * channels());
|
||||
convertToS16(_ab, frames, master_gain, buf.data(), !isLittleEndian());
|
||||
sf_writef_short(m_sf, static_cast<short*>(buf.data()), frames);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ Plugin::PluginTypes Lv2Proc::check(const LilvPlugin *plugin,
|
||||
{
|
||||
unsigned maxPorts = lilv_plugin_get_num_ports(plugin);
|
||||
enum { inCount, outCount, maxCount };
|
||||
unsigned audioChannels[maxCount] = { 0, 0 }; // audio input and output count
|
||||
unsigned midiChannels[maxCount] = { 0, 0 }; // MIDI input and output count
|
||||
auto audioChannels = std::array<unsigned, maxCount>{}; // audio input and output count
|
||||
auto midiChannels = std::array<unsigned, maxCount>{}; // MIDI input and output count
|
||||
|
||||
const char* pluginUri = lilv_node_as_uri(lilv_plugin_get_uri(plugin));
|
||||
//qDebug() << "Checking plugin" << pluginUri << "...";
|
||||
@@ -247,11 +247,11 @@ void Lv2Proc::copyModelsFromCore()
|
||||
ev.time.frames(Engine::framesPerTick()) + ev.offset;
|
||||
uint32_t type = Engine::getLv2Manager()->
|
||||
uridCache()[Lv2UridCache::Id::midi_MidiEvent];
|
||||
uint8_t buf[4];
|
||||
std::size_t bufsize = writeToByteSeq(ev.ev, buf, sizeof(buf));
|
||||
auto buf = std::array<uint8_t, 4>{};
|
||||
std::size_t bufsize = writeToByteSeq(ev.ev, buf.data(), buf.size());
|
||||
if(bufsize)
|
||||
{
|
||||
lv2_evbuf_write(&iter, atomStamp, type, bufsize, buf);
|
||||
lv2_evbuf_write(&iter, atomStamp, type, bufsize, buf.data());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ void MidiAlsaRaw::sendByte( unsigned char c )
|
||||
|
||||
void MidiAlsaRaw::run()
|
||||
{
|
||||
unsigned char buf[128];
|
||||
auto buf = std::array<unsigned char, 128>{};
|
||||
//int cnt = 0;
|
||||
while( m_quit == false )
|
||||
{
|
||||
@@ -149,7 +149,7 @@ void MidiAlsaRaw::run()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
err = snd_rawmidi_read( m_input, buf, sizeof( buf ) );
|
||||
err = snd_rawmidi_read(m_input, buf.data(), buf.size());
|
||||
if( err == -EAGAIN )
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -241,7 +241,7 @@ void MidiAlsaSeq::applyPortMode( MidiPort * _port )
|
||||
m_seqMutex.lock();
|
||||
|
||||
// determine port-capabilities
|
||||
unsigned int caps[2] = { 0, 0 };
|
||||
auto caps = std::array<unsigned int, 2>{};
|
||||
|
||||
switch( _port->mode() )
|
||||
{
|
||||
|
||||
@@ -105,10 +105,10 @@ void MidiClientRaw::parseData( const unsigned char c )
|
||||
/* 'Process' system real-time messages */
|
||||
/*********************************************************************/
|
||||
/* There are not too many real-time messages that are of interest here.
|
||||
* They can occur anywhere, even in the middle of a noteon message!
|
||||
* They can occur anywhere, even in the middle of a noteon message!
|
||||
* Real-time range: 0xF8 .. 0xFF
|
||||
* Note: Real-time does not affect (running) status.
|
||||
*/
|
||||
*/
|
||||
if( c >= 0xF8 )
|
||||
{
|
||||
if( c == MidiSystemReset )
|
||||
@@ -124,13 +124,13 @@ void MidiClientRaw::parseData( const unsigned char c )
|
||||
/* 'Process' system common messages (again, just skip them) */
|
||||
/*********************************************************************/
|
||||
/* There are no system common messages that are of interest here.
|
||||
* System common range: 0xF0 .. 0xF7
|
||||
* System common range: 0xF0 .. 0xF7
|
||||
*/
|
||||
if( c > 0xF0 )
|
||||
{
|
||||
/* MIDI spec say: To ignore a non-real-time message, just discard all
|
||||
* data up to the next status byte. And our parser will ignore data
|
||||
* that is received without a valid status.
|
||||
* that is received without a valid status.
|
||||
* Note: system common cancels running status. */
|
||||
m_midiParseData.m_status = 0;
|
||||
return;
|
||||
@@ -186,14 +186,14 @@ void MidiClientRaw::parseData( const unsigned char c )
|
||||
/*********************************************************************/
|
||||
/* Send the event */
|
||||
/*********************************************************************/
|
||||
/* The event is ready-to-go. About 'running status':
|
||||
*
|
||||
/* The event is ready-to-go. About 'running status':
|
||||
*
|
||||
* The MIDI protocol has a built-in compression mechanism. If several
|
||||
* similar events are sent in-a-row, for example note-ons, then the
|
||||
* event type is only sent once. For this case, the last event type
|
||||
* (status) is remembered.
|
||||
* We simply keep the status as it is, just reset the parameter counter.
|
||||
* If another status byte comes in, it will overwrite the status.
|
||||
* If another status byte comes in, it will overwrite the status.
|
||||
*/
|
||||
m_midiParseData.m_midiEvent.setType(static_cast<MidiEventTypes>(m_midiParseData.m_status));
|
||||
m_midiParseData.m_midiEvent.setChannel(m_midiParseData.m_channel);
|
||||
@@ -224,7 +224,7 @@ void MidiClientRaw::parseData( const unsigned char c )
|
||||
m_midiParseData.m_midiEvent.setPitchBend((m_midiParseData.m_buffer[1] * 128) | m_midiParseData.m_buffer[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
// Unlikely
|
||||
return;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ void MidiClientRaw::processOutEvent(const MidiEvent& event, const TimePos&, cons
|
||||
|
||||
|
||||
// Taken from Nagano Daisuke's USB-MIDI driver
|
||||
static const unsigned char REMAINS_F0F6[] =
|
||||
static const auto REMAINS_F0F6 = std::array<unsigned char, 7>
|
||||
{
|
||||
0, /* 0xF0 */
|
||||
2, /* 0XF1 */
|
||||
@@ -282,7 +282,7 @@ static const unsigned char REMAINS_F0F6[] =
|
||||
1 /* 0XF6 */
|
||||
} ;
|
||||
|
||||
static const unsigned char REMAINS_80E0[] =
|
||||
static const auto REMAINS_80E0 = std::array<unsigned char, 7>
|
||||
{
|
||||
3, /* 0x8X Note Off */
|
||||
3, /* 0x9X Note On */
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <array>
|
||||
|
||||
#include <QFile>
|
||||
#include <QApplication>
|
||||
@@ -71,7 +72,7 @@ QLinearGradient getGradient( const QColor & _col, const QRectF & _rect )
|
||||
QLinearGradient darken( const QLinearGradient & _gradient )
|
||||
{
|
||||
QGradientStops stops = _gradient.stops();
|
||||
for (auto& stop : stops)
|
||||
for (auto& stop : stops)
|
||||
{
|
||||
QColor color = stop.second;
|
||||
stop.second = color.lighter(133);
|
||||
@@ -216,8 +217,8 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element,
|
||||
int a50 = static_cast<int>( a100 * .6 );
|
||||
int a25 = static_cast<int>( a100 * .33 );
|
||||
|
||||
QLine lines[4];
|
||||
QPoint points[4];
|
||||
auto lines = std::array<QLine, 4>{};
|
||||
auto points = std::array<QPoint, 4>{};
|
||||
|
||||
// black inside lines
|
||||
// 50%
|
||||
@@ -231,7 +232,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element,
|
||||
rect.left() + 1, rect.bottom() - 2);
|
||||
lines[3] = QLine(rect.right() - 1, rect.top() + 2,
|
||||
rect.right() - 1, rect.bottom() - 2);
|
||||
painter->drawLines(lines, 4);
|
||||
painter->drawLines(lines.data(), 4);
|
||||
|
||||
// black inside dots
|
||||
black.setAlpha(a50);
|
||||
@@ -240,7 +241,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element,
|
||||
points[1] = QPoint(rect.left() + 2, rect.bottom() - 2);
|
||||
points[2] = QPoint(rect.right() - 2, rect.top() + 2);
|
||||
points[3] = QPoint(rect.right() - 2, rect.bottom() - 2);
|
||||
painter->drawPoints(points, 4);
|
||||
painter->drawPoints(points.data(), 4);
|
||||
|
||||
|
||||
// outside lines - shadow
|
||||
@@ -251,7 +252,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element,
|
||||
rect.right() - 2, rect.top());
|
||||
lines[1] = QLine(rect.left(), rect.top() + 2,
|
||||
rect.left(), rect.bottom() - 2);
|
||||
painter->drawLines(lines, 2);
|
||||
painter->drawLines(lines.data(), 2);
|
||||
|
||||
// outside corner dots - shadow
|
||||
// 75%
|
||||
@@ -259,7 +260,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element,
|
||||
painter->setPen(QPen(shadow, 0));
|
||||
points[0] = QPoint(rect.left() + 1, rect.top() + 1);
|
||||
points[1] = QPoint(rect.right() - 1, rect.top() + 1);
|
||||
painter->drawPoints(points, 2);
|
||||
painter->drawPoints(points.data(), 2);
|
||||
|
||||
// outside end dots - shadow
|
||||
// 50%
|
||||
@@ -269,7 +270,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element,
|
||||
points[1] = QPoint(rect.left(), rect.top() + 1);
|
||||
points[2] = QPoint(rect.right() - 1, rect.top());
|
||||
points[3] = QPoint(rect.left(), rect.bottom() - 1);
|
||||
painter->drawPoints(points, 4);
|
||||
painter->drawPoints(points.data(), 4);
|
||||
|
||||
|
||||
// outside lines - highlight
|
||||
@@ -280,7 +281,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element,
|
||||
rect.right() - 2, rect.bottom());
|
||||
lines[1] = QLine(rect.right(), rect.top() + 2,
|
||||
rect.right(), rect.bottom() - 2);
|
||||
painter->drawLines(lines, 2);
|
||||
painter->drawLines(lines.data(), 2);
|
||||
|
||||
// outside corner dots - highlight
|
||||
// 75%
|
||||
@@ -288,7 +289,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element,
|
||||
painter->setPen(QPen(highlight, 0));
|
||||
points[0] = QPoint(rect.left() + 1, rect.bottom() - 1);
|
||||
points[1] = QPoint(rect.right() - 1, rect.bottom() - 1);
|
||||
painter->drawPoints(points, 2);
|
||||
painter->drawPoints(points.data(), 2);
|
||||
|
||||
// outside end dots - highlight
|
||||
// 50%
|
||||
@@ -298,7 +299,7 @@ void LmmsStyle::drawPrimitive( PrimitiveElement element,
|
||||
points[1] = QPoint(rect.right(), rect.bottom() - 1);
|
||||
points[2] = QPoint(rect.left() + 1, rect.bottom());
|
||||
points[3] = QPoint(rect.right(), rect.top() + 1);
|
||||
painter->drawPoints(points, 4);
|
||||
painter->drawPoints(points.data(), 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -968,8 +968,8 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
|
||||
{
|
||||
if( m_y_auto )
|
||||
{
|
||||
int y[] = { grid_bottom, TOP_MARGIN + font_height / 2 };
|
||||
float level[] = { m_minLevel, m_maxLevel };
|
||||
auto y = std::array{grid_bottom, TOP_MARGIN + font_height / 2};
|
||||
auto level = std::array{m_minLevel, m_maxLevel};
|
||||
for( int i = 0; i < 2; ++i )
|
||||
{
|
||||
const QString & label = m_clip->firstObject()
|
||||
|
||||
@@ -129,7 +129,7 @@ QPixmap* PianoRoll::s_toolKnife = nullptr;
|
||||
|
||||
TextFloat * PianoRoll::s_textFloat = nullptr;
|
||||
|
||||
static QString s_noteStrings[12] = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"};
|
||||
static std::array<QString, 12> s_noteStrings {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"};
|
||||
|
||||
static QString getNoteString(int key)
|
||||
{
|
||||
@@ -137,7 +137,7 @@ static QString getNoteString(int key)
|
||||
}
|
||||
|
||||
// used for drawing of piano
|
||||
PianoRoll::PianoRollKeyTypes PianoRoll::prKeyOrder[] =
|
||||
std::array<PianoRoll::PianoRollKeyTypes, 12> PianoRoll::prKeyOrder
|
||||
{
|
||||
PR_WHITE_KEY_SMALL, PR_BLACK_KEY, PR_WHITE_KEY_BIG, PR_BLACK_KEY,
|
||||
PR_WHITE_KEY_SMALL, PR_WHITE_KEY_SMALL, PR_BLACK_KEY, PR_WHITE_KEY_BIG,
|
||||
@@ -369,10 +369,10 @@ PianoRoll::PianoRoll() :
|
||||
// Set up note length model
|
||||
m_noteLenModel.addItem( tr( "Last note" ),
|
||||
std::make_unique<PixmapLoader>( "edit_draw" ) );
|
||||
const QString pixmaps[] = { "whole", "half", "quarter", "eighth",
|
||||
const auto pixmaps = std::array<QString, 11>{"whole", "half", "quarter", "eighth",
|
||||
"sixteenth", "thirtysecond", "triplethalf",
|
||||
"tripletquarter", "tripleteighth",
|
||||
"tripletsixteenth", "tripletthirtysecond" } ;
|
||||
"tripletsixteenth", "tripletthirtysecond"};
|
||||
|
||||
for( int i = 0; i < NUM_EVEN_LENGTHS; ++i )
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace lmms::gui
|
||||
|
||||
/*! The scale of C Major - white keys only.
|
||||
*/
|
||||
Keys WhiteKeys[] =
|
||||
auto WhiteKeys = std::array
|
||||
{
|
||||
Key_C, Key_D, Key_E, Key_F, Key_G, Key_A, Key_H
|
||||
} ;
|
||||
|
||||
@@ -79,14 +79,14 @@ ExportProjectDialog::ExportProjectDialog( const QString & _file_name,
|
||||
cbIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int const MAX_LEVEL=8;
|
||||
for(int i=0; i<=MAX_LEVEL; ++i)
|
||||
{
|
||||
QString info="";
|
||||
if ( i==0 ){ info = tr( "( Fastest - biggest )" ); }
|
||||
else if ( i==MAX_LEVEL ){ info = tr( "( Slowest - smallest )" ); }
|
||||
|
||||
|
||||
compLevelCB->addItem(
|
||||
QString::number(i)+" "+info,
|
||||
QVariant(i/static_cast<double>(MAX_LEVEL))
|
||||
@@ -159,8 +159,8 @@ void ExportProjectDialog::startExport()
|
||||
static_cast<AudioEngine::qualitySettings::Interpolation>(interpolationCB->currentIndex()),
|
||||
static_cast<AudioEngine::qualitySettings::Oversampling>(oversamplingCB->currentIndex()) );
|
||||
|
||||
const int samplerates[5] = { 44100, 48000, 88200, 96000, 192000 };
|
||||
const bitrate_t bitrates[6] = { 64, 128, 160, 192, 256, 320 };
|
||||
const auto samplerates = std::array{44100, 48000, 88200, 96000, 192000};
|
||||
const auto bitrates = std::array{64, 128, 160, 192, 256, 320};
|
||||
|
||||
bool useVariableBitRate = checkBoxVariableBitRate->isChecked();
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace lmms::gui
|
||||
{
|
||||
|
||||
|
||||
static const QString names[LedCheckBox::NumColors] =
|
||||
static const auto names = std::array<QString, 3>
|
||||
{
|
||||
"led_yellow", "led_green", "led_red"
|
||||
} ;
|
||||
|
||||
Reference in New Issue
Block a user