Pocket PC playback sound file

Source: Internet
Author: User

On a handheld terminal, you sometimes need to give alarm sound prompts to the user based on the system judgment. The following code calls the system function to play your own alarm sound.

Need to reference PDALib

[Csharp]
Using PDALib;
Using PDALib;

Code for playing a sound file:

[Csharp]
/// <Summary>
/// Play the wav audio file
/// </Summary>
/// <Param name = "wavfilename"> </param>
Protected void PlayWave (string wavfilename)
{
// Www.2cto.com
String fullpath =
System. IO. Path. GetDirectoryName (System. Reflection. Assembly. GetExecutingAssembly ().
ManifestModule. FullyQualifiedName) + @ "\" + wavfilename;
If (! System. IO. File. Exists (fullpath ))
// Play the backup audio file
TWavePlayer. PlayWave ("Warning.wav ");
Else
// Play the voice file
TWavePlayer. PlayWave (fullpath );
}
/// <Summary>
/// Play the wav audio file
/// </Summary>
/// <Param name = "wavfilename"> </param>
Protected void PlayWave (string wavfilename)
{
//
String fullpath =
System. IO. Path. GetDirectoryName (System. Reflection. Assembly. GetExecutingAssembly ().
ManifestModule. FullyQualifiedName) + @ "\" + wavfilename;
If (! System. IO. File. Exists (fullpath ))
// Play the backup audio file
TWavePlayer. PlayWave ("Warning.wav ");
Else
// Play the voice file
TWavePlayer. PlayWave (fullpath );
}

Code for calling:

[Csharp]
PlayWave ("ALARM1.wav ");
PlayWave ("ALARM1.wav ");

From # Define

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.