#include <sound.h>
Inheritance diagram for PSound:
Public Member Functions | |
Construction | |
PSound (unsigned numChannels=1, unsigned sampleRate=8000, unsigned bitsPerSample=16, PINDEX bufferSize=0, const BYTE *data=NULL) | |
PSound (const PFilePath &filename) | |
PSound & | operator= (const PBYTEArray &data) |
File functions | |
BOOL | Load (const PFilePath &filename) |
BOOL | Save (const PFilePath &filename) |
Access functions | |
BOOL | Play () |
Play the sound on the default sound device. | |
void | SetFormat (unsigned numChannels, unsigned sampleRate, unsigned bitsPerSample) |
unsigned | GetEncoding () const |
unsigned | GetChannels () const |
Get the number of channels (mono/stereo) in the sound. | |
unsigned | GetSampleRate () const |
Get the sample rate in samples per second. | |
unsigned | GetSampleSize () const |
Get the sample size in bits per sample. | |
DWORD | GetErrorCode () const |
Get the platform dependent error code from the last file load. | |
PINDEX | GetFormatInfoSize () const |
Get the size of the platform dependent format info. | |
const void * | GetFormatInfoData () const |
Get pointer to the platform dependent format info. | |
Static Public Member Functions | |
Miscellaneous functions | |
BOOL | PlayFile (const PFilePath &file, BOOL wait=TRUE) |
void | Beep () |
Play the "standard" warning beep for the platform. | |
Protected Attributes | |
unsigned | encoding |
Format code. | |
unsigned | numChannels |
Number of channels eg mono/stereo. | |
unsigned | sampleRate |
Samples per second. | |
unsigned | sampleSize |
Number of bits per sample. | |
DWORD | dwLastError |
Last error code for Load()/Save() functions. | |
PBYTEArray | formatInfo |
Full info on the format (platform dependent). |
The most common sound to use is the static function Beep()# which emits the system standard "warning" or "attention" sound.
|
Create a new sound, using the parameters provided. It is expected that the "lowest common denominator" encoding, linear PCM, is used. All other values for the encoding are platform dependent.
|
|
Create a new sound, reading from a platform dependent file.
|
|
Play the "standard" warning beep for the platform.
|
|
Get the number of channels (mono/stereo) in the sound.
|
|
Get the current encoding. A value of 0 indicates linear PCM, any other value is platform dependent. |
|
Get the platform dependent error code from the last file load.
|
|
Get pointer to the platform dependent format info.
|
|
Get the size of the platform dependent format info.
|
|
Get the sample rate in samples per second.
|
|
Get the sample size in bits per sample.
|
|
Load a platform dependent sound file (eg .WAV file for Win32) into the object. Note the whole file must able to be loaded into memory. Also note that not all possible files are playable by this library. No format conversions between file and driver are performed.
|
|
Set new data bytes for the sound. |
|
Play the sound on the default sound device.
|
|
Play a sound file to the default device. If the #wait# parameter is TRUE then the function does not return until the file has been played. If FALSE then the sound play is begun asynchronously and the function returns immediately.
|
|
Save a platform dependent sound file (eg .WAV file for Win32) from the object.
|
|
Set the internal sound format to linear PCM at the specification in the parameters.
|
|
Last error code for Load()/Save() functions.
|
|
Format code.
|
|
Full info on the format (platform dependent).
|
|
Number of channels eg mono/stereo.
|
|
Samples per second.
|
|
Number of bits per sample.
|