1 #include "task_audio.h"
7 #define AUDIO_CMD_PLAY 'd'
8 #define AUDIO_CMD_VOLUME 'v'
10 int audio_play(int (*readfunc)(void *buf, int siz))
16 p = kz_kmalloc(8 + siz);
17 cnt = readfunc((void *)&p[8], siz);
19 p[0] = AUDIO_CMD_PLAY;
21 p[2] = (siz >> 8) & 0xff;
22 p[3] = (siz >> 0) & 0xff;
23 p[4] = (cnt >> 8) & 0xff;
24 p[5] = (cnt >> 0) & 0xff;
27 kz_send(MSGBOX_ID_AUDIO, 8 + siz, p);
29 return (siz == cnt) ? 1 : 0;
32 int audio_volume(const int left, const int right)
36 p[0] = AUDIO_CMD_VOLUME;
40 if ((0 <= left) && (left <= 255) && (0 <= right) && (right <= 255)) {
41 kz_send(MSGBOX_ID_AUDIO, 4, p);
47 static int waitfunc(void)
53 static int audio_cmdproc(char *p)
58 vs1011e_play_with_data(
60 ((unsigned char)p[4] << 8) | ((unsigned char)p[5] << 0),
63 case AUDIO_CMD_VOLUME:
64 puts("L:"); putxval(p[2], 2); puts("\n");
65 puts("R:"); putxval(p[3], 2); puts("\n");
66 vs1011e_volume_write(p[2], p[3]);
76 int task_audio(int argc, char *argv[])
82 kz_recv(MSGBOX_ID_AUDIO, &size, &p);