Class AudioEventArgs
- Namespace
- VisioForge.Core.Types.Events
- Assembly
- VisioForge.Core.dll
Provides data for a detected audio event raised by the audio-event-detection block.
public class AudioEventArgs : EventArgsInheritance
Inherited Members
Remarks
One instance describes a single continuous detection of one AudioSet class: it is raised when the sound ends (the smoothed score falls back below the release threshold) or at end-of-stream if still active, so VisioForge.Core.Types.Events.AudioEventArgs.Start..VisioForge.Core.Types.Events.AudioEventArgs.End spans the whole sound and VisioForge.Core.Types.Events.AudioEventArgs.Confidence is its peak smoothed score. Raised on the block's inference worker thread — marshal to the UI thread before touching UI.
Constructors
AudioEventArgs(int, string, float, TimeSpan, TimeSpan)
Initializes a new instance of the VisioForge.Core.Types.Events.AudioEventArgs class.
public AudioEventArgs(int classId, string label, float confidence, TimeSpan start, TimeSpan end)Parameters
classIdint-
The AudioSet class id (0..520).
labelstring-
The AudioSet class display name (for example, "Siren").
confidencefloat-
The peak smoothed score for the detection, in the range 0..1.
startTimeSpan-
The time at which the sound crossed the detection threshold, measured over the analysed audio.
endTimeSpan-
The time at which the sound fell below the release threshold (or end-of-stream), on the same clock.
Properties
ClassId
Gets the AudioSet class id (0..520).
public int ClassId { get; }Property Value
Confidence
Gets the peak smoothed score for the detection, in the range 0..1.
public float Confidence { get; }Property Value
Duration
Gets the duration of the detection (VisioForge.Core.Types.Events.AudioEventArgs.End minus VisioForge.Core.Types.Events.AudioEventArgs.Start).
public TimeSpan Duration { get; }Property Value
End
Gets the time at which the sound fell below the release threshold (or the end-of-stream time when the sound was still active at teardown), on the same clock as VisioForge.Core.Types.Events.AudioEventArgs.Start.
public TimeSpan End { get; }Property Value
Remarks
This clock counts analysed audio, not media position: it advances only as the detector consumes samples,
starting from zero when the pipeline starts. For straight-through playback or capture from the beginning
the two coincide. They diverge if audio is skipped or replayed underneath the detector — seeking a
MediaPlayerCoreX does not reset this clock, so after a seek these times no longer correspond to
positions in the file, and a gap in a live source (a dropped RTSP segment, a microphone xrun) leaves every
later time early by the missing duration.
Label
Gets the AudioSet class display name (for example, "Siren", "Dog", "Glass").
public string Label { get; }Property Value
Start
Gets the time at which the sound crossed the detection threshold, measured from the start of analysis over the audio the detector has actually analysed. See the remarks on VisioForge.Core.Types.Events.AudioEventArgs.End for when that differs from the media position.
public TimeSpan Start { get; }