@@ -26,6 +26,7 @@ pub(crate) enum EventType {
2626 Diagnostics ,
2727 Message ( AudioNodeId ) ,
2828 Complete ,
29+ AudioProcessing ( AudioNodeId ) ,
2930}
3031
3132/// The Error Event interface
@@ -40,6 +41,19 @@ pub struct ErrorEvent {
4041 pub event : Event ,
4142}
4243
44+ /// The AudioProcessingEvent interface
45+ #[ non_exhaustive]
46+ #[ derive( Debug ) ]
47+ pub struct AudioProcessingEvent {
48+ /// The input buffer
49+ pub input_buffer : AudioBuffer ,
50+ /// The output buffer
51+ pub output_buffer : AudioBuffer ,
52+ /// The time when the audio will be played in the same time coordinate system as the
53+ /// AudioContext's currentTime.
54+ pub playback_time : f64 ,
55+ }
56+
4357/// The OfflineAudioCompletionEvent Event interface
4458#[ non_exhaustive]
4559#[ derive( Debug ) ]
@@ -59,6 +73,7 @@ pub(crate) enum EventPayload {
5973 Message ( Box < dyn Any + Send + ' static > ) ,
6074 AudioContextState ( AudioContextState ) ,
6175 Complete ( AudioBuffer ) ,
76+ AudioProcessing ( AudioProcessingEvent ) ,
6277}
6378
6479#[ derive( Debug ) ]
@@ -123,6 +138,13 @@ impl EventDispatch {
123138 payload : EventPayload :: Complete ( buffer) ,
124139 }
125140 }
141+
142+ pub fn audio_processing ( id : AudioNodeId , value : AudioProcessingEvent ) -> Self {
143+ EventDispatch {
144+ type_ : EventType :: AudioProcessing ( id) ,
145+ payload : EventPayload :: AudioProcessing ( value) ,
146+ }
147+ }
126148}
127149
128150pub ( crate ) enum EventHandler {
0 commit comments