SoundGenerator.StreamCreateTone method |
|
Remarks
Creates a wave tone audio stream and loads it inside the given player.
Once created, the audio stream can be played through the PlaySound method, paused through the PauseSound method and stopped through the StopSound method. Once no more needed, the audio stream can be discarded from memory through the CloseSound method.
For further details about sound generation see the SoundGenerator object and the How to generate wave tones, noises, DTMF tones and text to speech tutorial.
Syntax
[Visual Basic] Public Function StreamCreateTone ( nPlayerIndex as Int16, nSampleRate as Int32, bMono as bool, nWaveType as enumSoundGenWaveTypes, fFrequency as Single, fAmplitude as Single, nDurationMs as Int32, nFadeInMs as Int32, nFadeOutMs as Int32 ) as enumErrorCodes |
[C#] public enumErrorCodes StreamCreateTone ( Int16 nPlayerIndex, Int32 nSampleRate, bool bMono, enumSoundGenWaveTypes nWaveType, float fFrequency, float fAmplitude, Int32 nDurationMs, Int32 nFadeInMs, Int32 nFadeOutMs ); |
[C++] public: enumErrorCodes StreamCreateTone ( Int16 nPlayerIndex, Int32 nSampleRate, bool bMono, enumSoundGenWaveTypes nWaveType, float fFrequency, float fAmplitude, Int32 nDurationMs, Int32 nFadeInMs, Int32 nFadeOutMs ); |
Parameter |
Description |
||||||||||||||||||
|
|
||||||||||||||||||
nPlayerIndex |
Number representing the zero-based index of the involved player |
||||||||||||||||||
nSampleRate |
Sample rate of the stream, e.g. 44100 |
||||||||||||||||||
bMono |
Boolean value specifying if the audio stream is in mono or stereo. Supported values are the following:
|
||||||||||||||||||
nWaveType |
Type of wave tone. Supported values are the following:
|
||||||||||||||||||
fFrequency |
Wave tone frequency expressed in Hertz |
||||||||||||||||||
fAmplitude |
Wave tone amplitude |
||||||||||||||||||
nDurationMs |
Duration of the wave tone expressed in milliseconds. In case you should need to create an endless tone, use the SoundGenerator.StreamCreateMultiChannelEmpty method in combination with the SoundGenerator.StreamChannelAddTone method having the nDurationMs parameter set to 0. |
||||||||||||||||||
nFadeInMs |
Duration of the fade-in at the beginning of the tone expressed in milliseconds. Set this value to 0 if you don't need to apply a fade-in at the beginning of the audio stream. |
||||||||||||||||||
nFadeOutMs |
Duration of the fade-out at the end of the tone expressed in milliseconds. Set this value to 0 if you don't need to apply a fade-out at the end of the audio stream. |
Return value
Value |
Meaning |
|
|
Negative value |
An error occurred (see the LastError property for further error details) |
enumErrorCodes.NOERROR (0) |
The method call was successful. |