I finally tested my wait method... it works but it locks up the system... Does anyone know how to do a "DoEvents" in the delay loop? In VB6 and C# there was a DoEvents method that let the system do stuff while your app was in a loop....
--
Yes. Put the blocks to be executed inside a Clock Timer event block.
--
--
I was trying to make an app that converts SMS messages to morse code... it would be very hard to do this with a timer...
--
what about reading the answers in your other threads?
a wait method, which locks the system is probably not the best solution, is it?
how many other threads do you want to post about that "solution"?
I was trying to make an app that converts SMS messages to morse code... it would be very hard to do this with a timer...
why? message is coming in in the Message Received event, then convert then message and display it
you do not need a clock component at all
--
What do you want to do with the Morse code? Sound it out?
Record a few mp3 files named dot.mp3, dash.mp3, space.mp3
and queue up the sound file names as you encode each letter.
Play the sounds one at a time using a Player, deleting it off pos 1 of the queue,
and starting the next sound only after when the current one ends.
--
I wanted to scan an SMS one letter at a time and use the phone's vibration to sound it out...
--
According to https://en.wikipedia.org/ wiki/Morse_code
the dot length governs the speed, and the lengths of the dashes, gaps, letter gaps, and word gaps are all multiples of the dot length. which you can use as your Clock interval and the length of a vibration.
If you encode the vibrations and pauses as 1 and 0 respectively, you can queue them all up in a list.
So ABG would code as:
(In Morse: . _ _... _ _ . )
(On the queue:)
1,0,1,1,1,0,0,0,1,1,1,0,1,0,1, 0,1,0,0,0,1,1,1,0,1,1,1,0,1,0, 0,0,0,0,0,0
Say a dot is a leisurely 500 ms.
Set the Clock to 500 ms, always fires, enabled, and the sound to vibrate for 500 ms per shot, initially quiet.
Clock fires:
If queue is not empty.
set local n = 1st element of queue
remove 1st element of queue
if n > 0 then
start vibration for 500 ms.
else do nothing (silence)
end clock routine
That's the entire service routine to play.
It's all in the coding for how to build up the sound queue from the letters.
I haven't tried this myself yet.
I'm betting three consecutive vibrations will melt into one long vibration.
--
댓글 없음:
댓글 쓰기