Beispiel #1
0
        private void SetTimeSignature(string text)
        {
            Regex re     = new Regex(@"(\d+)/(\d+)");
            var   result = re.Match(text);

            noteBuilder.SetTimeSignature(new TimeSignature
            {
                NumberOfBeats = int.Parse(result.Groups[1].Value),
                TimeOfBeats   = int.Parse(result.Groups[2].Value)
            });
        }
Beispiel #2
0
        private void handleTimeSignature(MetaMessage metaMessage)
        {
            byte[] timeSignatureBytes = metaMessage.GetBytes();
            var    _beatNote          = timeSignatureBytes[0];
            var    _beatsPerBar       = (int)(1 / Math.Pow(timeSignatureBytes[1], -2));

            currentTimeSignature               = new TimeSignature();
            currentTimeSignature.TimeOfBeats   = _beatNote;
            currentTimeSignature.NumberOfBeats = _beatsPerBar;

            noteBuilder.SetTimeSignature(currentTimeSignature);
        }