Class AudioAssets
This class is used to wrap the audio assets in Vector and Cozmo. These assets are Audio-Kinetic WWise soundbank files and other supporting files.
Implements
Namespace: Anki.AudioKinetic
Assembly: Anki.Resources.SDK.dll
Syntax
public class AudioAssets : IDisposable
Remarks
This supports the audio assets as bare files, as is done with Vector resources; or in a zip file, as is done with Cozmo resources.
Only features that are present in Cozmo or Vector are given much attention; other WWise features are ignored. AudioKinetic , Wwise Fundamentals (2015)
References:
Examples
You can pipe the sounds into NAudio using code like:
var audioAssets = new AudioAssets(.. path to sound folder ...);
var WEM = audioAssets.WEM( .. the id for the sound ..);
var waveOut = new WaveOut();
var waveProvider = WEM.WaveProvider();
waveOut.Init(waveProvider);
waveOut.Play();
Thread.Sleep(30000);
waveOut.Stop();
waveProvider.Dispose();
waveOut.Dispose();
Constructors
AudioAssets(IFolderWrapper)
Creates an object that can access the audio system resources
Declaration
public AudioAssets(IFolderWrapper folderWrapper)
Parameters
Type | Name | Description |
---|---|---|
IFolderWrapper | folderWrapper | The file/archive wrapper that can access the sound bank information |
AudioAssets(String)
Creates an object that can access the audio system resources
Declaration
public AudioAssets(string basePath)
Parameters
Type | Name | Description |
---|---|---|
String | basePath | A path a zip file, or a /sound folder, which can contain bare files, or an AudioAssets.zip container |
Remarks
This automatically detects if the audio assets are wrapped or not
Properties
Languages
The languages support within the audio assets.
Declaration
public IReadOnlyCollection<string> Languages { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<String> | A colleciton of the languages supported with the audio assets. |
Remarks
These are similar to locales, but the names are different; it also incldues a special effects language (SFX)
Plugins
A list of the audio plug-ins in the sound processing pipeline
Declaration
public IReadOnlyList<string> Plugins { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<String> | A list of the audio plug-ins. |
SoundBankNames
Retrieves a list of the sound banks
Declaration
public IReadOnlyCollection<string> SoundBankNames { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<String> | A list of the sound bank names. |
Remarks
The banks can be localized, but there isn't any reason here
Methods
Dispose()
Dispose of any internal resources
Declaration
public void Dispose()
Dispose(Boolean)
Dispose of the archive
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing | true, right? |
IDForString(String)
Compute the AudioKinetic WWise ID from the string
Declaration
public static uint IDForString(string str)
Parameters
Type | Name | Description |
---|---|---|
String | str | The string |
Returns
Type | Description |
---|---|
UInt32 | The 32-bit ID for the string |
Retain()
Increment the reference count for this object. Decrement the count using Dispose().
Declaration
public AudioAssets Retain()
Returns
Type | Description |
---|---|
AudioAssets | This object |
SoundBank(String, String)
Opens the file sound bank reader for the given sound bank name. The path to the file is looked up from the configuration file.
Declaration
public BNKReader SoundBank(string soundBankName, string language = null)
Parameters
Type | Name | Description |
---|---|---|
String | soundBankName | The name of the sound bank file; a caseless match is used |
String | language | A language specifier, to select from the alternatives; if NULL the first bank found (without regard to its language) is used. (Ignored for now). |
Returns
Type | Description |
---|---|
BNKReader | null on error, otherwise the sound bank reader |
Remarks
The banks can be localized, but there isn't any reason here
StringForID(UInt32)
Looks up a string for an AudioKinetic WWise ID. (This only works if the name was previously used to compute the ID).
Declaration
public static string StringForID(uint ID)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | ID | A 32-bit ID |
Returns
Type | Description |
---|---|
String | null, if the string is not known; otherwis the string that produces the ID |
WEM(UInt32, String)
Opens the WEM file corresponding to the given file ID. The file may be embedded within the soundbank file, or may be external.
Declaration
public WEMReader WEM(uint fileID, string language = null)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | fileID | The identifier for the WEM to retrieve |
String | language | A language specifier, to select from the alternatives; if NULL the first bank found (without regard to its language) is used. (Ignored for now). |
Returns
Type | Description |
---|---|
WEMReader | An object that can read the WEM file |
Remarks
This scans all of the sound banks until it finds one