Skip to content

Commit fe49c29

Browse files
committed
Add output sound prototype
Need to implement single consumer code.
1 parent 57340b8 commit fe49c29

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

virtio-snd.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -601,18 +601,17 @@ static void virtio_snd_cb(struct CNFADriver *dev,
601601

602602
fprintf(stderr, "start to play\n");
603603
int channels = dev->channelsPlay;
604-
#if 0
605-
/* TODO: apply lock on guest_playing */
606604
uint32_t id = v_ptr->stream_id;
607-
int output_buf_sz = framesp * channels;
605+
int out_buf_sz = framesp * channels;
608606

609-
if (!(playing)) {
610-
memset(out, 0, sizeof(short) * output_buf_sz);
607+
/*if (!(playing)) {
608+
memset(out, 0, sizeof(short) * out_buf_sz);
611609
return;
612-
}
610+
}*/
613611

614-
memcpy(out, vsnd_props[id].buf, output_buf_sz);
615-
#endif
612+
/* TODO: add single consumer */
613+
memcpy(out, vsnd_props[id].ring.buffer, out_buf_sz);
614+
#if 0
616615
for (int i = 0; i < framesp; i++) {
617616
// Shift phase, so we run at 440 Hz (A4)
618617
omega += (3.14159 * 2 * 440.) / dev->spsPlay;
@@ -625,6 +624,7 @@ static void virtio_snd_cb(struct CNFADriver *dev,
625624
*(out++) = value;
626625
}
627626
}
627+
#endif
628628
fprintf(stderr, "totalframesp %d totalframesr %d\n", totalframesp,
629629
totalframesr);
630630

0 commit comments

Comments
 (0)