C4EV3
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
ev3_sound.h
Go to the documentation of this file.
1 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #ifndef ev3_sound_h
34 #define ev3_sound_h
35 
36 #include <stdio.h>
37 #include <fcntl.h>
38 #include <stdlib.h>
39 #include <unistd.h>
40 #include <string.h>
41 #include <signal.h>
42 #include <sys/mman.h>
43 #include <sys/stat.h>
44 #include <stdbool.h>
45 #include <limits.h>
46 #include <errno.h>
47 
48 #include "ev3_wait.h"
49 #include "../include/ev3_constants.h"
50 
51 typedef struct
52 {
53  unsigned short Frequency;
54  unsigned short Duration;
55 } Tone;
56 
57 void PlayFileEx(char* pFileName, uint8_t volume, bool loop);
58 
59 static inline void PlayFile(char* fileName) {
60  PlayFileEx(fileName, 100, false);
61 }
62 
63 void PlayToneEx(unsigned short frequency, unsigned short duration, uint8_t volume);
64 
65 static inline void PlayTone(unsigned short frequency, unsigned short duration) {
66  PlayToneEx(frequency, duration, 100);
67 }
68 
69 void PlaySoundEx(uint8_t aCode, uint8_t volume);
70 
86 static inline void PlaySound(uint8_t aCode) {
87  PlaySoundEx(aCode, 100);
88 }
89 
99 void PlayTones(Tone tones[], size_t size);
100 
101 int SoundState();
102 
103 void StopSound();
104 
105 bool SoundTest();
106 
107 void SoundReady();
108 
109 void MuteSound();
110 
111 void UnmuteSound();
112 
113 void ClearSound();
114 
115 #endif // ev3_sound_h
116 
117 #ifdef __cplusplus
118 }
119 #endif
void ClearSound()
void StopSound()
bool SoundTest()
void PlayToneEx(unsigned short frequency, unsigned short duration, uint8_t volume)
int SoundState()
unsigned short Duration
Definition: ev3_sound.h:54
unsigned short Frequency
Definition: ev3_sound.h:53
Definition: ev3_sound.h:51
void PlayFileEx(char *pFileName, uint8_t volume, bool loop)
void PlaySoundEx(uint8_t aCode, uint8_t volume)
void SoundReady()
void MuteSound()
void PlayTones(Tone tones[], size_t size)
void UnmuteSound()