@@ -79,6 +79,8 @@ int callback(const void* input, void* output, frame_t frameCount
7979 }
8080 const bool playing = type == PLAY_BUFFER || type == PLAY_RINGBUFFER ;
8181
82+ // Check if the action is due to start in the current block
83+
8284 PaTime io_time = playing ? timeInfo -> outputBufferDacTime
8385 : timeInfo -> inputBufferAdcTime ;
8486 frame_t offset = 0 ;
@@ -115,6 +117,8 @@ int callback(const void* input, void* output, frame_t frameCount
115117 }
116118 }
117119
120+ // Handle CANCEL action
121+
118122 if (action -> type == CANCEL )
119123 {
120124 for (struct action * * i = & (action -> next ); * i ; i = & ((* i )-> next ))
@@ -141,6 +145,8 @@ int callback(const void* input, void* output, frame_t frameCount
141145 continue ;
142146 }
143147
148+ // Get number of remaining frames in the current block
149+
144150 frame_t frames = action -> total_frames - action -> done_frames ;
145151
146152 if (frameCount < frames )
@@ -153,6 +159,8 @@ int callback(const void* input, void* output, frame_t frameCount
153159 frames = frameCount - offset ;
154160 }
155161
162+ // Shove audio data around
163+
156164 float * device_data
157165 = playing ? (float * )output + offset * state -> output_channels
158166 : (float * ) input + offset * state -> input_channels ;
@@ -261,6 +269,8 @@ int callback(const void* input, void* output, frame_t frameCount
261269 }
262270 }
263271
272+ // Clean up, prepare next iteration
273+
264274 if (action -> done_frames == action -> total_frames )
265275 {
266276 remove_action (actionaddr , state );
0 commit comments