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

x
?
Solved

Playing multiple wav files sequentially while waiting for user input

Posted on 1998-11-13
7
Medium Priority
?
204 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
[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
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'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.

 

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

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.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
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 …

722 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