PlaySound does n't always play the sound file


G

Guest

Hi,
I use the below code to play a wave file continously on a windows mobile 5.0
device.
i stop the playing of the wave file on press another button.

But after some time the WCE_PlaySound returns 1 but does not play the sound.
This continues for a few minutes.
During this time i cannot play any sound.

Can someone tell me why this is happening and how i can over come this
problem.

[DllImport("coredll.dll", EntryPoint = "PlaySound", SetLastError = true)]
public extern static int WCE_PlaySound(string szSound, IntPtr hMod, int
flags);

public static void PlaySound(string fileName)
{
if (fileName != null && fileName != "")
{
int iSuc = WCE_PlaySound(RingTone, IntPtr.Zero,
(int)(Flags.SND_ASYNC | Flags.SND_FILENAME | Flags.SND_LOOP));
if(iSuc == 0)
MessageBox.Show("Error");
}
}

public static void StopPlaySound(string File)
{
int SND_PURGE = 0x0040;
WCE_PlaySound(File, IntPtr.Zero, SND_PURGE);
}

Thanks in Advance,
Murthy
 
Ad

Advertisements

G

Guest

Its a windows mobile 5.0 based device from symbol [MC 9090 Series].

Paul G. Tobey said:
Device details?

Paul T.

Murthy said:
Hi,
I use the below code to play a wave file continously on a windows mobile
5.0
device.
i stop the playing of the wave file on press another button.

But after some time the WCE_PlaySound returns 1 but does not play the
sound.
This continues for a few minutes.
During this time i cannot play any sound.

Can someone tell me why this is happening and how i can over come this
problem.

[DllImport("coredll.dll", EntryPoint = "PlaySound", SetLastError = true)]
public extern static int WCE_PlaySound(string szSound, IntPtr hMod, int
flags);

public static void PlaySound(string fileName)
{
if (fileName != null && fileName != "")
{
int iSuc = WCE_PlaySound(RingTone, IntPtr.Zero,
(int)(Flags.SND_ASYNC | Flags.SND_FILENAME | Flags.SND_LOOP));
if(iSuc == 0)
MessageBox.Show("Error");
}
}

public static void StopPlaySound(string File)
{
int SND_PURGE = 0x0040;
WCE_PlaySound(File, IntPtr.Zero, SND_PURGE);
}

Thanks in Advance,
Murthy
 
P

Paul G. Tobey [eMVP]

You should definitely contact Symbol and tell them about this. My guess
would be that this is unique to them, unless your testing has concluded
otherwise. If it has, indicate that here, along with the characteristics of
the sound, how long it takes for this to fail, the other device(s) that
you've tested on and whether this only fails with your sound or with every
sound you've tried.

Paul T.

Murthy said:
Its a windows mobile 5.0 based device from symbol [MC 9090 Series].

Paul G. Tobey said:
Device details?

Paul T.

Murthy said:
Hi,
I use the below code to play a wave file continously on a windows
mobile
5.0
device.
i stop the playing of the wave file on press another button.

But after some time the WCE_PlaySound returns 1 but does not play the
sound.
This continues for a few minutes.
During this time i cannot play any sound.

Can someone tell me why this is happening and how i can over come this
problem.

[DllImport("coredll.dll", EntryPoint = "PlaySound", SetLastError =
true)]
public extern static int WCE_PlaySound(string szSound, IntPtr hMod, int
flags);

public static void PlaySound(string fileName)
{
if (fileName != null && fileName != "")
{
int iSuc = WCE_PlaySound(RingTone, IntPtr.Zero,
(int)(Flags.SND_ASYNC | Flags.SND_FILENAME | Flags.SND_LOOP));
if(iSuc == 0)
MessageBox.Show("Error");
}
}

public static void StopPlaySound(string File)
{
int SND_PURGE = 0x0040;
WCE_PlaySound(File, IntPtr.Zero, SND_PURGE);
}

Thanks in Advance,
Murthy
 
Ad

Advertisements

R

rmlaanbroek

You should definitely contact Symbol and tell them about this. My guess
would be that this is unique to them, unless your testing has concluded
otherwise. If it has, indicate that here, along with the characteristics of
the sound, how long it takes for this to fail, the other device(s) that
you've tested on and whether this only fails with your sound or with every
sound you've tried.

Paul T.

I don't think it is a device specific problem, I think it is a Windows
Mobile 2005 specific problem.
I too have problems playing wav files. On a Psion Workabout Pro.
I never had this problem on other mobile OS's, not even on the same
Psion with CE 4.2.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Sound play problem! 2
how To Play sound 4
Problem plaing Wav on CE5 7
Playing/Stoping a sound 5
Question about PInvokeStackImbalance? Thanks 2
play sound file 1
Playsound loop not working 3
Volume control 1

Top