SoundComposer.ItemSoundFileMemoryRawAdd method |
|
Remarks
Adds a sound stored inside a memory buffer containing RAW audio data to the audio stream previously created through the SoundComposer.SessionInit method.
In case the raw sound should be stored inside a file on disk use the SoundComposer.ItemSoundFileRawAdd method.
For further details about sound composing see the the SoundComposerMan class and the How to compose a sound tutorial.
Syntax
[Visual Basic] Public Function ItemSoundFileMemoryRawAdd ( strFriendlyName as String, nChannel as Int16, pBuffer as Variant, nBufferLength as Long, nEncodeMode as enumRAWEncodeModes, bIsBigEndian as Boolean, nFrequency as Int32, nChannels as Int32, bDownMixToMono as Boolean, fAmplitude as Single, nOffsetMs as Int32, ByRef nUniqueId as Int32 ) as enumErrorCodes |
[C#] public enumErrorCodes ItemSoundFileMemoryRawAdd ( string strFriendlyName, Int16 nChannel, byte[] pBuffer, Int32 nBufferLength, enumRAWEncodeModes nEncodeMode, bool bIsBigEndian, Int32 nFrequency, Int32 nChannels, bool bDownMixToMono, float fAmplitude, Int32 nOffsetMs, ref Int32 nUniqueId ); |
[C++] public: enumErrorCodes ItemSoundFileMemoryRawAdd ( string strFriendlyName, Int16 nChannel, unsigned char __gc[] pBuffer, Int32 nBufferLength, enumRAWEncodeModes nEncodeMode, bool bIsBigEndian, Int32 nFrequency, Int32 nChannels, bool bDownMixToMono, float fAmplitude, Int32 nOffsetMs, Int32 __gc *nUniqueId ); |
Parameter |
Description |
|||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||
strFriendlyName |
Friendly name of the item |
|||||||||||||||||||||||||||||||||
nChannel |
Mono channel or stereo channel pair of the audio stream that will reproduce the item. Due to the fact that the audio stream previously created through the SoundComposer.SessionInit method could be multi-channel, this would be the behaviour when a sound file item is added:
(*) If for example the audio stream previously created through the SoundComposer.SessionInit method should have 8 channels (7.1 multi-channel), stereo channels pairs would be mapped as follows: - stereo channel pair 0 would group mono channels 0 and 1 - stereo channel pair 1 would group mono channels 2 and 3 - stereo channel pair 2 would group mono channels 4 and 5 - stereo channel pair 3 would group mono channels 6 and 7 |
|||||||||||||||||||||||||||||||||
pBuffer |
Input buffer containing the original sound |
|||||||||||||||||||||||||||||||||
nBufferLength |
Length of the input buffer expressed in bytes |
|||||||||||||||||||||||||||||||||
nEncodeMode |
Encode mode used to encode the RAW file. Supported values are the following:
|
|||||||||||||||||||||||||||||||||
bIsBigEndian |
Boolean flag that specifies if bits order inside the RAW file are little-endian or big-endian Supported values are the following:
|
|||||||||||||||||||||||||||||||||
nFrequency |
Sample rate of the RAW file (e.g. 44100) |
|||||||||||||||||||||||||||||||||
nChannels |
Number of channels of the RAW file: for example, 1 for Mono or 2 for Stereo, 6 for 5.1 formats and so on |
|||||||||||||||||||||||||||||||||
bDownMixToMono |
Boolean flag specifying if there is the need of a downmix in order to store a stereo sound file into a mono channel of the stream. Supported values are the following:
|
|||||||||||||||||||||||||||||||||
fAmplitude |
Amplitude of the sound. - value 0.0 means that the sound is muted - values higher than 0.0 and lower than 1.0 attenuate the sound - value 1.0 sets the sound at full volume - values higher than 1.0 amplify the sound |
|||||||||||||||||||||||||||||||||
nOffsetMs |
Offset of the sound, 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:
- SoundComposer.ItemSoundFileDownmixToMonoGet to obtain the downmix to mono setting of the item - SoundComposer.ItemSoundFileDownmixToMonoSet to modify the downmix to mono setting of the item - SoundComposer.ItemSoundFileDurationGet to obtain the duration of the item - SoundComposer.ItemSoundFileDurationStretch to modify the duration of the item through a tempo change - SoundComposer.ItemSoundFileOriginalChannelsGet to obtain the original number of channels of the item - SoundComposer.ItemSoundFileLoadRangeGet to obtain the loading range of the item - SoundComposer.ItemSoundFileLoadRangeSet to modify the loading range of the item - SoundComposer.ItemSoundFileLoopGet to obtain the number of loops of the item - SoundComposer.ItemSoundFileLoopSet to modify the number of loops of the item - SoundComposer.ItemSoundFileVolumeFadingGet to obtain the fading setting of the item - SoundComposer.ItemSoundFileVolumeFadingRemove to remove the fading setting of the item - SoundComposer.ItemSoundFileVolumeFadingSet to modify the fading setting of the item - SoundComposer.ItemSoundFileVolumeSlidingAdd to add a new volume sliding to the item - SoundComposer.ItemSoundFileVolumeSlidingGet to obtain the settings of a specific volume sliding of the item - SoundComposer.ItemSoundFileVolumeSlidingNumGet to obtain the number of volume sliding of the item - SoundComposer.ItemSoundFileVolumeSlidingRemove to remove a specific volume sliding of the item - SoundComposer.ItemSoundFileVolumeSlidingUniqueIdGet to obtain the unique identifier of a specific volume sliding of the item
- SoundComposer.ItemAmplitudeGet to obtain the amplitude of the item - SoundComposer.ItemAmplitudeSet to modify the amplitude of the item - SoundComposer.ItemChannelGet to obtain the channel of of the audio stream that will reproduce the item - SoundComposer.ItemChannelSet to modify the channel of of the audio stream that will reproduce the item - SoundComposer.ItemRemove to remove the item from the sound composition - SoundComposer.ItemDurationGet to obtain the duration, expressed in milliseconds, of the item - SoundComposer.ItemOffsetGet to obtain the offset, expressed in milliseconds, of the item respect to the beginning of the audio stream - SoundComposer.ItemOffsetSet to modify the offset, expressed in milliseconds, of the item respect to the beginning of the audio stream - SoundComposer.ItemTypeGet to obtain the item's type - SoundComposer.ItemFriendlyNameGet to obtain the friendly name of the item - SoundComposer.ItemFriendlyNameSet to modify the friendly name of the item
The usage of the SoundComposer.ItemDurationSet method is not supported on sound files because the duration of the item strictly depends upon contents of the sound file itself. You may eventually stretch the duration of the sound file through the SoundComposer.ItemSoundFileDurationStretch method or limit the loading range through the SoundComposer.ItemSoundFileLoadRangeSet method, |
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. |