Solved

Playing multiple wav files sequentially while waiting for user input

Posted on 1998-11-13
7
200 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
Technology Partners: 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!

 

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 200 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sum13 challenge 24 135
fizzArray2 challenge 1 103
Dell Alienware Graphics Amplifier Driver for non-Alienware systems 18 478
Windows shortcut location resolution on double click open 4 55
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

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