comparison libao2/ao_pcm.c @ 3095:981a9e5118ce

interface to libao2 changed ao_plugin added
author anders
date Sat, 24 Nov 2001 05:21:22 +0000
parents d92e19f1ae71
children de4074ab4e5f
comparison
equal deleted inserted replaced
3094:4150aff2ac17 3095:981a9e5118ce
11 "Atmosfear", 11 "Atmosfear",
12 "" 12 ""
13 }; 13 };
14 14
15 LIBAO_EXTERN(pcm) 15 LIBAO_EXTERN(pcm)
16
17 // there are some globals:
18 // ao_samplerate
19 // ao_channels
20 // ao_format
21 // ao_bps
22 // ao_outburst
23 // ao_buffersize
24 16
25 char *ao_outputfilename = NULL; 17 char *ao_outputfilename = NULL;
26 int ao_pcm_waveheader = 1; 18 int ao_pcm_waveheader = 1;
27 19
28 #define WAV_ID_RIFF 0x46464952 /* "RIFF" */ 20 #define WAV_ID_RIFF 0x46464952 /* "RIFF" */
88 printf("PCM: File: %s (%s) Samplerate: %iHz Channels: %s Format %s\n", ao_outputfilename, (ao_pcm_waveheader?"WAVE":"RAW PCM"), rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format)); 80 printf("PCM: File: %s (%s) Samplerate: %iHz Channels: %s Format %s\n", ao_outputfilename, (ao_pcm_waveheader?"WAVE":"RAW PCM"), rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format));
89 printf("PCM: Info - fastest dumping is achieved with -vo null -hardframedrop.\n"); 81 printf("PCM: Info - fastest dumping is achieved with -vo null -hardframedrop.\n");
90 printf("PCM: Info - to write WAVE files use -waveheader (default), for RAW PCM -nowaveheader.\n"); 82 printf("PCM: Info - to write WAVE files use -waveheader (default), for RAW PCM -nowaveheader.\n");
91 fp = fopen(ao_outputfilename, "wb"); 83 fp = fopen(ao_outputfilename, "wb");
92 84
93 ao_outburst = 4096; 85 ao_data.outburst = 4096;
94 86
95 87
96 if(fp) { 88 if(fp) {
97 if(ao_pcm_waveheader) /* Reserve space for wave header */ 89 if(ao_pcm_waveheader) /* Reserve space for wave header */
98 fseek(fp, sizeof(wavhdr), SEEK_SET); 90 fseek(fp, sizeof(wavhdr), SEEK_SET);
132 } 124 }
133 125
134 // return: how many bytes can be played without blocking 126 // return: how many bytes can be played without blocking
135 static int get_space(){ 127 static int get_space(){
136 128
137 return ao_outburst; 129 return ao_data.outburst;
138 } 130 }
139 131
140 // plays 'len' bytes of 'data' 132 // plays 'len' bytes of 'data'
141 // it should round it down to outburst*n 133 // it should round it down to outburst*n
142 // return: number of bytes played 134 // return: number of bytes played
149 wavhdr.data_length += len; 141 wavhdr.data_length += len;
150 142
151 return len; 143 return len;
152 } 144 }
153 145
154 // return: how many unplayed bytes are in the buffer 146 // return: delay in seconds between first and last sample in buffer
155 static int get_delay(){ 147 static float get_delay(){
156 148
157 return 0; 149 return 0.0;
158 } 150 }
159 151
160 152
161 153
162 154