Overview
TheAudioClip class extends the base Clip class to provide audio-specific functionality. It manages audio clip data, handles waveform visualization, and provides methods for clip manipulation such as splitting and resizing.
Constructor
AudioClip(AudioTrack audioTrack, AudioClipData clip, long startingTick = 0)
Creates a new audio clip on the specified track.The audio track this clip belongs to
The audio clip data containing the audio file reader and wave channel
The starting position in ticks on the timeline
Properties
The underlying audio clip data containing the audio file reader and wave format information.
Pointer to the waveform image texture for rendering.
The name of the clip (derived from the audio file name without extension). Inherited from base
Clip class.The track this clip belongs to. Inherited from base
Clip class.Whether the clip is enabled (active). When disabled, the clip is muted. Inherited from base
Clip class.The color of the clip as RGBA values. Inherited from base
Clip class.The width of the clip in pixels. Inherited from base
Clip class.The starting position of the clip on the timeline in ticks. Inherited from base
Clip class.The ending position of the clip on the timeline in ticks. Inherited from base
Clip class.The duration of the clip in ticks. Inherited from base
Clip class.The starting position in musical time (Bars:Beats:Ticks). Inherited from base
Clip class.The ending position in musical time (Bars:Beats:Ticks). Inherited from base
Clip class.The duration in musical time (Bars:Beats:Ticks). Inherited from base
Clip class.The cutted portion in ticks from the start of the clip (trim start). Inherited from base
Clip class.The cutted portion in ticks from the end of the clip (trim end). Inherited from base
Clip class.Whether the clip is currently being hovered by the mouse. Inherited from base
Clip class.Whether the clip’s menu bar is currently being hovered. Inherited from base
Clip class.Whether the clip has been played during the current playback session. Inherited from base
Clip class.Flag indicating the clip should be deleted. Inherited from base
Clip class.Flag indicating the clip should be duplicated. Inherited from base
Clip class.Flag used to move the clip between tracks. Inherited from base
Clip class.Unique identifier (GUID) for the clip. Inherited from base
Clip class.Methods
ResizeWaveformData()
Resizes the waveform data to match the current clip width. This should be called when the clip is resized or the zoom level changes.Split(float time)
Splits the audio clip at the specified time position. This method is currently not implemented (commented out in the source).The time position in seconds where the clip should be split
SetStartTick(long tick)
Sets the starting position of the clip on the timeline.The starting position in ticks
GetStartTimeInMusicalTime()
Gets the start time of the clip in musical time format (Bars:Beats:Ticks).GetEndTimeInMusicalTime()
Gets the end time of the clip in musical time format (Bars:Beats:Ticks).GetDurationInMusicalTime()
Gets the duration of the clip in musical time format (Bars:Beats:Ticks).GetDurationInSeconds()
Gets the duration of the clip in seconds.Play(AudioFileReader audioFile, float offset, float endOffset)
Plays the audio clip with the specified offsets.The audio file reader to play
The starting offset in the audio file
The ending offset in the audio file
Render()
Renders the clip in the arrangement view with waveform visualization. Inherited from baseClip class.
Protected Methods
GetClipDuration()
Calculates the duration of the clip in ticks based on the audio file’s total time.GetClipWidth()
Calculates the width of the clip in pixels based on duration and current zoom level.RenderClipContent(float menuBarHeight, float clipHeight)
Renders the waveform content of the clip within the safe rendering area.The height of the menu bar in pixels
The height of the clip content area in pixels
RenderClipContent(Vector2 pos, float width, float height)
Renders the waveform content at a specific position with specific dimensions.The position to render at
The width to render
The height to render
OnClipDoubleClickLeft()
Called when the clip is double-clicked. Currently has no implementation but can be overridden for custom behavior.Usage Example
See Also
- AudioTrack - Audio track class
- AudioClipData - Audio clip data container
- Clip - Base clip class
- WaveformRenderer - Waveform visualization