Skip to content

Commit

Permalink
Set CNFA opaque for sound playing control
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuda-Chen committed Sep 22, 2024
1 parent d33d07b commit b95833c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion virtio-snd.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ static void virtio_snd_cb(struct CNFADriver *dev,
int framesp,
int framesr)
{
/* TODO: apply lock on guest_playing */
if (framesp > 0) { // playback
if (!guest_playing)
memset(out, 0, framesp * 2);
Expand Down Expand Up @@ -699,7 +700,7 @@ bool virtio_snd_init(virtio_snd_state_t *vsnd)
vsnd->priv = &vsnd_configs[vsnd_dev_cnt++];

audio_host = CNFAInit(NULL, "semu-virtio-snd", virtio_snd_cb, 44100, 0, 1,
0, 1024, NULL, NULL, NULL);
0, 1024, NULL, NULL, &guest_playing);

if (!audio_host) {
fprintf(stderr, "virtio-snd driver initialization failed.\n");
Expand Down

0 comments on commit b95833c

Please sign in to comment.