Table of Contents

Class AudioFrameBufferEventArgs

Namespace
VisioForge.Core.Types.Events
Assembly
VisioForge.Core.dll

Provides data for events that deliver audio frame buffers. This class encapsulates an VisioForge.Core.Types.AudioFrame and additional metadata, allowing it to be passed as an argument in event handlers.

public class AudioFrameBufferEventArgs : EventArgs

Inheritance

Inherited Members

Remarks

This event argument is typically used in scenarios where an application needs to process audio data directly, such as for custom audio analysis, visualization, or real-time effects. The VisioForge.Core.Types.Events.AudioFrameBufferEventArgs.UpdateData property allows the event handler to signal if the frame data has been modified and needs to be saved or re-rendered. Frame property provides access to raw audio data buffer, sample rate, channel count, and timestamp. StreamID identifies which audio stream the frame came from in multi-stream scenarios. UpdateData should be set to true if you modify the audio buffer and want changes reflected in output. Audio frames contain PCM data in various formats (S16LE, F32LE, etc.) requiring appropriate format handling. Sample rate determines temporal resolution (44100Hz=CD quality, 48000Hz=professional, 96000Hz=high-resolution). Channels indicate audio configuration: 1=mono, 2=stereo, 6=5.1 surround, 8=7.1 surround. BPS (bits per sample) affects dynamic range and quality: 16-bit=standard, 24-bit=professional, 32-bit float=maximum precision. Applications can implement custom audio processing: equalizers, compressors, reverb, noise reduction, or audio analysis. Memory management is critical - audio buffers are often reused, so copy data if needed beyond event scope. High sample rates generate frequent events, so handlers must be optimized for real-time performance. Consider buffering and batch processing for computationally expensive audio effects. Events are raised on processing threads, requiring careful synchronization for UI updates or shared resource access.

Constructors

AudioFrameBufferEventArgs(nint, int, int, int, int, TimeSpan, AudioFormat, ref bool)

Initializes a new instance of the VisioForge.Core.Types.Events.AudioFrameBufferEventArgs class with raw audio data parameters.

public AudioFrameBufferEventArgs(nint data, int dataSize, int sampleRate, int channels, int bps, TimeSpan timestamp, AudioFormat audioFormat, ref bool updateData)

Parameters

data nint

A pointer to the raw audio data buffer.

dataSize int

The size of the audio data buffer in bytes.

sampleRate int

The audio sample rate in Hz.

channels int

The number of audio channels.

bps int

The bits per sample of the audio data.

timestamp TimeSpan

The timestamp of the audio frame.

audioFormat AudioFormat

The format of the audio data.

updateData bool

A reference to a boolean flag indicating if the data has been updated.

AudioFrameBufferEventArgs(nint, int, int, int, int, TimeSpan, AudioFormat)

Initializes a new instance of the VisioForge.Core.Types.Events.AudioFrameBufferEventArgs class with raw audio data parameters.

public AudioFrameBufferEventArgs(nint data, int dataSize, int sampleRate, int channels, int bps, TimeSpan timestamp, AudioFormat audioFormat)

Parameters

data nint

A pointer to the raw audio data buffer.

dataSize int

The size of the audio data buffer in bytes.

sampleRate int

The audio sample rate in Hz.

channels int

The number of audio channels.

bps int

The bits per sample of the audio data.

timestamp TimeSpan

The timestamp of the audio frame.

audioFormat AudioFormat

The format of the audio data.

AudioFrameBufferEventArgs(RAWAudioFrame, ref bool)

Initializes a new instance of the VisioForge.Core.Types.Events.AudioFrameBufferEventArgs class with a VisioForge.Core.Types.RAWAudioFrame.

public AudioFrameBufferEventArgs(RAWAudioFrame frame, ref bool updateData)

Parameters

frame RAWAudioFrame

The VisioForge.Core.Types.RAWAudioFrame to be encapsulated by these event arguments.

updateData bool

A reference to a boolean flag indicating if the data has been updated.

AudioFrameBufferEventArgs(RAWAudioFrame)

Initializes a new instance of the VisioForge.Core.Types.Events.AudioFrameBufferEventArgs class with a VisioForge.Core.Types.RAWAudioFrame.

public AudioFrameBufferEventArgs(RAWAudioFrame frame)

Parameters

frame RAWAudioFrame

The VisioForge.Core.Types.RAWAudioFrame to be encapsulated by these event arguments.

AudioFrameBufferEventArgs(AudioFrame, ref bool)

Initializes a new instance of the VisioForge.Core.Types.Events.AudioFrameBufferEventArgs class with an VisioForge.Core.Types.AudioFrame.

public AudioFrameBufferEventArgs(AudioFrame frame, ref bool updateData)

Parameters

frame AudioFrame

The VisioForge.Core.Types.AudioFrame to be encapsulated by these event arguments.

updateData bool

A reference to a boolean flag indicating if the data has been updated.

AudioFrameBufferEventArgs(AudioFrame)

Initializes a new instance of the VisioForge.Core.Types.Events.AudioFrameBufferEventArgs class with an VisioForge.Core.Types.AudioFrame.

public AudioFrameBufferEventArgs(AudioFrame frame)

Parameters

frame AudioFrame

The VisioForge.Core.Types.AudioFrame to be encapsulated by these event arguments.

Properties

Frame

Gets the VisioForge.Core.Types.AudioFrame associated with this event. This frame contains the audio data and its metadata.

public AudioFrame Frame { get; }

Property Value

AudioFrame

StreamID

Gets or sets the identifier of the audio stream from which the frame originated. This is useful when handling multiple audio streams.

public int StreamID { get; set; }

Property Value

int

UpdateData

Gets or sets a value indicating whether the audio frame data has been updated by the event handler. Set this to true if you modify the VisioForge.Core.Types.AudioFrame.Data and want the changes to be reflected (e.g., saved to a file or re-rendered).

public bool UpdateData { get; set; }

Property Value

bool