By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,825 Members | 1,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,825 IT Pros & Developers. It's quick & easy.

How to suspend and resume in playing a WAV file

P: n/a
I am using winmm.dll and I found that I can't just suspend it and
resume it?

What should I do? Any better idea?

Should I use thread? and thread.suspend will work?

Thanks

Mar 11 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
VJ
If you are on 2.0 Framework try the soundplayer class. I have not used it,
but I assume you might need to use thread to paly/suspend/resume, or maybe
not. Check it out.

VJ

"fAnSKyer/C# newbie" <fa******@gmail.comwrote in message
news:11**********************@8g2000cwh.googlegrou ps.com...
>I am using winmm.dll and I found that I can't just suspend it and
resume it?

What should I do? Any better idea?

Should I use thread? and thread.suspend will work?

Thanks

Mar 11 '07 #2

P: n/a
On Sun, 11 Mar 2007 10:45:19 +0800, fAnSKyer/C# newbie
<fa******@gmail.comwrote:
I am using winmm.dll and I found that I can't just suspend it and
resume it?

What should I do? Any better idea?

Should I use thread? and thread.suspend will work?
It's unlikely that you can simply suspend a thread playing a sound.
First, the thread that calls the API to play the sound is unlikely to have
anything to do with the thread actually playing the sound. Second, the
thread actually playing the sound is likely to be feeding audio samples to
the audio hardware; suspending that thread will just result in the
hardware repeating the same sample over and over.

Fortunately, there is an easier way. :) Look at the AudioVideoPlayback
DirectX component. I am pretty sure that it includes pause/resume
functionality, unlike the basic .NET media SoundPlayer class.

Of course, that said...if you are using winmm.dll (via p/invoke
presumably), the wav/mci API has pause/resume as well, if I recall
correctly. IMHO using the AVP component is easier, since it doesn't
require p/invoke in your application, but you ought to be able to pause
and resume audio playback using the same playback mechanism you're using
now.

Pete
Mar 11 '07 #3

P: n/a
VJ
Ahh the part of hardware, thanks for the update. Yes DirectX is a better
choice.

VJ

"fAnSKyer/C# newbie" <fa******@gmail.comwrote in message
news:11**********************@8g2000cwh.googlegrou ps.com...
>I am using winmm.dll and I found that I can't just suspend it and
resume it?

What should I do? Any better idea?

Should I use thread? and thread.suspend will work?

Thanks

Mar 11 '07 #4

P: n/a
MBR
It's been a while, but if you're using the MCI interface win WINMM (either
the mciSendString version or the command version) you should be able to
pause without a problem.

For example, using mciSendString, if you send:
"play c:\foo.wav alias a"
then you can follow up with:
"pause a"
and
"resume a"

Of course you can also do:
"set a timeformat milliseconds"
"play a from 0 to 23323"
etc...

Hope that helps -
thanks,
m

"fAnSKyer/C# newbie" <fa******@gmail.comwrote in message
news:11**********************@8g2000cwh.googlegrou ps.com...
>I am using winmm.dll and I found that I can't just suspend it and
resume it?

What should I do? Any better idea?

Should I use thread? and thread.suspend will work?

Thanks


--
Posted via a free Usenet account from http://www.teranews.com

Mar 11 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.