471,594 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

Playsound loop not working

I need to play a .wav file over and over again. I am using the
following code.

[DllImport("winmm.dll")]
private static extern bool PlaySound( string lpszName, int hModule, int
dwFlags );

public int SND_ASYNC = 0x0001; // play asynchronously
public int SND_LOOP = 0x0008; // loop the sound until next
PlaySound

PlaySound( wavfile, 0, (SND_ASYNC | SND_LOOP));

But it plays only once and stop. Any idea what's wrong ?

Thanks in advance.

Nov 24 '06 #1
3 3053
Hello, tamarindm!

Just a hint in .NET 2.0 there is SoundPlayer class,
that can be used to play sounds and internally uses
PlaySound func


tI need to play a .wav file over and over again. I am using the
tfollowing code.

t[DllImport("winmm.dll")]
tprivate static extern bool PlaySound( string lpszName, int hModule,
tint
tdwFlags );

tpublic int SND_ASYNC = 0x0001; // play asynchronously
tpublic int SND_LOOP = 0x0008; // loop the sound until next
tPlaySound

tPlaySound( wavfile, 0, (SND_ASYNC | SND_LOOP));

tBut it plays only once and stop. Any idea what's wrong ?

tThanks in advance.


--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Nov 24 '06 #2
Thanks but I am using .NET 1.1.

Still need help !
Vadym Stetsyak wrote:
Hello, tamarindm!

Just a hint in .NET 2.0 there is SoundPlayer class,
that can be used to play sounds and internally uses
PlaySound func
tI need to play a .wav file over and over again. I am using the
tfollowing code.

t[DllImport("winmm.dll")]
tprivate static extern bool PlaySound( string lpszName, int hModule,
tint
tdwFlags );

tpublic int SND_ASYNC = 0x0001; // play asynchronously
tpublic int SND_LOOP = 0x0008; // loop the sound until next
tPlaySound

tPlaySound( wavfile, 0, (SND_ASYNC | SND_LOOP));

tBut it plays only once and stop. Any idea what's wrong ?

tThanks in advance.
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Nov 24 '06 #3
Ummm... Thinking of hack between .Net 1.1 and .Net 2.0....

I am thinking of loading .net 2.0 assembly in .net 1.1

system.dll would be good enough.... not much sure about it....let me
try it....

Thanks
-Srinivas.
tamarindm wrote:
I need to play a .wav file over and over again. I am using the
following code.

[DllImport("winmm.dll")]
private static extern bool PlaySound( string lpszName, int hModule, int
dwFlags );

public int SND_ASYNC = 0x0001; // play asynchronously
public int SND_LOOP = 0x0008; // loop the sound until next
PlaySound

PlaySound( wavfile, 0, (SND_ASYNC | SND_LOOP));

But it plays only once and stop. Any idea what's wrong ?

Thanks in advance.
Nov 27 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

19 posts views Thread by bballmitch | last post: by
3 posts views Thread by Harry J. Smith | last post: by
4 posts views Thread by rcattral | last post: by
2 posts views Thread by Joe Thompson | last post: by
10 posts views Thread by Ot | last post: by
9 posts views Thread by Andy | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.