MultiVoiceMeasure class

Measure with multiple independent voices

Used for polyphonic notation where multiple melodic lines appear on the same staff simultaneously.

Example:

final measure = MultiVoiceMeasure();

// Voice 1 (melody, stems up)
final voice1 = Voice.voice1();
voice1.add(Note(pitch: Pitch(step: 'E', octave: 5), duration: ...));
measure.addVoice(voice1);

// Voice 2 (accompaniment, stems down)
final voice2 = Voice.voice2();
voice2.add(Note(pitch: Pitch(step: 'C', octave: 4), duration: ...));
measure.addVoice(voice2);
Inheritance

Constructors

MultiVoiceMeasure({bool autoBeaming = true, BeamingMode beamingMode = BeamingMode.automatic, List<List<int>> manualBeamGroups = const [], TimeSignature? inheritedTimeSignature})
Constructor for MultiVoiceMeasure
MultiVoiceMeasure.twoVoices({required List<MusicalElement> voice1Elements, required List<MusicalElement> voice2Elements})
Factory: Create measure with 2 voices
factory

Properties

autoBeaming bool
Controla se as notas devem ser automaticamente agrupadas com beams true = auto-beaming ativo (padrão) false = usar bandeirolas individuais (flags)
getter/setter pairinherited
beamingMode BeamingMode
Estratégia específica de beaming para casos especiais
getter/setter pairinherited
currentMusicalValue double
Calcula o valor total atual das figuras musicais no compasso.
no setterinherited
elements List<MusicalElement>
finalinherited
hashCode int
The hash code for this object.
no setterinherited
inheritedTimeSignature TimeSignature?
TimeSignature herdado de compasso anterior (usado para validação preventiva)
getter/setter pairinherited
isPolyphonic bool
Check if measure has multiple voices (is polyphonic)
no setter
isValidlyFilled bool
Verifica se o compasso está corretamente preenchido.
no setterinherited
manualBeamGroups List<List<int>>
Grupos manuais de beams - lista de listas de índices de notas a serem agrupadas Exemplo: [0, 1, 2, 3, 4] = agrupa notas 0,1,2 em um beam e 3,4 em outro
getter/setter pairinherited
remainingValue double
Calcula quanto tempo ainda resta no compasso.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sortedVoices List<Voice>
Get all voices sorted by voice number
no setter
timeSignature TimeSignature?
Obtém a fórmula de compasso ativa neste compasso.
no setterinherited
voice1 Voice?
Get voice 1 (top voice)
no setter
voice2 Voice?
Get voice 2 (bottom voice)
no setter
voiceCount int
Get number of voices in this measure
no setter
voiceNumbers List<int>
Get list of voice numbers (sorted)
no setter
voices Map<int, Voice>
Map of voice number to Voice object
final

Methods

add(MusicalElement element) → void
Adiciona um elemento musical ao compasso.
inherited
addVoice(Voice voice) → void
Add a voice to this measure
canAddDuration(Duration duration) bool
Verifica se ainda há espaço para adicionar uma duração específica.
inherited
getVoice(int number) Voice?
Get voice by number
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited