0

No matter where I look, I can't find a good answer to this question. I'd like to have something happen at a given BPM (in my example, I'm using BPM), but the basic C# Timer class isn't working for me. Since it only measures in milliseconds, any actions performed within the timer get noticeably unsynced from the music. I've attempted to use this MicroTimer Library but with no luck! Though it can be quite fine grained, it's resource heavy and it doesn't have the resolution necessary. I understand I can have a function with a counter, but is there a good way to do this with Visual Studio's libraries (like the basic timer)? I hear those aren't as processor hungry.

Erik Philips
  • 53,428
  • 11
  • 128
  • 150
  • 1
    What you are looking for are multimedia timers, I have used them before for MIDI synchronization what seems to be also your case (or very simmilar). This post has some examples: https://stackoverflow.com/questions/24839105/high-resolution-timer-in-c-sharp – Gusman Sep 10 '17 at 01:33

1 Answers1

-1

I doubt you'll get the kind of time resolution you're looking for in a managed language like C#.

Hell, even if you were writing in C the OS could decide another process is more important and just like that you're out of sync.

Maybe consider using the timer, but resyncing every second or half second? I'd default to another user if they have experience in this area, but I'd at least give that a shot. Or go by the system clock ticks?

Adam Schiavone
  • 2,412
  • 3
  • 32
  • 65
  • Care to explain the downvote? I'd at least like to know why I'm wrong, so I can learn something. – Adam Schiavone Sep 10 '17 at 01:48
  • Because the answer is totally incorrect, as I pointed to the user you can use multimedia timers and you will achieve that resolution and you will not get out of sync as the timer is raised by the OS at kernel level. – Gusman Sep 10 '17 at 02:42