Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Playing multiple wav files sequentially while waiting for user input

Posted on 1998-11-13
7
Medium Priority
?
206 Views
Last Modified: 2013-11-20
I'm coding a simulation program. I couldn't find an efficient way of playing multiple wav files sequentially  pre specified times meanwhile if a user presses a specified key; stop playing.
I tried to use MCIWnd, but it is costly for such a task, also I thought using ::PlaySound() asynchronously but i couldn't find a way of getting end of play message.
I don't want to get deep into Waveform Audio API internals.
I thought that i can merge these files and make them one wave file. Play it asynchronously. But i couldn't find how to merge wave files.  
0
Comment
Question by:ryildirim
7 Comments
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324657
>> MCIWnd, but it is costly for such a task
Do you mean costly as in sucks up a lot of processor power?

>> ::PlaySound() asynchronously but i couldn't find a way of
>> getting end of play message.

You mean some kind of notification for when the file is done playing?  Unfortunately, with PlaySound, I don't believe there is such a feature, so it will almost certainly not work.

It seems like you could do the last idea with something as simple as "Sound Recorder" but I am not sure.
0
 

Author Comment

by:ryildirim
ID: 1324658
No I don't mean processing power, i mean that this is only a simple task and dealing with mciwnd in my application may bring too much overhead.

I mean a notification. In WaveForm api there is such a notification like PLAY_DONE or something like. But i find using Wave Form API too low level for such a task.

Merging files with sound recorder would be ok if i had specified them at design time. But these files will be merged at run-time.
0
 
LVL 2

Expert Comment

by:wyy_cq
ID: 1324659
you will be not able to do that only with MCI API.
either you need to use DirectX.Direct Sound Mixer will implement multiWave files mixture or you need to use 3-part developement library .

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:ryildirim
ID: 1324660
I do not mean mixing several Wave files. I mean to play them sequencially one after another. And in the meantime wait for a user input.
0
 
LVL 2

Accepted Solution

by:
wyy_cq earned 400 total points
ID: 1324661
use MCI Command.
after you open a MCI device

you can send MIC_PLAY command with MCI_NOTIFY flag .
in this case you need specify a HWND ,
when play is over the window will be notified.
after your window receive the notify it can play the next file.

when you call the function ,the file will be played and the function will return at once.

code like under lines:

suppose you have opened the device and the wave file.

MCI_PLAY_PARMS mciPlayPara;
mciPlayPara.dwCallback=(DWORD)hWndNotify;
mciSendCommand(wDeviceID,MCI_PLAY,MCI_NOTIFY,
(DWORD) &mciPlayParameter);

when play to end.
your window will be notified.in your winProc deal with the MCI_NOTIFY message.
or if you use MFC, you need to add a message map of MCI_NOTIFY.

when you want to stop playing.you can send MCI_STOP command.
mciSendCommand(wDeviceID,MCI_STOP,.....);

i hope i can help you . :-)
0
 

Author Comment

by:ryildirim
ID: 1324662
Although this(wyy_cq answer) is something I have tried. But this is a little bit costly for my application. I was looking for an easier/less costly solution)
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1324663
Bought This Question.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

927 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