@@ -26,6 +26,7 @@ pub(crate) enum EventType {
26
26
Diagnostics ,
27
27
Message ( AudioNodeId ) ,
28
28
Complete ,
29
+ AudioProcessing ( AudioNodeId ) ,
29
30
}
30
31
31
32
/// The Error Event interface
@@ -40,6 +41,19 @@ pub struct ErrorEvent {
40
41
pub event : Event ,
41
42
}
42
43
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
+
43
57
/// The OfflineAudioCompletionEvent Event interface
44
58
#[ non_exhaustive]
45
59
#[ derive( Debug ) ]
@@ -59,6 +73,7 @@ pub(crate) enum EventPayload {
59
73
Message ( Box < dyn Any + Send + ' static > ) ,
60
74
AudioContextState ( AudioContextState ) ,
61
75
Complete ( AudioBuffer ) ,
76
+ AudioProcessing ( AudioProcessingEvent ) ,
62
77
}
63
78
64
79
#[ derive( Debug ) ]
@@ -123,6 +138,13 @@ impl EventDispatch {
123
138
payload : EventPayload :: Complete ( buffer) ,
124
139
}
125
140
}
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
+ }
126
148
}
127
149
128
150
pub ( crate ) enum EventHandler {
0 commit comments