melanchall / drywetmidi

.NET library to read, write, process MIDI files and to work with MIDI devices
https://melanchall.github.io/drywetmidi
MIT License
545 stars 75 forks source link

Bars and Beats gone or renamed? #16

Closed manchuwook closed 5 years ago

manchuwook commented 5 years ago

Originally I was using this code

((NotesCollection)noteMan.Notes).ToList()
   .GroupBy(gb => new {
    Bar = gb.TimeAs<MusicalTimeSpan>(tempoMap).Bars,
    Beat = gb.TimeAs<MusicalTimeSpan>(tempoMap).Beats + 1
})

But now it seems they are red after the update. Is there a way I can get those back?

manchuwook commented 5 years ago

Scratch that, it got moved - apologies from me.

melanchall commented 5 years ago

Hi!

Sorry for delay. Glad to know you've solved your problem. But I'd like to notice that MusicalTimeSpan doesn't have Bars and Beats properties. I suppose you are talking about BarBeatTimeSpan.

Also be aware of calling TimeAs multiple times on the same instance of ITimedObject. Each calling will perform some calculations and thus performance can degenerate. Call TimeAs one time and then use properties of returned object.

Thank you for using DryWetMIDI.