Discussion:
timecode synchronization
(too old to reply)
mfc
2012-04-06 14:47:21 UTC
Permalink
Hi,

I want to create a MFC application which receives a midi timecode by a
usb-midi-device for synchronization purpose. Under control of this
"timecode clock" I want to transmit some data packets by serial
ports.

In my solution, I`ll spend an UI-thread for transmitting the serial-
port data as well as another UI-thread for receiving the midi timecode
packets. My document-class has a visible window class (not the
mainframe class) to get received Postmessages from these threads. But
I`m not sure if this is the best setup according to the
synchronization, because if the window-system has to send / process a
lot of messages in the message-pump, it takes some time to send
Postmessages to the visible window as well as to send a message to the
serial-port thread. Are there any well-known clues or programming
techniques?

Unfortunately I don`t know how this will be solved to acchieve the
best synchronization which will be possible using a Windows operating
system device.

best regards
Hans
s***@mvps.org
2012-04-07 02:43:11 UTC
Permalink
Post by mfc
Hi,
I want to create a MFC application which receives a midi timecode by a
usb-midi-device for synchronization purpose. Under control of this
"timecode clock" I want to transmit some data packets by serial
ports.
In my solution, I`ll spend an UI-thread for transmitting the serial-
port data as well as another UI-thread for receiving the midi timecode
packets. My document-class has a visible window class (not the
mainframe class) to get received Postmessages from these threads. But
I`m not sure if this is the best setup according to the
synchronization, because if the window-system has to send / process a
lot of messages in the message-pump, it takes some time to send
Postmessages to the visible window as well as to send a message to the
serial-port thread. Are there any well-known clues or programming
techniques?
Unfortunately I don`t know how this will be solved to acchieve the
best synchronization which will be possible using a Windows operating
system device.
best regards
Hans
It seems very unlikely that handling Windows messages will be a significant bottleneck. That stuff runs in nanoseconds. You have a midi port and a serial port which are far slower, running in milliseconds. So you will probably be I/O bound, not processing bound.

Do everything you can to be I/O efficient in the respective threads. This might include using overlapped I/O and it might include using SetThreadPriority so the I/O threads have higher priority than the main thread.
Loading...