@@ -42,7 +42,7 @@ namespace lmms
42
42
MidiClip::MidiClip ( InstrumentTrack * _instrument_track ) :
43
43
Clip ( _instrument_track ),
44
44
m_instrumentTrack ( _instrument_track ),
45
- m_clipType ( Type::BeatClip ),
45
+ m_clipType ( Type::MelodyClip ),
46
46
m_steps ( TimePos::stepsPerBar() )
47
47
{
48
48
if (_instrument_track->trackContainer () == Engine::patternStore ())
@@ -403,10 +403,13 @@ void MidiClip::setType( Type _new_clip_type )
403
403
404
404
void MidiClip::checkType ()
405
405
{
406
- // If all notes are StepNotes, we have a BeatClip
407
- const auto beatClip = std::all_of (m_notes.begin (), m_notes.end (), [](auto note) { return note->type () == Note::Type::Step; });
406
+ // Clip type can only be checked if there are notes
407
+ if (!m_notes.empty ()) {
408
+ // If all notes are StepNotes, we have a BeatClip
409
+ const auto beatClip = std::all_of (m_notes.begin (), m_notes.end (), [](auto note) { return note->type () == Note::Type::Step; });
408
410
409
- setType (beatClip ? Type::BeatClip : Type::MelodyClip);
411
+ setType (beatClip ? Type::BeatClip : Type::MelodyClip);
412
+ }
410
413
}
411
414
412
415
@@ -416,7 +419,7 @@ void MidiClip::saveSettings( QDomDocument & _doc, QDomElement & _this )
416
419
{
417
420
_this.setAttribute ( " type" , static_cast <int >(m_clipType) );
418
421
_this.setAttribute ( " name" , name () );
419
-
422
+
420
423
if (const auto & c = color ())
421
424
{
422
425
_this.setAttribute (" color" , c->name ());
0 commit comments