Navit SVN

/work/compile/navit/src/navit/support/espeak/wave.h

00001 #ifndef WAVE_H
00002 #define WAVE_H
00003 
00004 #ifdef _MSC_VER
00005 
00006 typedef __int32 int32_t;
00007 typedef unsigned __int32 uint32_t;
00008 typedef __int64 int64_t;
00009 typedef unsigned __int32 uint64_t;
00010 
00011 #else
00012 #ifndef PLATFORM_DOS
00013 #include "stdint.h"
00014 #endif
00015 #endif
00016 
00017 extern int option_device_number;
00018 
00019 extern void wave_init();
00020 // TBD: the arg could be "alsa", "oss",...
00021 extern void* wave_open(const char* the_api);
00022 
00023 extern size_t wave_write(void* theHandler, char* theMono16BitsWaveBuffer, size_t theSize);
00024 extern int wave_close(void* theHandler);
00025 extern void wave_flush(void* theHandler);
00026 extern int wave_is_busy(void* theHandler);
00027 extern void wave_terminate();
00028 extern uint32_t wave_get_read_position(void* theHandler);
00029 extern uint32_t wave_get_write_position(void* theHandler);
00030 
00031 // Supply the remaining time in ms before the sample is played
00032 // (or 0 if the event has been already played).
00033 // sample: sample identifier
00034 // time: supplied value in ms
00035 //
00036 // return 0 if ok or -1 otherwise (stream not opened).
00037 extern int wave_get_remaining_time(uint32_t sample, uint32_t* time);
00038 
00039 // set the callback which informs if the output is still enabled.
00040 // Helpful if a new sample is waiting for free space whereas sound must be stopped.
00041 typedef int (t_wave_callback)(void);
00042 extern void wave_set_callback_is_output_enabled(t_wave_callback* cb);
00043 
00044 
00045 // general functions
00046 extern void clock_gettime2(struct timespec *ts);
00047 extern void add_time_in_ms(struct timespec *ts, int time_in_ms);
00048 
00049 // for tests
00050 extern void *wave_test_get_write_buffer();
00051 
00052 #endif