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