From 30547ed47ab653586073ae87d0c986c14ddaf241 Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Thu, 28 Apr 2022 21:54:45 +1000 Subject: Iterate boards in C --- clak.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'clak.c') diff --git a/clak.c b/clak.c index 3a0c5bf..5e947e9 100644 --- a/clak.c +++ b/clak.c @@ -3,15 +3,29 @@ #include #include "board/boards.h" +#define BOARD(str, buf) { .name = str, .wav = buf }, + +typedef struct { + char *name; + unsigned char* wav; +} Board; + +Board boards[] = { + BOARDS +}; +int const boards_n = sizeof(boards) / sizeof(boards[0]); int main(void) { float volume = 0.05; DWORD channel_volume = volume * 0xFFFF; waveOutSetVolume(NULL, (channel_volume << 16) | channel_volume); - while (1) { - PlaySound((const char *) board_mxblue_board_down_wav, NULL, SND_MEMORY | SND_SYNC | SND_NODEFAULT); + + for (int i = 0; i < boards_n; ++i) { + printf("name: %s\n", boards[i].name); + PlaySound((const char *) boards[i].wav, NULL, SND_MEMORY | SND_SYNC | SND_NODEFAULT); Sleep(500); } + return 0; } \ No newline at end of file -- cgit