| 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 |
#ifndef _CST_AUDIO_H__ |
| 41 |
#define _CST_AUDIO_H__ |
| 42 |
|
| 43 |
#include "cst_wave.h" |
| 44 |
#include "cst_hrg.h" |
| 45 |
|
| 46 |
#ifdef CST_AUDIO_WIN32 |
| 47 |
#define CST_AUDIOBUFFSIZE 8092 |
| 48 |
#else |
| 49 |
#define CST_AUDIOBUFFSIZE 128 |
| 50 |
#endif |
| 51 |
|
| 52 |
#define CST_AUDIO_DEFAULT_PORT 1746 |
| 53 |
#define CST_AUDIO_DEFAULT_SERVER "localhost" |
| 54 |
#define CST_AUDIO_DEFAULT_ENCODING "short" |
| 55 |
|
| 56 |
typedef enum { |
| 57 |
CST_AUDIO_LINEAR16 = 0, |
| 58 |
CST_AUDIO_LINEAR8, |
| 59 |
CST_AUDIO_MULAW |
| 60 |
} cst_audiofmt; |
| 61 |
|
| 62 |
int audio_bps(cst_audiofmt fmt); |
| 63 |
|
| 64 |
typedef struct cst_audiodev_struct { |
| 65 |
int sps, real_sps; |
| 66 |
int channels, real_channels; |
| 67 |
cst_audiofmt fmt, real_fmt; |
| 68 |
int byteswap; |
| 69 |
cst_rateconv *rateconv; |
| 70 |
void *platform_data; |
| 71 |
} cst_audiodev; |
| 72 |
|
| 73 |
|
| 74 |
cst_audiodev *audio_open(int sps, int channels, cst_audiofmt fmt); |
| 75 |
int audio_close(cst_audiodev *ad); |
| 76 |
int audio_write(cst_audiodev *ad, void *buff, int num_bytes); |
| 77 |
int audio_flush(cst_audiodev *ad); |
| 78 |
int audio_drain(cst_audiodev *ad); |
| 79 |
|
| 80 |
|
| 81 |
int play_wave(cst_wave *w); |
| 82 |
int play_wave_sync(cst_wave *w, cst_relation *rel, |
| 83 |
int (*call_back)(cst_item *)); |
| 84 |
int play_wave_client(cst_wave *w, const char *servername, int port, |
| 85 |
const char *encoding); |
| 86 |
int auserver(int port); |
| 87 |
|
| 88 |
|
| 89 |
int play_wave_device(cst_wave *w, cst_audiodev *ad); |
| 90 |
|
| 91 |
|
| 92 |
cst_audiodev *audio_open_file(int sps, int channels, cst_audiofmt fmt, |
| 93 |
const char *filename); |
| 94 |
int audio_close_file(cst_audiodev *ad); |
| 95 |
int audio_write_file(cst_audiodev *ad, void *buff, int num_bytes); |
| 96 |
int audio_drain_file(cst_audiodev *ad); |
| 97 |
int audio_flush_file(cst_audiodev *ad); |
| 98 |
|
| 99 |
|
| 100 |
#define CST_AUDIO_STREAM_STOP -1 |
| 101 |
#define CST_AUDIO_STREAM_CONT 0 |
| 102 |
typedef int (*cst_audio_stream_callback)(const cst_wave *w,int start,int size, |
| 103 |
int last, void *user); |
| 104 |
typedef struct cst_audio_streaming_info_struct |
| 105 |
{ |
| 106 |
int min_buffsize; |
| 107 |
cst_audio_stream_callback asc; |
| 108 |
void *userdata; |
| 109 |
} cst_audio_streaming_info; |
| 110 |
cst_audio_streaming_info *new_audio_streaming_info(); |
| 111 |
void delete_audio_streaming_info(cst_audio_streaming_info *asi); |
| 112 |
CST_VAL_USER_TYPE_DCLS(audio_streaming_info,cst_audio_streaming_info) |
| 113 |
|
| 114 |
|
| 115 |
int audio_stream_chunk(const cst_wave *w, int start, int size, |
| 116 |
int last, void *user); |
| 117 |
|
| 118 |
#endif |