File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,9 @@ static void *pulseaudio_update(ALLEGRO_THREAD *self, void *data)
190
190
PULSEAUDIO_VOICE * pv = voice -> extra ;
191
191
(void )self ;
192
192
193
+ void * silence = al_malloc (pv -> buffer_size_in_frames * pv -> frame_size_in_bytes );
194
+ al_fill_silence (silence , pv -> buffer_size_in_frames , voice -> depth , voice -> chan_conf );
195
+
193
196
for (;;) {
194
197
enum PULSEAUDIO_VOICE_STATUS status ;
195
198
@@ -208,10 +211,12 @@ static void *pulseaudio_update(ALLEGRO_THREAD *self, void *data)
208
211
if (voice -> is_streaming ) {
209
212
// streaming audio
210
213
const void * data = _al_voice_update (voice , voice -> mutex , & frames );
211
- if (data ) {
212
- pa_simple_write ( pv -> s , data ,
213
- frames * pv -> frame_size_in_bytes , NULL ) ;
214
+ if (! data ) {
215
+ data = silence ;
216
+ frames = pv -> buffer_size_in_frames ;
214
217
}
218
+ pa_simple_write (pv -> s , data ,
219
+ frames * pv -> frame_size_in_bytes , NULL );
215
220
}
216
221
else {
217
222
// direct buffer audio
@@ -246,6 +251,7 @@ static void *pulseaudio_update(ALLEGRO_THREAD *self, void *data)
246
251
al_unlock_mutex (voice -> mutex );
247
252
}
248
253
}
254
+ al_free (silence );
249
255
250
256
return NULL ;
251
257
}
You can’t perform that action at this time.
0 commit comments