diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/Makefile | 3 | ||||
-rw-r--r-- | board/board.h | 4 | ||||
-rw-r--r-- | board/simple_board.h | 9 |
3 files changed, 10 insertions, 6 deletions
diff --git a/board/Makefile b/board/Makefile index 24cb10c..03449cc 100644 --- a/board/Makefile +++ b/board/Makefile @@ -7,6 +7,7 @@ ifeq ($(OS),Windows_NT) OUTEXT = dll else OUTEXT = so + CFLAGS += -fPIC endif default: all @@ -29,4 +30,4 @@ clean: rm -f *.o rm -f *.dll rm -f *.so - rm -f */sound.h
\ No newline at end of file + rm -f */sound.h diff --git a/board/board.h b/board/board.h index c7dfc1f..36d39fb 100644 --- a/board/board.h +++ b/board/board.h @@ -8,9 +8,9 @@ struct board { }; struct board_data { - void (*sound_play)(unsigned char *buffer); + void (*sound_play)(unsigned char *buffer, unsigned int buffer_len); }; typedef struct board *(*fn_board_init)(struct board_data data); -#endif /* CLAK_BOARD_H_ */
\ No newline at end of file +#endif /* CLAK_BOARD_H_ */ diff --git a/board/simple_board.h b/board/simple_board.h index 9d9836b..f0997c7 100644 --- a/board/simple_board.h +++ b/board/simple_board.h @@ -2,17 +2,20 @@ static struct board_data board_data; +#define WAV_LEN(W) PREPROC_CONCAT(W,_len) +#define PREPROC_CONCAT(A, B) A ## B + void board_on_down(void) { #ifdef BOARD_DOWN_WAV - board_data.sound_play(BOARD_DOWN_WAV); + board_data.sound_play(BOARD_DOWN_WAV, WAV_LEN(BOARD_DOWN_WAV)); #endif } void board_on_up(void) { #ifdef BOARD_UP_WAV - board_data.sound_play(BOARD_UP_WAV); + board_data.sound_play(BOARD_UP_WAV, WAV_LEN(BOARD_UP_WAV)); #endif } @@ -30,4 +33,4 @@ struct board *board_init(struct board_data data) { board_data = data; return &board; -}
\ No newline at end of file +} |