Asset representing sound PCM data.
Contains raw PCM data used for audio playback. Like most assets, this asset type can be unloaded by calling CYIAsset::Unload().
#include <asset/YiAssetSound.h>

Public Member Functions | |
| CYIAssetSound () | |
| CYIAssetSound (const CYIString &fileName, PATH_TYPE ePathType=PATH_RELATIVE) | |
| virtual | ~CYIAssetSound () |
| void | SetData (const float *pData, uint32_t uFrameCount, uint32_t uChannelCount) |
| const float * | GetData () const |
| uint32_t | GetFrameCount () const |
| uint32_t | GetChannelCount () const |
Public Member Functions inherited from CYIAsset | |
| virtual | ~CYIAsset () |
| const CYIString & | GetPath () const |
| CYIAssetLoadParams * | GetLoadParameters () const |
| bool | SetName (const CYIString &name) |
| const CYIString & | GetName () const |
| bool | Load () |
| void | Unload () |
| bool | IsLoaded () const |
| bool | Equals (const std::shared_ptr< CYIAsset > &pAsset) |
| virtual bool | Prepare () |
Public Member Functions inherited from CYIScriptableRTTIObject | |
| CYIScriptableRTTIObject () | |
| virtual | ~CYIScriptableRTTIObject () |
| virtual const CYIRuntimeTypeInfo * | GetRuntimeTypeInfoForScriptObject () const override |
Public Member Functions inherited from CYIScriptableObject | |
| CYIScriptableObject () | |
| CYIScriptableObject (const CYIScriptableObject &other) | |
| CYIScriptableObject & | operator= (const CYIScriptableObject &other) |
| virtual | ~CYIScriptableObject () |
| CYIBindingImplementation * | GetBindingImplementation () const |
| void | SetBindingImplementation (CYIBindingImplementation *pBindingImplementation) |
Protected Member Functions | |
| virtual void | OnUnload () override |
| virtual std::pair< uint32_t, uint32_t > | GetApproximateSize () const override |
Protected Member Functions inherited from CYIAsset | |
| CYIAsset () | |
| ssize_t | GetID () const |
| void | SetPath (const CYIString &path, PATH_TYPE ePathType) |
| void | SetApproximateSize (uint32_t nSize) |
| void | SetLoaded (bool bAssetLoaded) |
| void | SetLoadParameters (std::unique_ptr< CYIAssetLoadParams > pParams) |
| virtual void | OnLoad () |
Protected Member Functions inherited from CYIScriptableRTTIObject | |
| virtual std::pair< const CYIRuntimeTypeInfo *, const void * > | GetRuntimeTypeInfoWithObject () const =0 |
Additional Inherited Members | |
Public Types inherited from CYIAsset | |
| enum | PATH_TYPE { PATH_ABSOLUTE = 0, PATH_RELATIVE } |
Static Protected Attributes inherited from CYIAsset | |
| static ssize_t | INVALID_ID |
| CYIAssetSound::CYIAssetSound | ( | ) |
| CYIAssetSound::CYIAssetSound | ( | const CYIString & | fileName, |
| PATH_TYPE | ePathType = PATH_RELATIVE |
||
| ) |
|
virtual |
|
overrideprotectedvirtual |
Calculates and returns the approximate number of bytes currently used by this asset. The first item of the returned pair object represents the memory currently taken in the CPU main memory, and the second item of the returned pair object represents the memory currently taken in the GPU memory.
Reimplemented from CYIAsset.
| uint32_t CYIAssetSound::GetChannelCount | ( | ) | const |
Gets the channel count. For a mono sound, this will return 1. For a Stereo sound, 2 is returned. etc..
| const float* CYIAssetSound::GetData | ( | ) | const |
Returns the raw PCM data for this sound. Returned data is an array the size of GetFrameCount() * GetChannelCount(). Each sample in the returned data is ranged from -1 to 1.
| uint32_t CYIAssetSound::GetFrameCount | ( | ) | const |
Gets the audio frame count for this sound. A frame is as big as GetChannelCount().
|
overrideprotectedvirtual |
Reimplemented from CYIAsset.
| void CYIAssetSound::SetData | ( | const float * | pData, |
| uint32_t | uFrameCount, | ||
| uint32_t | uChannelCount | ||
| ) |
Sets the raw PCM data for this sound. pData should be an array of size uFrameCount * uChannelCount. Each sample in pData is ranged from -1 to 1.