blob: d6ad034c60f7d05d0fa93be6735693fc2069ba36 (
plain) (
tree)
|
|
#include <stdio.h>
#include <unistd.h>
#include <windows.h>
#define VOLUME 0.05
#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]);
void sound_init(void)
{
DWORD channel_volume = VOLUME * 0xFFFF;
waveOutSetVolume(NULL, (channel_volume << 16) | channel_volume);
}
void sound_play(unsigned char* buffer)
{
PlaySound((const char *) buffer, NULL, SND_MEMORY | SND_SYNC | SND_NODEFAULT);
}
int main(void)
{
sound_init();
for (int i = 0; i < boards_n; ++i) {
printf("name: %s\n", boards[i].name);
sound_play(boards[i].wav);
sleep(0.5);
}
return 0;
}
|