 |
| How to play a waveform sound (a WAV file in particular) |
User rating: 0/10 (0 votes) | | |
|
 |
 |
Versions: click to open |
 |
|
 |
 |
| Before you begin: |
 |
This is a simple way of playing WAV files, and other waveform sounds from the Windows Registry, or from a memory image of a wavefrom sound.
See also:
WAV file player
WAV file recorder
Playing WAV sounds simultaneously
How to play MIDI notes
|
 |
 |
using System;
using System.Runtime.InteropServices;
namespace PlaySound
{
class Program
{
private const int SND_FILENAME = 0x20000;
private const int SND_ASYNC = 1;
private const int SND_SYNC = 0;
static void Main(string[] args)
{
PlaySound("c:\\windows\\media\\tada.wav",
0, (SND_FILENAME | SND_SYNC));
}
[DllImport("winmm.dll")]
private static extern int PlaySound(string pszSound,
int hmod, int fdwSound);
}
}
|
 |
User rating: 0/10 (0 votes) | | | 552 bytes Created: 2002-01-14 19:56:34 Modified: 2008-04-10 08:01:04 Visits in 7 days: 71 |
|
 |
 |
| Listed functions: |
 |
|
 |
 |
| My comment: |
 |
Different combinations of flags provide some interesting ways, such as playing sounds asynchronously, when the sndPlaySound returns immediately after starting playing the sound. Still note that this function cannot be used for playing multiple sounds simultaneously. The waveOut* functions do that.
|
 |
 |
| Word Index links for this example: |
 |
|
|
 |
 |
| Translate this page: |
 |
|