Mercurial > mplayer.hg
annotate libao2/ao_win32.c @ 28039:a95ac8f0336e
Reindent after previous commit
author | reimar |
---|---|
date | Wed, 03 Dec 2008 10:42:53 +0000 |
parents | 0f42fb42843c |
children | ceafb4a24753 |
rev | line source |
---|---|
26743
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23457
diff
changeset
|
1 /* |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23457
diff
changeset
|
2 * Windows waveOut interface |
7913 | 3 * |
26743
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23457
diff
changeset
|
4 * Copyright (c) 2002 - 2004 Sascha Sommer <saschasommer@freenet.de> |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23457
diff
changeset
|
5 * |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23457
diff
changeset
|
6 * This file is part of MPlayer. |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23457
diff
changeset
|
7 * |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23457
diff
changeset
|
8 * MPlayer is free software; you can redistribute it and/or modify |
7913 | 9 * it under the terms of the GNU General Public License as published by |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
26743
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23457
diff
changeset
|
13 * MPlayer is distributed in the hope that it will be useful, |
7913 | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
26743
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23457
diff
changeset
|
18 * You should have received a copy of the GNU General Public License along |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23457
diff
changeset
|
19 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23457
diff
changeset
|
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
0f42fb42843c
Use standard license headers with standard formatting.
diego
parents:
23457
diff
changeset
|
21 */ |
7913 | 22 |
23 #include <stdio.h> | |
24 #include <stdlib.h> | |
25 #include <windows.h> | |
26 #include <mmsystem.h> | |
27 | |
14479 | 28 #include "config.h" |
14245 | 29 #include "libaf/af_format.h" |
7913 | 30 #include "audio_out.h" |
31 #include "audio_out_internal.h" | |
14123 | 32 #include "mp_msg.h" |
33 #include "libvo/fastmemcpy.h" | |
12093
f54d02f6ddbf
let uninit wait until sound is completely played, don't restore volume at exit, fixed ringbuffer bug, patch by Nehal <nehalmistry at gmx.net>\n
faust3
parents:
11511
diff
changeset
|
34 #include "osdep/timer.h" |
7913 | 35 |
12699
02efc0619f61
10l WAVE_FORMAT_DOLBY_AC3_SPDIF needs to be defined first, patch by Gianluigi Tiesi <sherpya at netfarm.it>
faust3
parents:
12684
diff
changeset
|
36 #define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092 |
13017 | 37 #define WAVE_FORMAT_EXTENSIBLE 0xFFFE |
38 | |
39 static const GUID KSDATAFORMAT_SUBTYPE_PCM = { | |
40 0x1,0x0000,0x0010,{0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71} | |
41 }; | |
42 | |
43 typedef struct { | |
44 WAVEFORMATEX Format; | |
45 union { | |
46 WORD wValidBitsPerSample; | |
47 WORD wSamplesPerBlock; | |
48 WORD wReserved; | |
49 } Samples; | |
50 DWORD dwChannelMask; | |
51 GUID SubFormat; | |
52 } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE; | |
53 | |
54 #define SPEAKER_FRONT_LEFT 0x1 | |
55 #define SPEAKER_FRONT_RIGHT 0x2 | |
56 #define SPEAKER_FRONT_CENTER 0x4 | |
57 #define SPEAKER_LOW_FREQUENCY 0x8 | |
58 #define SPEAKER_BACK_LEFT 0x10 | |
59 #define SPEAKER_BACK_RIGHT 0x20 | |
60 #define SPEAKER_FRONT_LEFT_OF_CENTER 0x40 | |
61 #define SPEAKER_FRONT_RIGHT_OF_CENTER 0x80 | |
62 #define SPEAKER_BACK_CENTER 0x100 | |
63 #define SPEAKER_SIDE_LEFT 0x200 | |
64 #define SPEAKER_SIDE_RIGHT 0x400 | |
65 #define SPEAKER_TOP_CENTER 0x800 | |
66 #define SPEAKER_TOP_FRONT_LEFT 0x1000 | |
67 #define SPEAKER_TOP_FRONT_CENTER 0x2000 | |
68 #define SPEAKER_TOP_FRONT_RIGHT 0x4000 | |
69 #define SPEAKER_TOP_BACK_LEFT 0x8000 | |
70 #define SPEAKER_TOP_BACK_CENTER 0x10000 | |
71 #define SPEAKER_TOP_BACK_RIGHT 0x20000 | |
72 | |
73 static const int channel_mask[] = { | |
74 SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY, | |
75 SPEAKER_FRONT_LEFT | SPEAKER_FRONT_CENTER | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY, | |
76 SPEAKER_FRONT_LEFT | SPEAKER_FRONT_CENTER | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_CENTER | SPEAKER_LOW_FREQUENCY, | |
77 SPEAKER_FRONT_LEFT | SPEAKER_FRONT_CENTER | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_LOW_FREQUENCY | |
78 }; | |
79 | |
80 | |
12699
02efc0619f61
10l WAVE_FORMAT_DOLBY_AC3_SPDIF needs to be defined first, patch by Gianluigi Tiesi <sherpya at netfarm.it>
faust3
parents:
12684
diff
changeset
|
81 |
12155
deb95ac21f14
restore original ringbuffer constants as the current values are causing heavy stutter here, especially noticable after moving the video window
faust3
parents:
12151
diff
changeset
|
82 #define SAMPLESIZE 1024 |
7913 | 83 #define BUFFER_SIZE 4096 |
12155
deb95ac21f14
restore original ringbuffer constants as the current values are causing heavy stutter here, especially noticable after moving the video window
faust3
parents:
12151
diff
changeset
|
84 #define BUFFER_COUNT 16 |
7913 | 85 |
86 | |
87 static WAVEHDR* waveBlocks; //pointer to our ringbuffer memory | |
88 static HWAVEOUT hWaveOut; //handle to the waveout device | |
89 static unsigned int buf_write=0; | |
90 static unsigned int buf_write_pos=0; | |
91 static int full_buffers=0; | |
92 static int buffered_bytes=0; | |
93 | |
94 | |
95 static ao_info_t info = | |
96 { | |
97 "Windows waveOut audio output", | |
98 "win32", | |
99 "Sascha Sommer <saschasommer@freenet.de>", | |
100 "" | |
101 }; | |
102 | |
103 LIBAO_EXTERN(win32) | |
104 | |
105 static void CALLBACK waveOutProc(HWAVEOUT hWaveOut,UINT uMsg,DWORD dwInstance, | |
106 DWORD dwParam1,DWORD dwParam2) | |
107 { | |
108 if(uMsg != WOM_DONE) | |
109 return; | |
12093
f54d02f6ddbf
let uninit wait until sound is completely played, don't restore volume at exit, fixed ringbuffer bug, patch by Nehal <nehalmistry at gmx.net>\n
faust3
parents:
11511
diff
changeset
|
110 if (full_buffers) { |
f54d02f6ddbf
let uninit wait until sound is completely played, don't restore volume at exit, fixed ringbuffer bug, patch by Nehal <nehalmistry at gmx.net>\n
faust3
parents:
11511
diff
changeset
|
111 buffered_bytes-=BUFFER_SIZE; |
f54d02f6ddbf
let uninit wait until sound is completely played, don't restore volume at exit, fixed ringbuffer bug, patch by Nehal <nehalmistry at gmx.net>\n
faust3
parents:
11511
diff
changeset
|
112 --full_buffers; |
f54d02f6ddbf
let uninit wait until sound is completely played, don't restore volume at exit, fixed ringbuffer bug, patch by Nehal <nehalmistry at gmx.net>\n
faust3
parents:
11511
diff
changeset
|
113 } else { |
f54d02f6ddbf
let uninit wait until sound is completely played, don't restore volume at exit, fixed ringbuffer bug, patch by Nehal <nehalmistry at gmx.net>\n
faust3
parents:
11511
diff
changeset
|
114 buffered_bytes=0; |
f54d02f6ddbf
let uninit wait until sound is completely played, don't restore volume at exit, fixed ringbuffer bug, patch by Nehal <nehalmistry at gmx.net>\n
faust3
parents:
11511
diff
changeset
|
115 } |
7913 | 116 } |
117 | |
118 // to set/get/query special features/parameters | |
9633
12b1790038b0
64bit libao2 fix by Jens Axboe <mplayer-dev@kernel.dk>
alex
parents:
9589
diff
changeset
|
119 static int control(int cmd,void *arg) |
7913 | 120 { |
121 DWORD volume; | |
122 switch (cmd) | |
123 { | |
124 case AOCONTROL_GET_VOLUME: | |
125 { | |
126 ao_control_vol_t* vol = (ao_control_vol_t*)arg; | |
127 waveOutGetVolume(hWaveOut,&volume); | |
128 vol->left = (float)(LOWORD(volume)/655.35); | |
129 vol->right = (float)(HIWORD(volume)/655.35); | |
130 mp_msg(MSGT_AO, MSGL_DBG2,"ao_win32: volume left:%f volume right:%f\n",vol->left,vol->right); | |
131 return CONTROL_OK; | |
132 } | |
133 case AOCONTROL_SET_VOLUME: | |
134 { | |
135 ao_control_vol_t* vol = (ao_control_vol_t*)arg; | |
136 volume = MAKELONG(vol->left*655.35,vol->right*655.35); | |
137 waveOutSetVolume(hWaveOut,volume); | |
138 return CONTROL_OK; | |
139 } | |
140 } | |
141 return -1; | |
142 } | |
143 | |
144 // open & setup audio device | |
145 // return: 1=success 0=fail | |
146 static int init(int rate,int channels,int format,int flags) | |
147 { | |
13017 | 148 WAVEFORMATEXTENSIBLE wformat; |
7913 | 149 DWORD totalBufferSize = (BUFFER_SIZE + sizeof(WAVEHDR)) * BUFFER_COUNT; |
150 MMRESULT result; | |
151 unsigned char* buffer; | |
152 int i; | |
153 | |
14135 | 154 switch(format){ |
14245 | 155 case AF_FORMAT_AC3: |
156 case AF_FORMAT_S24_LE: | |
157 case AF_FORMAT_S16_LE: | |
158 case AF_FORMAT_S8: | |
14135 | 159 break; |
160 default: | |
14264 | 161 mp_msg(MSGT_AO, MSGL_V,"ao_win32: format %s not supported defaulting to Signed 16-bit Little-Endian\n",af_fmt2str_short(format)); |
14245 | 162 format=AF_FORMAT_S16_LE; |
14135 | 163 } |
19835
807cdfafa0ce
disable multichannel mode, it never worked reliable
faust3
parents:
19614
diff
changeset
|
164 |
807cdfafa0ce
disable multichannel mode, it never worked reliable
faust3
parents:
19614
diff
changeset
|
165 // FIXME multichannel mode is buggy |
807cdfafa0ce
disable multichannel mode, it never worked reliable
faust3
parents:
19614
diff
changeset
|
166 if(channels > 2) |
807cdfafa0ce
disable multichannel mode, it never worked reliable
faust3
parents:
19614
diff
changeset
|
167 channels = 2; |
807cdfafa0ce
disable multichannel mode, it never worked reliable
faust3
parents:
19614
diff
changeset
|
168 |
7913 | 169 //fill global ao_data |
170 ao_data.channels=channels; | |
171 ao_data.samplerate=rate; | |
172 ao_data.format=format; | |
173 ao_data.bps=channels*rate; | |
14245 | 174 if(format != AF_FORMAT_U8 && format != AF_FORMAT_S8) |
7913 | 175 ao_data.bps*=2; |
176 if(ao_data.buffersize==-1) | |
177 { | |
14264 | 178 ao_data.buffersize=af_fmt2bits(format)/8; |
7913 | 179 ao_data.buffersize*= channels; |
180 ao_data.buffersize*= SAMPLESIZE; | |
181 } | |
14264 | 182 mp_msg(MSGT_AO, MSGL_V,"ao_win32: Samplerate:%iHz Channels:%i Format:%s\n",rate, channels, af_fmt2str_short(format)); |
7913 | 183 mp_msg(MSGT_AO, MSGL_V,"ao_win32: Buffersize:%d\n",ao_data.buffersize); |
184 | |
185 //fill waveformatex | |
13017 | 186 ZeroMemory( &wformat, sizeof(WAVEFORMATEXTENSIBLE)); |
13735
83c5f9888576
ringbuffer variable intialization fix for multifile playback patch by Rune Petersen <rune.mail-list at mail.tele.dk>
faust3
parents:
13017
diff
changeset
|
187 wformat.Format.cbSize = (channels>2)?sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX):0; |
13017 | 188 wformat.Format.nChannels = channels; |
189 wformat.Format.nSamplesPerSec = rate; | |
14245 | 190 if(format == AF_FORMAT_AC3) |
12684
47598beff93a
ac3 passthrough, initial patch by Gianluigi Tiesi <sherpya at netfarm.it>
faust3
parents:
12155
diff
changeset
|
191 { |
13017 | 192 wformat.Format.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF; |
193 wformat.Format.wBitsPerSample = 16; | |
194 wformat.Format.nBlockAlign = 4; | |
12684
47598beff93a
ac3 passthrough, initial patch by Gianluigi Tiesi <sherpya at netfarm.it>
faust3
parents:
12155
diff
changeset
|
195 } |
47598beff93a
ac3 passthrough, initial patch by Gianluigi Tiesi <sherpya at netfarm.it>
faust3
parents:
12155
diff
changeset
|
196 else |
47598beff93a
ac3 passthrough, initial patch by Gianluigi Tiesi <sherpya at netfarm.it>
faust3
parents:
12155
diff
changeset
|
197 { |
13017 | 198 wformat.Format.wFormatTag = (channels>2)?WAVE_FORMAT_EXTENSIBLE:WAVE_FORMAT_PCM; |
14264 | 199 wformat.Format.wBitsPerSample = af_fmt2bits(format); |
13017 | 200 wformat.Format.nBlockAlign = wformat.Format.nChannels * (wformat.Format.wBitsPerSample >> 3); |
201 } | |
202 if(channels>2) | |
203 { | |
204 wformat.dwChannelMask = channel_mask[channels-3]; | |
205 wformat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; | |
14264 | 206 wformat.Samples.wValidBitsPerSample=af_fmt2bits(format); |
13017 | 207 } |
208 | |
209 wformat.Format.nAvgBytesPerSec = wformat.Format.nSamplesPerSec * wformat.Format.nBlockAlign; | |
7913 | 210 |
211 //open sound device | |
212 //WAVE_MAPPER always points to the default wave device on the system | |
14529
cc9c088305d9
WAVE_FORMAT_DIRECT seems to cause problems with certain os/driver combinations and seems to be useless anyway
faust3
parents:
14503
diff
changeset
|
213 result = waveOutOpen(&hWaveOut,WAVE_MAPPER,(WAVEFORMATEX*)&wformat,(DWORD_PTR)waveOutProc,0,CALLBACK_FUNCTION); |
7913 | 214 if(result == WAVERR_BADFORMAT) |
215 { | |
216 mp_msg(MSGT_AO, MSGL_ERR,"ao_win32: format not supported switching to default\n"); | |
13017 | 217 ao_data.channels = wformat.Format.nChannels = 2; |
218 ao_data.samplerate = wformat.Format.nSamplesPerSec = 44100; | |
14245 | 219 ao_data.format = AF_FORMAT_S16_LE; |
13017 | 220 ao_data.bps=ao_data.channels * ao_data.samplerate*2; |
221 wformat.Format.wBitsPerSample=16; | |
222 wformat.Format.wFormatTag=WAVE_FORMAT_PCM; | |
223 wformat.Format.nBlockAlign = wformat.Format.nChannels * (wformat.Format.wBitsPerSample >> 3); | |
224 wformat.Format.nAvgBytesPerSec = wformat.Format.nSamplesPerSec * wformat.Format.nBlockAlign; | |
225 ao_data.buffersize=(wformat.Format.wBitsPerSample>>3)*wformat.Format.nChannels*SAMPLESIZE; | |
226 result = waveOutOpen(&hWaveOut,WAVE_MAPPER,(WAVEFORMATEX*)&wformat,(DWORD_PTR)waveOutProc,0,CALLBACK_FUNCTION); | |
7913 | 227 } |
228 if(result != MMSYSERR_NOERROR) | |
229 { | |
14503 | 230 mp_msg(MSGT_AO, MSGL_ERR,"ao_win32: unable to open wave mapper device (result=%i)\n",result); |
7913 | 231 return 0; |
232 } | |
233 //allocate buffer memory as one big block | |
234 buffer = malloc(totalBufferSize); | |
9589 | 235 memset(buffer,0x0,totalBufferSize); |
7913 | 236 //and setup pointers to each buffer |
237 waveBlocks = (WAVEHDR*)buffer; | |
238 buffer += sizeof(WAVEHDR) * BUFFER_COUNT; | |
239 for(i = 0; i < BUFFER_COUNT; i++) { | |
240 waveBlocks[i].lpData = buffer; | |
241 buffer += BUFFER_SIZE; | |
242 } | |
13735
83c5f9888576
ringbuffer variable intialization fix for multifile playback patch by Rune Petersen <rune.mail-list at mail.tele.dk>
faust3
parents:
13017
diff
changeset
|
243 buf_write=0; |
83c5f9888576
ringbuffer variable intialization fix for multifile playback patch by Rune Petersen <rune.mail-list at mail.tele.dk>
faust3
parents:
13017
diff
changeset
|
244 buf_write_pos=0; |
83c5f9888576
ringbuffer variable intialization fix for multifile playback patch by Rune Petersen <rune.mail-list at mail.tele.dk>
faust3
parents:
13017
diff
changeset
|
245 full_buffers=0; |
83c5f9888576
ringbuffer variable intialization fix for multifile playback patch by Rune Petersen <rune.mail-list at mail.tele.dk>
faust3
parents:
13017
diff
changeset
|
246 buffered_bytes=0; |
7913 | 247 |
248 return 1; | |
249 } | |
250 | |
251 // close audio device | |
12145 | 252 static void uninit(int immed) |
7913 | 253 { |
12146 | 254 if(!immed)while(buffered_bytes > 0)usec_sleep(50000); |
255 else buffered_bytes=0; | |
7913 | 256 waveOutReset(hWaveOut); |
257 waveOutClose(hWaveOut); | |
258 mp_msg(MSGT_AO, MSGL_V,"waveOut device closed\n"); | |
259 free(waveBlocks); | |
260 mp_msg(MSGT_AO, MSGL_V,"buffer memory freed\n"); | |
261 } | |
262 | |
263 // stop playing and empty buffers (for seeking/pause) | |
18915
99e20a22d5d0
modifies function declarations without parameters from ()
reynaldo
parents:
14529
diff
changeset
|
264 static void reset(void) |
7913 | 265 { |
266 waveOutReset(hWaveOut); | |
267 buf_write=0; | |
268 buf_write_pos=0; | |
269 full_buffers=0; | |
270 buffered_bytes=0; | |
271 } | |
272 | |
273 // stop playing, keep buffers (for pause) | |
18915
99e20a22d5d0
modifies function declarations without parameters from ()
reynaldo
parents:
14529
diff
changeset
|
274 static void audio_pause(void) |
7913 | 275 { |
276 waveOutPause(hWaveOut); | |
277 } | |
278 | |
279 // resume playing, after audio_pause() | |
18915
99e20a22d5d0
modifies function declarations without parameters from ()
reynaldo
parents:
14529
diff
changeset
|
280 static void audio_resume(void) |
7913 | 281 { |
282 waveOutRestart(hWaveOut); | |
283 } | |
284 | |
285 // return: how many bytes can be played without blocking | |
18915
99e20a22d5d0
modifies function declarations without parameters from ()
reynaldo
parents:
14529
diff
changeset
|
286 static int get_space(void) |
7913 | 287 { |
12093
f54d02f6ddbf
let uninit wait until sound is completely played, don't restore volume at exit, fixed ringbuffer bug, patch by Nehal <nehalmistry at gmx.net>\n
faust3
parents:
11511
diff
changeset
|
288 return BUFFER_COUNT*BUFFER_SIZE - buffered_bytes; |
7913 | 289 } |
290 | |
291 //writes data into buffer, based on ringbuffer code in ao_sdl.c | |
292 static int write_waveOutBuffer(unsigned char* data,int len){ | |
293 WAVEHDR* current; | |
294 int len2=0; | |
295 int x; | |
296 while(len>0){ | |
297 current = &waveBlocks[buf_write]; | |
12093
f54d02f6ddbf
let uninit wait until sound is completely played, don't restore volume at exit, fixed ringbuffer bug, patch by Nehal <nehalmistry at gmx.net>\n
faust3
parents:
11511
diff
changeset
|
298 if(buffered_bytes==BUFFER_COUNT*BUFFER_SIZE) break; |
7913 | 299 //unprepare the header if it is prepared |
300 if(current->dwFlags & WHDR_PREPARED) | |
301 waveOutUnprepareHeader(hWaveOut, current, sizeof(WAVEHDR)); | |
302 x=BUFFER_SIZE-buf_write_pos; | |
303 if(x>len) x=len; | |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
20250
diff
changeset
|
304 fast_memcpy(current->lpData+buf_write_pos,data+len2,x); |
12151
75fdb659f5bf
round len to outburst and increment full_buffers at the correct time, patch by Nehal <nehalmistry at gmx.net>
faust3
parents:
12146
diff
changeset
|
305 if(buf_write_pos==0)full_buffers++; |
7913 | 306 len2+=x; len-=x; |
307 buffered_bytes+=x; buf_write_pos+=x; | |
308 //prepare header and write data to device | |
12093
f54d02f6ddbf
let uninit wait until sound is completely played, don't restore volume at exit, fixed ringbuffer bug, patch by Nehal <nehalmistry at gmx.net>\n
faust3
parents:
11511
diff
changeset
|
309 current->dwBufferLength = buf_write_pos; |
7913 | 310 waveOutPrepareHeader(hWaveOut, current, sizeof(WAVEHDR)); |
311 waveOutWrite(hWaveOut, current, sizeof(WAVEHDR)); | |
312 | |
313 if(buf_write_pos>=BUFFER_SIZE){ //buffer is full find next | |
314 // block is full, find next! | |
315 buf_write=(buf_write+1)%BUFFER_COUNT; | |
316 buf_write_pos=0; | |
317 } | |
318 } | |
319 return len2; | |
320 } | |
321 | |
322 // plays 'len' bytes of 'data' | |
323 // it should round it down to outburst*n | |
324 // return: number of bytes played | |
325 static int play(void* data,int len,int flags) | |
326 { | |
20250
7cfd3a04d537
Implement AOPLAY_FINAL_CHUNK support for dshow and win32 out.
reimar
parents:
19835
diff
changeset
|
327 if (!(flags & AOPLAY_FINAL_CHUNK)) |
12151
75fdb659f5bf
round len to outburst and increment full_buffers at the correct time, patch by Nehal <nehalmistry at gmx.net>
faust3
parents:
12146
diff
changeset
|
328 len = (len/ao_data.outburst)*ao_data.outburst; |
7913 | 329 return write_waveOutBuffer(data,len); |
330 } | |
10106 | 331 |
7913 | 332 // return: delay in seconds between first and last sample in buffer |
18915
99e20a22d5d0
modifies function declarations without parameters from ()
reynaldo
parents:
14529
diff
changeset
|
333 static float get_delay(void) |
7913 | 334 { |
335 return (float)(buffered_bytes + ao_data.buffersize)/(float)ao_data.bps; | |
336 } |