Hello everyone!
I am trying to develop a software that I can use to sequence animatronic movements. Essentially, I need to be able to load an audio file, press buttons on the keyboard to sequence each movement, and then be able to play it back with the recorded keyboard presses lined back up exactly with the audio. When I press each button on the keyboard (ASDFJKL; which are assignable to many different movements), a serial command needs to be sent to an Arduino which controls the animatronic. Each movement can be recorded separately or eight of them at the same time. With each additional pass of animation, the previous passes also need to be simultaneously played back.
I have all of this working to a certain degree in a VC# program, but the playback timing is very poor. Each movement is always a little early or late to turn on or off. I am using the multimedia timer on this website for timing. Each time I press or release a key on the keyboard, a serial command is sent to the Arduino and the current timer position is saved in a list box. When the show is played back, each timer tick checks each list box to see if the current position matches the selected entry in the list box. If it does, the corresponding serial command is sent out and the selected entry in the list box is advanced by one.
Is there a way I can improve the timing? I really would like the audio and movements to line up the exact same every time and to exactly match the timing from when I pressed the buttons originally. I am not opposed to trying a totally different approach and starting all over, and I'd prefer to stay using Visual Studio (VB, VC#, or VC++ are all fine), but at this point I'm willing to use anything that would work.
Do I need a real time OS to do this? I really don't think I do because I've seen similar software that works just fine on a regular Windows computer (like this one).
I feel like I may have been a bit unclear, so if anyone wants to see some of my code or needs clarification on something, please ask.
I am trying to develop a software that I can use to sequence animatronic movements. Essentially, I need to be able to load an audio file, press buttons on the keyboard to sequence each movement, and then be able to play it back with the recorded keyboard presses lined back up exactly with the audio. When I press each button on the keyboard (ASDFJKL; which are assignable to many different movements), a serial command needs to be sent to an Arduino which controls the animatronic. Each movement can be recorded separately or eight of them at the same time. With each additional pass of animation, the previous passes also need to be simultaneously played back.
I have all of this working to a certain degree in a VC# program, but the playback timing is very poor. Each movement is always a little early or late to turn on or off. I am using the multimedia timer on this website for timing. Each time I press or release a key on the keyboard, a serial command is sent to the Arduino and the current timer position is saved in a list box. When the show is played back, each timer tick checks each list box to see if the current position matches the selected entry in the list box. If it does, the corresponding serial command is sent out and the selected entry in the list box is advanced by one.
Is there a way I can improve the timing? I really would like the audio and movements to line up the exact same every time and to exactly match the timing from when I pressed the buttons originally. I am not opposed to trying a totally different approach and starting all over, and I'd prefer to stay using Visual Studio (VB, VC#, or VC++ are all fine), but at this point I'm willing to use anything that would work.
Do I need a real time OS to do this? I really don't think I do because I've seen similar software that works just fine on a regular Windows computer (like this one).
I feel like I may have been a bit unclear, so if anyone wants to see some of my code or needs clarification on something, please ask.