PageRenderTime 24ms CodeModel.GetById 21ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/Libraries/wave.h

http://espeak-engine.googlecode.com/
C++ Header | 43 lines | 22 code | 10 blank | 11 comment | 0 complexity | 49fb3f95fc01bf13fa47f55dd5d5d86a MD5 | raw file
 1#ifndef WAVE_H
 2#define WAVE_H
 3
 4#ifndef PLATFORM_DOS
 5#include "stdint.h"
 6#endif
 7
 8extern int option_device_number;
 9
10extern void wave_init(int samplerate);
11// TBD: the arg could be "alsa", "oss",...
12extern void* wave_open(const char* the_api);
13
14extern size_t wave_write(void* theHandler, char* theMono16BitsWaveBuffer, size_t theSize);
15extern int wave_close(void* theHandler);
16extern void wave_flush(void* theHandler);
17extern int wave_is_busy(void* theHandler);
18extern void wave_terminate();
19extern uint32_t wave_get_read_position(void* theHandler);
20extern uint32_t wave_get_write_position(void* theHandler);
21
22// Supply the remaining time in ms before the sample is played
23// (or 0 if the event has been already played).
24// sample: sample identifier
25// time: supplied value in ms
26//
27// return 0 if ok or -1 otherwise (stream not opened).
28extern int wave_get_remaining_time(uint32_t sample, uint32_t* time);
29
30// set the callback which informs if the output is still enabled.
31// Helpful if a new sample is waiting for free space whereas sound must be stopped.
32typedef int (t_wave_callback)(void);
33extern void wave_set_callback_is_output_enabled(t_wave_callback* cb);
34
35
36// general functions
37extern void clock_gettime2(struct timespec *ts);
38extern void add_time_in_ms(struct timespec *ts, int time_in_ms);
39
40// for tests
41extern void *wave_test_get_write_buffer();
42
43#endif