-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtextToSpeech.c
42 lines (35 loc) · 1.09 KB
/
textToSpeech.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "audioMixer.h"
#include "InputManager.h"
char *soundFiles[NUMBER_OF_INPUTS];
wavedata_t audioFiles[NUMBER_OF_INPUTS];
void TextToSpeech_init()
{
AudioMixer_init();
soundFiles[JOYSTICK_UP] = "joystick/up";
soundFiles[JOYSTICK_DOWN] = "joystick/down";
soundFiles[JOYSTICK_LEFT] = "joystick/left";
soundFiles[JOYSTICK_RIGHT] = "joystick/right";
soundFiles[JOYSTICK_CENTER] = "joystick/in";
soundFiles[ACCELEROMETER_TILT_LEFT] = "accelerometer/left";
soundFiles[ACCELEROMETER_TILT_RIGHT] = "accelerometer/right";
soundFiles[ACCELEROMETER_PITCH_UP] = "accelerometer/up";
soundFiles[ACCELEROMETER_PITCH_DOWN] = "accelerometer/down";
soundFiles[POTENTIOMETER_TURN] = "potentiometer/turn";
soundFiles[BUTTON_SEQUENCE] = "buttons/sequence";
for(int i = 0;i < NUMBER_OF_INPUTS;i++)
{
AudioMixer_readWaveFileIntoMemory(soundFiles[i], &(audioFiles[i]));
}
}
void TextToSpeech_cleanup()
{
AudioMixer_cleanup();
for(int i = 0;i < NUMBER_OF_INPUTS;i++)
{
AudioMixer_freeWaveFileData(&(audioFiles[i]));
}
}
void TextToSpeech_speak(int sound)
{
AudioMixer_queueSound(&(audioFiles[sound]));
}