Copyright © 2005-2019 MultiMedia Soft

SoundGenerator.StreamChannelAddNoise method

Previous pageReturn to chapter overviewNext page

Remarks

 

Adds a noise generator element to the audio stream previously created through the SoundGenerator.StreamCreateMultiChannelEmpty method.

 

When the rendering of the wave noise has been completed, the element itself is automatically removed from the the audio stream; if you need to create a noise that could be reproduced again after its complete rendering, use the SoundGenerator.StreamCreateNoise 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 StreamChannelAddNoise (

nPlayerIndex as Int16,

nChannel as Int16,

nNoiseType as enumSoundGenNoiseTypes,

fReserved as Single,

fAmplitude as Single,

nDurationMs as Int32,

nOffsetMs as Int32,

ByRef nUniqueId as Int32

) as enumErrorCodes


 

[C#]

public enumErrorCodes StreamChannelAddNoise (

Int16 nPlayerIndex,

Int16 nChannel,

enumSoundGenNoiseTypes nNoiseType,

float fReserved,

float fAmplitude,

Int32 nDurationMs,

Int32 nOffsetMs,

ref Int32 nUniqueId

);


 

[C++]

public: enumErrorCodes StreamChannelAddNoise (

Int16 nPlayerIndex,

Int16 nChannel,

enumSoundGenNoiseTypes nNoiseType,

float fReserved,

float fAmplitude,

Int32 nDurationMs,

Int32 nOffsetMs,

Int32 __gc  *nUniqueId

);


 

Parameter

Description

 

 

nPlayerIndex

Number representing the zero-based index of the involved player

nChannel

Channel of the audio stream that will reproduce the noise: can be a value between 0 and the number of channels of the audio stream created through the SoundGenerator.StreamCreateMultiChannelEmpty method.

nNoiseType

Type of noise.

Supported values are the following:

Mnemonic Value

Value

Meaning

SOUNDGEN_NOISE_TYPE_WHITE

0

White noise

SOUNDGEN_NOISE_TYPE_PINK

1

Pink noise

SOUNDGEN_NOISE_TYPE_BROWN

2

Brown noise

fReserved

Reserved for future uses, set this parameter to 0

fAmplitude

Noise amplitude.

- value 0.0 means that sound volume is muted

- values higher than 0.0 and smaller than 1.0 attenuate the sound volume

- value 1.0 sets the sound at full volume

- values higher than 1.0 amplify the sound volume

nDurationMs

Duration of the noise expressed in milliseconds

nOffsetMs

Offset of the noise, expressed in milliseconds, respect to the beginning of the audio stream.

nUniqueId

Reference to a value that, on return from the method call, will contain the unique identifier of the newly added element: this unique identifier will be used in order to invoke further methods related to the use of this specific element:

- SoundGenerator.StreamElementAmplitudeSet and SoundGenerator.StreamElementAmplitudeGet to modify and retrieve the amplitude of the noise element.

- SoundGenerator.StreamElementNoiseTypeGet to obtain the type of noise.

- SoundGenerator.StreamElementRemove to remove the noise element from the audio stream.

- SoundGenerator.StreamElementDurationGet to obtain the duration of the noise element.

- SoundGenerator.StreamElementOffsetGet to obtain the offset of the noise element

 

 

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.