Search Results for

    Show / Hide Table of Contents

    Class AudioClip

    Audio clip stores audio data in a compressed or uncompressed format using a binary asset. Clips can be provided to audio sources or other audio methods to be played.

    Inheritance
    Object
    ScriptingObject
    ManagedScriptingObject
    Asset
    BinaryAsset
    AudioClip
    Inherited Members
    Asset::_deleteFileOnUnload
    BinaryAsset::_dependantAssets
    ScriptingObject::_gcHandle
    StreamableResource::_group
    BinaryAsset::_header
    ScriptingObject::_id
    StreamableResource::_isDynamic
    BinaryAsset::_isSaving
    StreamableResource::_isStreaming
    Asset::_isVirtual
    Asset::_loadingTask
    Asset::_loadState
    Asset::_refCount
    BinaryAsset::_storageRef
    StreamableResource::_streamingQuality
    ScriptingObject::_type
    BinaryAsset::AddDependency(BinaryAsset* asset)
    Asset::AddReference()
    Asset::Asset(const SpawnParams& params, const AssetInfo* info)
    ScriptingObject::CanCast(const ScriptingTypeHandle& from, const ScriptingTypeHandle& to)
    ScriptingObject::CanCast(const MClass* from, const MClass* to)
    ScriptingObject::Cast(ScriptingObject* obj)
    Asset::ChangeID(const Guid& newId)
    BinaryAsset::ClearDependencies()
    Asset::const
    BinaryAsset::createLoadingTask()
    Asset::CreateManaged()
    ScriptingObject::CreateManagedInternal()
    Asset::DECLARE_ENUM_7(LoadResult, Ok, Failed, MissingDataChunk, CannotLoadData, CannotLoadStorage, CannotLoadInitData, InvalidData)
    ScriptingObject::Deleted
    Asset::DeleteManaged()
    Object::DeleteObject(float timeToLive = 0.0f, bool useGameTime=false)
    Object::DeleteObjectNow()
    BinaryAsset::Dependencies
    Asset::DEPRECATED("Use GetReferences with assets and files parameter instead")
    Asset::DestroyManaged()
    AudioClip
    Object::Flags
    ScriptingObject::FromInterface(void* interfaceObj, const ScriptingTypeHandle& interfaceType)
    ScriptingObject::FromInterface(T* interfaceObj)
    BinaryAsset::GetChunk(int32 index)
    BinaryAsset::GetChunkData(int32 index, BytesContainer& data)
    BinaryAsset::GetChunkSize(int32 index)
    BinaryAsset::getChunksToPreload()
    ScriptingObject::GetClass()
    StreamableResource::GetGroup()
    ScriptingObject::GetID()
    BinaryAsset::GetImportMetadata(String& path, String& username)
    BinaryAsset::GetImportPath()
    ScriptingObject::GetManagedInstance()
    BinaryAsset::GetMemoryUsage()
    BinaryAsset::GetOrCreateChunk(int32 index)
    ScriptingObject::GetOrCreateManagedInstance()
    BinaryAsset::GetPath()
    Asset::GetReferences(Array<Guid, HeapAllocation>& assets, Array<String, HeapAllocation>& files)
    Asset::GetReferences()
    Asset::GetReferencesCount()
    BinaryAsset::GetSerializedVersion()
    StreamableResource::GetStreamingQuality()
    StreamableResource::GetTargetResidency()
    ScriptingObject::GetType()
    ScriptingObject::GetTypeHandle()
    Asset::GetTypeName()
    BinaryAsset::HasChunk(int32 index)
    BinaryAsset::HasChunkLoaded(int32 index)
    BinaryAsset::HasDependenciesModified()
    ScriptingObject::HasManagedInstance()
    BinaryAsset::Init(const FlaxStorageReference& storage, AssetHeader& header)
    BinaryAsset::Init(AssetInitData& initData)
    Asset::InitAsVirtual()
    BinaryAsset::InitVirtual(AssetInitData& initData)
    ScriptingObject::Is(const ScriptingTypeHandle& type)
    ScriptingObject::Is(const MClass* type)
    ScriptingObject::Is()
    StreamableResource::IsAllocated()
    StreamableResource::IsDynamic()
    Asset::IsInternalType()
    Asset::IsLoaded()
    ScriptingObject::IsRegistered()
    Asset::IsVirtual()
    Asset::LastLoadFailed()
    BinaryAsset::loadAsset()
    BinaryAsset::LoadChunk(int32 chunkIndex)
    BinaryAsset::LoadChunks(AssetChunksFlag chunks)
    AudioClip
    Asset::Locker
    ManagedScriptingObject::ManagedScriptingObject(const SpawnParams& params)
    BinaryAsset::Metadata
    ScriptingObject::NewObject(const ScriptingTypeHandle& typeHandle)
    ScriptingObject::NewObject()
    Asset::OnCheckSave(const StringView& path=StringView::Empty)
    BinaryAsset::OnDeleteObject()
    BinaryAsset::OnDependencyModified(BinaryAsset* asset)
    Asset::onLoad(LoadAssetTask* task)
    Asset::OnLoaded
    Asset::onLoaded()
    Asset::onLoaded_MainThread()
    Asset::OnManagedInstanceDeleted()
    Asset::OnReloading
    BinaryAsset::onRename(const StringView& newPath)
    Asset::OnScriptingDispose()
    Asset::onUnload_MainThread()
    Asset::OnUnloaded
    ScriptingObject::RegisterObject()
    BinaryAsset::Reimport()
    BinaryAsset::ReleaseChunk(int32 index)
    BinaryAsset::ReleaseChunks()
    BinaryAsset::releaseStorage()
    Asset::Reload()
    Asset::RemoveReference()
    BinaryAsset::RequestChunkDataAsync(int32 index)
    StreamableResource::RequestStreamingUpdate()
    StreamableResource::ResetStreaming(bool error=true)
    StreamableResource::ResidencyChanged
    Asset::Save(const StringView& path=StringView::Empty)
    BinaryAsset::SaveAsset(AssetInitData& data, bool silentMode=false)
    BinaryAsset::SaveAsset(const StringView& path, AssetInitData& data, bool silentMode=false)
    BinaryAsset::SaveToAsset(const StringView& path, AssetInitData& data, bool silentMode=false)
    ScriptingObject::ScriptingObject(const SpawnParams& params)
    BinaryAsset::SetChunk(int32 index, const Span<byte>& data)
    ManagedScriptingObject::SetManagedInstance(MObject* instance)
    Asset::ShouldDeleteFileOnUnload()
    AudioClip
    Asset::startLoading()
    StreamableResource::StartStreaming(bool isDynamic)
    StreamableResource::StopStreaming()
    BinaryAsset::Storage
    StreamableResource::StreamableResource(StreamingGroup* group)
    StreamableResource::Streaming
    ScriptingObject::ToInterface(ScriptingObject* obj, const ScriptingTypeHandle& interfaceType)
    ScriptingObject::ToInterface(ScriptingObject* obj)
    ScriptingObject::ToManaged(const ScriptingObject* obj)
    ScriptingObject::ToNative(MObject* obj)
    Asset::ToString()
    ScriptingObject::UnregisterObject()
    Asset::WaitForLoaded(double timeoutInMilliseconds=30000.0)
    BinaryAsset::~BinaryAsset()
    Object::~Object()
    ScriptingObject::~ScriptingObject()
    StreamableResource::~StreamableResource()
    Assembly: FlaxEngine.dll
    File: Engine/Audio/AudioClip.h
    Syntax
    public class AudioClip : public BinaryAsset, public StreamableResource

    Constructors

    ~AudioClip()

    Finalizes an instance of the AudioClip class.

    Declaration
    public ~AudioClip()

    Fields

    AudioHeader

    The audio clip header data.

    Declaration
    public Header AudioHeader
    Field Value
    Header

    Buffers

    The audio backend buffers (internal ids) collection used by this audio clip.

    Declaration
    public Array<uint32, FixedAllocation<ASSET_FILE_DATA_CHUNKS>> Buffers
    Field Value
    Array<uint32, FixedAllocation<ASSET_FILE_DATA_CHUNKS>>

    StreamingQueue

    The streaming cache. Contains indices of chunks to stream. If empty no streaming required. Managed by AudioStreamingHandler and used by the Audio streaming tasks.

    Declaration
    public Array<int32, FixedAllocation<ASSET_FILE_DATA_CHUNKS>> StreamingQueue
    Field Value
    Array<int32, FixedAllocation<ASSET_FILE_DATA_CHUNKS>>

    Methods

    CanBeUpdated()

    Determines whether this instance can be updated. Which means: no async streaming, no pending action in background.

    Declaration
    public virtual bool CanBeUpdated() const override
    Returns
    bool

    true if this instance can be updated; otherwise, false.

    Overrides
    StreamableResource::CanBeUpdated()

    CancelStreaming()

    Cancels any asynchronous content streaming by this asset (eg. mesh data streaming into GPU memory). Will release any locks for asset storage container.

    Declaration
    public virtual void CancelStreaming() override
    Overrides
    Asset::CancelStreaming()

    CancelStreamingTasks()

    Cancels any streaming task (or tasks sequence) started for this resource.

    Declaration
    public virtual void CancelStreamingTasks() override
    Overrides
    StreamableResource::CancelStreamingTasks()

    CreateStreamingTask(int32 residency)

    Creates streaming task (or tasks sequence) to perform resource streaming for the desire residency level.

    Declaration
    public virtual Task* CreateStreamingTask(int32 residency) override
    Parameters
    int32 residency

    The target residency.

    Returns
    Task

    Async task or tasks that update resource residency level. Must be preceded with UpdateAllocation call.

    Overrides
    StreamableResource::CreateStreamingTask(int32 residency)

    ExtractData(Array<byte>& resultData, AudioDataInfo& resultDataInfo)

    Extracts the source audio data from the asset storage. Loads the whole asset. The result data is in an asset format.

    Declaration
    public bool ExtractData(Array<byte>& resultData, AudioDataInfo& resultDataInfo)
    Parameters
    Array<byte> resultData

    The result data.

    AudioDataInfo resultDataInfo

    The result data format header info.

    Returns
    bool

    True if failed, otherwise false.

    ExtractDataFloat(Array<float>& resultData, AudioDataInfo& resultDataInfo)

    Extracts the raw audio data (PCM format) from the asset storage and converts it to the normalized float format (in range [-1;1]). Loads the whole asset.

    Declaration
    public bool ExtractDataFloat(Array<float>& resultData, AudioDataInfo& resultDataInfo)
    Parameters
    Array<float> resultData

    The result data.

    AudioDataInfo resultDataInfo

    The result data format header info. That output data has 32 bits float data not the signed PCM data.

    Returns
    bool

    True if failed, otherwise false.

    ExtractDataRaw(Array<byte>& resultData, AudioDataInfo& resultDataInfo)

    Extracts the raw audio data (PCM format) from the asset storage. Loads the whole asset.

    Declaration
    public bool ExtractDataRaw(Array<byte>& resultData, AudioDataInfo& resultDataInfo)
    Parameters
    Array<byte> resultData

    The result data.

    AudioDataInfo resultDataInfo

    The result data format header info.

    Returns
    bool

    True if failed, otherwise false.

    Format()

    Gets the audio data format.

    Declaration
    public AudioFormat Format() const
    Returns
    AudioFormat

    GetAllocatedResidency()

    Gets resource allocated residency level.

    Declaration
    public virtual int32 GetAllocatedResidency() const override
    Returns
    int32

    Overrides
    StreamableResource::GetAllocatedResidency()

    GetBufferStartTime(int32 bufferIndex)

    Gets the buffer start time (in seconds).

    Declaration
    public float GetBufferStartTime(int32 bufferIndex) const
    Parameters
    int32 bufferIndex

    Index of the buffer.

    Returns
    float

    The buffer start time.

    GetCurrentResidency()

    Gets resource current residency level.

    Declaration
    public virtual int32 GetCurrentResidency() const override
    Returns
    int32

    Overrides
    StreamableResource::GetCurrentResidency()

    GetFirstBufferIndex(float time, float& offset)

    Gets the index of the first buffer to bind for the audio source data streaming.

    Declaration
    public int32 GetFirstBufferIndex(float time, float& offset) const
    Parameters
    float time

    The time (in seconds).

    float offset

    The offset time from the chunk start time (in seconds).

    Returns
    int32

    The buffer index.

    GetLength()

    Gets the length of the audio clip (in seconds).

    Declaration
    public float GetLength() const
    Returns
    float

    GetMaxResidency()

    Gets resource maximum residency level.

    Declaration
    public virtual int32 GetMaxResidency() const override
    Returns
    int32

    Overrides
    StreamableResource::GetMaxResidency()

    Info()

    Gets the audio data info metadata.

    Declaration
    public AudioDataInfo Info() const
    Returns
    AudioDataInfo

    init(AssetInitData& initData)

    Initializes the specified asset.

    Declaration
    protected virtual bool init(AssetInitData& initData) override
    Parameters
    AssetInitData initData

    The initialize data.

    Returns
    bool

    True if cannot init, otherwise false

    Overrides
    BinaryAsset::init(AssetInitData& initData)

    Is3D()

    Returns true if the sound source is three dimensional (volume and pitch varies based on listener distance and velocity).

    Declaration
    public bool Is3D() const
    Returns
    bool

    IsStreamable()

    Returns true if the sound is using data streaming.

    Declaration
    public bool IsStreamable() const
    Returns
    bool

    IsStreamingTaskActive()

    Returns true if the sound data is during streaming by an async task.

    Declaration
    public bool IsStreamingTaskActive() const
    Returns
    bool

    load()

    Load data from the chunks

    Declaration
    protected virtual LoadResult load() override
    Returns
    LoadResult

    Loading result

    Overrides
    BinaryAsset::load()

    unload(bool isReloading)

    Unloads asset data

    Declaration
    protected virtual void unload(bool isReloading) override
    Parameters
    bool isReloading

    True if asset is reloading data, otherwise false.

    Overrides
    Asset::unload(bool isReloading)

    UpdateAllocation(int32 residency)

    Updates the resource allocation to the given residency level. May not be updated now but in an async operation.

    Declaration
    public virtual Task* UpdateAllocation(int32 residency) override
    Parameters
    int32 residency

    The target allocation residency.

    Returns
    Task

    Async task that updates resource allocation or null if already done it. Warning: need to call task start to perform allocation.

    Overrides
    StreamableResource::UpdateAllocation(int32 residency)

    See Also

    BinaryAsset
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat