|
The first keystroke doesn't send a message. It simply starts the clock. Every subsequent keystroke adjusts the timing of the clock. The clock keeps running until you stop tapping fast enough (at least 50bpm). Then the clock stops and you must start over.
So basically, it's a treadmill. The first tap turns it on, and you fall off if you don't keep up at which point you have to get back on and do it again.
Real programmers use butterflies
|
|
|
|
|
Quote: I can't declare it as a boolean But you can still use it as boolean in that check, and have it 'cast' to bool. Unless you aren't using '0' in the same way you use 'false' for that variable. If that is the case, UGH!
|
|
|
|
|
i'd sooner declare a const like const int TS_FALSE = 0; and use that then try to cast an int to a bool for no other reason then so i can use "false" there.
The last thing I want to do is introduce spurious casts in code that's not fast enough as it is.
Real programmers use butterflies
|
|
|
|
|
If C#'s IL doesn't treat 'if (a==0)...' the same as 'if (a)...', I'd be very surprised. But then again, I'm not a C# expert.
|
|
|
|
|
I'm not sure what you mean in this context. I think we're talking about two different things.
Real programmers use butterflies
|
|
|
|
|
I doubt the front-end compiler creates different IL code for "if (intVarImpicitlyCastToBool) { }" and "if (intVar != 0) { }". So your hesitancy is baseless. But I could be wrong, because I don't know if C# is that stupid.
|
|
|
|
|
Oh I see what you mean. My experience with C# is that the compiler does very little optimization, even in release builds. Either way, the cast isn't necessary, and IMO doesn't add more clarity than a const would. And frankly, I don't think the zero is bad either, but maybe that's just from decades of treating 0 and false as functionally equivalent as it is in the C world.
Real programmers use butterflies
|
|
|
|
|
Oh, I think maybe i misunderstood what you were asking. Somewhere in the code it sees if _timingTimestamp is zero. If it is, it knows that's the first message. It will clear _timingTimestamp if the messages wind up dropping off or otherwise getting too far apart (timeout)
Real programmers use butterflies
|
|
|
|
|
If you are using the same timing message for the regular 24/beat as the console window sends, you will never be able to tell which is which. And you can't make the appropriate adjustment.
|
|
|
|
|
Umm. I don't need to differentiate which is which, I only need to know how far apart they occur.
A MIDI time clock signal is sent 24 times per quarter note.
That's all my tap tempo transmitter does.
The recorder sees these MIDI time clock signals.
Its job is simply to use them to determine the tempo solely based on how far apart they occur, and adjust its tempo accordingly when it sees them.
I don't need to distinguish between different clock signals (like beginning and end). there is no such concept in the MIDI wire protocol anyway.
Real programmers use butterflies
|
|
|
|
|
I was under the impression that you internally used _timeStamp...'s in the internal processing of the main program. In other words, they were already embedded in the stream for timing purposes. Good luck getting to the bottom of everything!
|
|
|
|
|
Windows performs context switches at a pace that I would call manic, so I don't think it would account for the 20 msecs unless there is semaphore contention or something else going on.
|
|
|
|
|
I'm also not using any locks explicitly inside that codepath except when the tempo changes, which doesn't happen *between* messages
Real programmers use butterflies
|
|
|
|
|
If you visit QA much, you'll recognise this ... Modern Art[^]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Bought right!
I'm not sure how many cookies it makes to be happy, but so far it's not 27.
JaxCoder.com
|
|
|
|
|
He also needs the answer ASAP.
|
|
|
|
|
Too good!
|
|
|
|
|
... (thru' with the two step)
|
|
|
|
|
Does a clock radio go off with alarming frequency?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Not something I toc about very often, but if so, it snooze to me.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
That one just Hertz, period.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
OriginalGriff wrote: Does a clock radio go off with alarming frequency?
every time.
|
|
|
|
|
Only if you leave it out of the fridge... ?
|
|
|
|
|
Since most clock radios use a really annoying high-pitched beeper for the alarm sound, yes they do.
Those among you notice the 'meta' nature of this reply should discuss amongst yourselves while everyone else catches up.
Software Zen: delete this;
|
|
|
|
|
If a clock radio goes off - why is it that the first thing everyone does is turn it off?
Wait - is this back to the no-no thing?!
If you can't laugh at yourself - ask me and I will do it for you.
|
|
|
|