Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

NICE OUTPUT IF I DELAY MY CODE.

Posted on 2004-03-28
16
Medium Priority
?
157 Views
Last Modified: 2010-04-05
I have quiz application.
when the user select answer the program will do the folowing:-

1-background wave will stop.
2-wrong or true wave will play.
3-tow picture will show.
4-timer will stop.
5-move the recorde next.
6-background wave will play.

these steps must happen sequent
how can i control them to delay untill a control action finish.
0
Comment
Question by:sal1150
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 3
16 Comments
 
LVL 11

Accepted Solution

by:
shaneholmes earned 700 total points
ID: 10699182
in order to play and stop a wav file do the following

 PlaySound(PAnsiChar('C:\Sounds\Background.wav'), 0, SND_FILENAME and SND_ASYNC); //play
 PlaySound(nil, 0, 0); //stop

 what is a tow picture?

And i'm not eaxactly sure what you are asking about the rest.

Shane
 
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10699221
Play two waves at the same time is tough...

if you really need multi-channel audio support for different sounds &  background music I believe that Direct Sound is probably the best way to go

This can be done manually using the jedi delphi header transalations

http://www.delphi-jedi.org/

these are the main delphi translations of the directX headers used by C
& C++ programmers.

There is lots of sample code in the jedi sample library.


If you want to play a wave file as background music, then have different speaker sounds for your answer options, this can be done...

Let me know.

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10699252
Zip it up and send it to me (holmesshane AT charter DOT net) and i'll take a look at it for you.

Shane
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 11

Expert Comment

by:shaneholmes
ID: 10699402
sal1150, you will also need to put
mmsystem

in your uses clause

example:

uses windows, forms, ....mmsystem;


also, if you want your back ground music to loop (kee playing), do the following

playsound('c:\mywav.wav',0,SND_ASYNC or SND_LOOP);

Shane
0
 

Author Comment

by:sal1150
ID: 10707272
ooooooooooooh Shane
u do not understand me! I how to play the waves.
I want to control the amount of time

if  the user select answer then ;
true wave will play.
true picture  occurs and wait for (X) milliseconds.
after true picture hide then next record load and program must wait untill record load.
after next record load then background wave will play.

that all.
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10707359
can you zip it up and send it to me and i'll take a look at it, maybe i can understand you better with the code in fron of me.

holmesshane AT charter DOT net
0
 

Assisted Solution

by:necro_ccs
necro_ccs earned 700 total points
ID: 10707528
I think I know what you are after, probably just a Delay function... so you would

sndPlaySound ('sound.wav',SND_FILENAME OR SND_ASYNC);
// "Show True Picture"
Delay (1000); //wait for one second
// "Close True Picture"
and so on.


where delay is something like

function Delay (DelayTime : Cardinal)
var
   Current : Cardinal
begin
  Current := GetTickCount();
  while (GetTickCount() - Current) < DelayTime do
  begin
    Application.ProcessMessages;
  end;
end;
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10707558
Thanks necro_ccs, im glad someone understood and could help out!

Shane
0
 

Expert Comment

by:necro_ccs
ID: 10707579
FYI, that should be "procedure Delay (DelayTime : Cardinal)" not function ;)
0
 

Author Comment

by:sal1150
ID: 10710831

shane I think no need to zip it now because necro_ccs code is good.

Thanks necro_ccs
nice code but how can I use it to wait until row is loading from the table?
 
0
 

Author Comment

by:sal1150
ID: 10726676
How can I use NECRO_CCS code to wait until row is loading from the table?
0
 

Expert Comment

by:necro_ccs
ID: 10727327
How are you loading a row from a table?
Can you do this as a blocking method?
What sort of table are you loading the question from? Is there an event that is triggered when this occurs? My code above is just sort of a very simplified wait function. You could implement the same using a TTimer object as well... please advise.
0
 

Author Comment

by:sal1150
ID: 10753261
my table has more than 2000 records.
and it sort as a random.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question