AlphaTab.Audio.Generator.MidiFileGenerator.GetNoteDuration C# (CSharp) Метод

GetNoteDuration() приватный Метод

private GetNoteDuration ( Note note, int beatDuration ) : int
note AlphaTab.Model.Note
beatDuration int
Результат int
        private int GetNoteDuration(Note note, int beatDuration)
        {
            return ApplyDurationEffects(note, beatDuration);
            // a bit buggy:
            /*
            var lastNoteEnd = note.beat.start - note.beat.calculateDuration();
            var noteDuration = beatDuration;
            var currentBeat = note.beat.nextBeat;

            var letRingSuspend = false;

            // find the real note duration (let ring)
            while (currentBeat != null)
            {
                if (currentBeat.isRest())
                {
                    return applyDurationEffects(note, noteDuration);
                }

                var letRing = currentBeat.voice == note.beat.voice && note.isLetRing;
                var letRingApplied = false;

                // we look for a note which still has let ring on or is a tie destination
                // in this case we increate the first played note
                var noteOnSameString = currentBeat.getNoteOnString(note.string);
                if (noteOnSameString != null)
                {
                    // quit letring?
                    if (!noteOnSameString.isTieDestination)
                    {
                        letRing = false;
                        letRingSuspend = true;

                        // no let ring anymore, we are done
                        if (!noteOnSameString.isLetRing)
                        {
                            return applyDurationEffects(note, noteDuration);
                        }
                    }

                    // increase duration
                    letRingApplied = true;
                    noteDuration += (currentBeat.start - lastNoteEnd) + noteOnSameString.beat.calculateDuration();
                    lastNoteEnd = currentBeat.start + currentBeat.calculateDuration();
                }

                // if letRing is still active? (no note on the same string found)
                // and we didn't apply it already and of course it's not already stopped
                // then we increase our duration as well
                if (letRing && !letRingApplied && !letRingSuspend)
                {
                    noteDuration += (currentBeat.start - lastNoteEnd) + currentBeat.calculateDuration();
                    lastNoteEnd = currentBeat.start + currentBeat.calculateDuration();
                }

                currentBeat = currentBeat.nextBeat;
            }

            return applyDurationEffects(note, noteDuration);*/
        }