(1) Playing sounds from a files once per second is surely a bad thing. Better play from a memory location, so you load the wav file only once and you have it readily available when the next "beep" is due. A quick google search for "delphi playsound wav memory" found this: http://www.scalabium.com/faq/dct0091.htm;
(2) Are you reseting the Rz timer once every 500 ms so you get a chance to properly decrement a counter? If you're doing that, it's a mistake, because you're introducing a small arbitrary delay twice per second. If the "timing" is for human consumption, the windows timer is accurate enough so I wouldn't use anything else. Just place a TTimer on the form and have it fire every 50 ms or so. In the timer event COMPUTE the time left (ie: don't rely on counters) and display the value accordingly. Computing the time left/elapsed every time it's needed ensures you'll have a constant maximum error and it will be a very small error (humans won't tell). If you depend on counters do inc/dec seconds your error will increase with the number of increments / decrements you do (and eventually humans will notice your clock is a bit slow). I don't think you need a thread for this kind of work. -- Cosmin Prund > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Robert Meek > Sent: Monday, June 25, 2007 5:54 PM > To: [email protected] > Subject: Digital Timing needs AND a component install problem > > Morning all, > It feels great to be back working again, and try as I might I > simply cannot find any faults with the CodeGear release of Delphi 2007! > Great job guys! > Anyway, my current project involves a groups of methods that > control a digital clock, up and down Timer, and a Calendar, and > provides > the user with multiple ways of using sounds and counting procedures for > alarms and such. > Two areas I wish to ask about. > The first is in regards to playing a simple sound file, ( Wav ), > at one second intervals. Right now after trying some of the related > methods and parameters, I'm using 'PlaySound(PChar(SelIntervalWavFile), > 0, SND_ASYNC);' and a wav file that just plays a beep. Other methods > related to this one either cycle out of synch or skip seconds, and > though this one seems to keep up with my timing event, the first couple > beeps play late. I'm not sure where the majority of the problem lies, > but I believe it's due to having to load and re-load the file. Is > there > anyway of loading such a file into memory before the countdown begins > and stays there so that this problem is eliminated? Should I not use a > wav file, a simple system beep in place of it to guarantee good > synching? Is PlaySound from mmSystem the problem? Is there a better > way? Unless someone has a better solution, I'm thinking now of just > using the system Beep for the interval sound and then a custom wav file > at the end of the timing period. > The second question regards the timing method itself. At > present I'm using a Clock/Calendar panel from Raize to display for some > of the methods and a Raize digital control for simple up/down counting. > Either is displayed in place of the other as required at the moment, > but > the Clock/Calendar has it's own OnTimeExpired event which can be set > down to 500ms. For one second timing as displayed on the digital > control, I'm also using this same event and counting by 2's. I don't > necessarily need anything more accurate, but efficient would be the > word > I would choose. Is there a better freeware timer component out > there I haven't found that might help? And should I keep my timing > methods in their own thread? > > Lastly, I'm having difficulty with only one set of > components...those from TMS. I have the latest update files, 4.3, for > this version of Delphi, but I'm having a problem trying to compile the > new packages that is quite odd. I've already contact them about this > but so far they only been able to offer the same solutions I've already > tried. There are no registry entries or loose bpl's lying about my > system, but every time I attempt to compile a dpk or open the entire > project containing all of them and click Open, I get an error for the > first dpk which has a filename of TMSd2007.dpk, and then every other > package as well. It says, "Unable to access TMSd2007.$$$" I figure > that's a temp file it needs to create because none exists with that > extension in the source code, and I have made sure all directories and > source has write access. Could there be a temp dir on my system > somewhere that it is trying to use? Any ideas? > > > from Robert Meek dba "Tangentals Design" > e-mail: [EMAIL PROTECTED] > Freelance Windows Programming for XP and Vista > Also proud to be a Moderator of the "Delphi-List" at elists.org > > "Reality cannot be explained...only enjoyed or endured as your current > perspective allows!" > > > _______________________________________________ > Delphi mailing list -> [email protected] > http://www.elists.org/mailman/listinfo/delphi _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

