Mercurial > mplayer.hg
annotate libao2/ao_dxr3.c @ 3289:6582188b79d8
-cache added as default (8192)
author | gabucino |
---|---|
date | Mon, 03 Dec 2001 17:10:02 +0000 |
parents | 4bc4354ec88e |
children | 67bcfb9749df |
rev | line source |
---|---|
2645 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
2770 | 3 |
2921 | 4 #include <linux/em8300.h> |
2770 | 5 #include <sys/ioctl.h> |
2645 | 6 #include <unistd.h> |
2770 | 7 #include <sys/time.h> |
2645 | 8 #include <sys/types.h> |
2770 | 9 #include <sys/stat.h> |
10 #include <fcntl.h> | |
2645 | 11 |
12 #include "../config.h" | |
13 | |
14 #include "afmt.h" | |
15 | |
16 #include "audio_out.h" | |
17 #include "audio_out_internal.h" | |
18 | |
3186 | 19 void perror( const char *s ); |
20 #include <errno.h> | |
21 int sys_nerr; | |
2770 | 22 extern int verbose; |
2645 | 23 |
24 static ao_info_t info = | |
25 { | |
26 "DXR3/H+ audio out", | |
27 "dxr3", | |
28 "David Holm <dholm@iname.com>", | |
29 "" | |
30 }; | |
31 | |
32 LIBAO_EXTERN(dxr3) | |
33 | |
2770 | 34 static audio_buf_info dxr3_buf_info; |
2921 | 35 static int fd_control = 0, fd_audio = 0; |
2770 | 36 |
2645 | 37 // to set/get/query special features/parameters |
38 static int control(int cmd,int arg) | |
39 { | |
40 switch(cmd) | |
41 { | |
42 case AOCONTROL_QUERY_FORMAT: | |
43 return CONTROL_TRUE; | |
44 case AOCONTROL_GET_VOLUME: | |
45 case AOCONTROL_SET_VOLUME: | |
2770 | 46 return CONTROL_OK; |
47 return CONTROL_ERROR; | |
2645 | 48 } |
2770 | 49 return CONTROL_UNKNOWN; |
2645 | 50 } |
51 | |
52 // open & setup audio device | |
53 // return: 1=success 0=fail | |
54 static int init(int rate,int channels,int format,int flags) | |
55 { | |
2921 | 56 int ioval; |
57 fd_audio = open( "/dev/em8300_ma", O_WRONLY ); | |
58 if( fd_audio < 0 ) | |
59 { | |
2968 | 60 printf("AO: [dxr3] Can't open audio device /dev/em8300_ma -> nosound\n"); |
2921 | 61 return 0; |
62 } | |
2770 | 63 |
2921 | 64 fd_control = open( "/dev/em8300", O_WRONLY ); |
65 if( fd_control < 0 ) | |
2770 | 66 { |
2968 | 67 printf("AO: [dxr3] Can't open em8300 control /dev/em8300\n"); |
2770 | 68 return 0; |
69 } | |
3186 | 70 |
71 ioctl(fd_audio, SNDCTL_DSP_RESET, NULL); | |
72 ao_data.format = format; | |
73 if( ioctl (fd_audio, SNDCTL_DSP_SETFMT, &ao_data.format) < 0 ) | |
2968 | 74 printf( "AO: [dxr3] Unable to set audio format\n" ); |
3186 | 75 if(format == AFMT_AC3 && ao_data.format != AFMT_AC3) |
2770 | 76 { |
2968 | 77 printf("AO: [dxr3] Can't set audio device /dev/em8300_ma to AC3 output\n"); |
2770 | 78 return 0; |
79 } | |
2968 | 80 printf("AO: [dxr3] Sample format: %s (requested: %s)\n", |
3186 | 81 audio_out_format_name(ao_data.format), audio_out_format_name(format)); |
2770 | 82 |
83 if(format != AFMT_AC3) | |
84 { | |
3186 | 85 ao_data.channels=channels-1; |
86 if( ioctl (fd_audio, SNDCTL_DSP_STEREO, &ao_data.channels) < 0 ) | |
2968 | 87 printf( "AO: [dxr3] Unable to set number of channels\n" ); |
2770 | 88 |
3186 | 89 ao_data.bps = (channels+1)*rate; |
90 ao_data.samplerate=rate; | |
91 if( ioctl (fd_audio, SNDCTL_DSP_SPEED, &ao_data.samplerate) < 0 ) | |
3231
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
92 { |
2968 | 93 printf( "AO: [dxr3] Unable to set samplerate\n" ); |
3231
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
94 return 0; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
95 } |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
96 if( rate < ao_data.samplerate ) |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
97 { |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
98 ao_data.samplerate = 44100; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
99 ioctl(fd_audio, SNDCTL_DSP_SPEED, &ao_data.samplerate); |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
100 if( ao_data.samplerate != 44100 ) |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
101 { |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
102 printf( "AO: [dxr3] Unable to set samplerate\n" ); |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
103 return 0; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
104 } |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
105 printf("AO: [dxr3] Using %d Hz samplerate (requested: %d) (Upsampling)\n",ao_data.samplerate,rate); |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
106 ao_data.samplerate = rate; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
107 } |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
108 else printf("AO: [dxr3] Using %d Hz samplerate (requested: %d)\n",ao_data.samplerate,rate); |
2770 | 109 } |
3186 | 110 else ao_data.bps *= 2; |
2770 | 111 |
2968 | 112 if( ioctl(fd_audio, SNDCTL_DSP_GETOSPACE, &dxr3_buf_info)==-1 ) |
113 { | |
2770 | 114 int r=0; |
2968 | 115 printf("AO: [dxr3] Driver doesn't support SNDCTL_DSP_GETOSPACE :-(\n"); |
116 if( ioctl( fd_audio, SNDCTL_DSP_GETBLKSIZE, &r) ==-1 ) | |
117 { | |
3186 | 118 printf( "AO: [dxr3] %d bytes/frag (config.h)\n", ao_data.outburst ); |
2968 | 119 } |
120 else | |
121 { | |
3186 | 122 ao_data.outburst=r; |
123 printf( "AO: [dxr3] %d bytes/frag (GETBLKSIZE)\n",ao_data.outburst); | |
2770 | 124 } |
2968 | 125 } |
126 else | |
127 { | |
128 printf("AO: [dxr3] frags: %3d/%d (%d bytes/frag) free: %6d\n", | |
129 dxr3_buf_info.fragments+1, dxr3_buf_info.fragstotal, dxr3_buf_info.fragsize, dxr3_buf_info.bytes); | |
3218
8ba06b63f873
Fix green borders -> black borders, patch from D. Holm, also small fix to dxr3 ao.
atmos4
parents:
3201
diff
changeset
|
130 ao_data.buffersize=(dxr3_buf_info.bytes/2); |
3186 | 131 ao_data.outburst=dxr3_buf_info.fragsize; |
2770 | 132 } |
2645 | 133 |
2921 | 134 ioval = EM8300_PLAYMODE_PLAY; |
2968 | 135 if( ioctl( fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval ) < 0 ) |
136 printf( "AO: [dxr3] Unable to set playmode\n" ); | |
2921 | 137 close( fd_control ); |
2770 | 138 |
139 return 1; | |
2645 | 140 } |
141 | |
142 // close audio device | |
143 static void uninit() | |
144 { | |
2968 | 145 printf( "AO: [dxr3] Uninitializing\n" ); |
146 if( ioctl(fd_audio, SNDCTL_DSP_RESET, NULL) < 0 ) | |
147 printf( "AO: [dxr3] Unable to reset device\n" ); | |
2921 | 148 close( fd_audio ); |
3186 | 149 close( fd_control ); /* Just in case */ |
2645 | 150 } |
151 | |
152 // stop playing and empty buffers (for seeking/pause) | |
153 static void reset() | |
154 { | |
2968 | 155 if( ioctl(fd_audio, SNDCTL_DSP_RESET, NULL) < 0 ) |
156 printf( "AO: [dxr3] Unable to reset device\n" ); | |
2645 | 157 } |
158 | |
159 // stop playing, keep buffers (for pause) | |
160 static void audio_pause() | |
161 { | |
2968 | 162 int ioval; |
3201 | 163 reset(); |
2968 | 164 fd_control = open( "/dev/em8300", O_WRONLY ); |
165 if( fd_control < 0 ) | |
166 printf( "AO: [dxr3] Oops, unable to pause playback\n" ); | |
167 else | |
168 { | |
169 ioval = EM8300_PLAYMODE_PAUSED; | |
170 if( ioctl( fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval ) < 0 ) | |
171 printf( "AO: [dxr3] Unable to pause playback\n" ); | |
172 close( fd_control ); | |
173 } | |
2645 | 174 } |
175 | |
176 // resume playing, after audio_pause() | |
177 static void audio_resume() | |
178 { | |
2968 | 179 int ioval; |
180 fd_control = open( "/dev/em8300", O_WRONLY ); | |
181 if( fd_control < 0 ) | |
182 printf( "AO: [dxr3] Oops, unable to resume playback\n" ); | |
183 else | |
184 { | |
185 ioval = EM8300_PLAYMODE_PLAY; | |
186 if( ioctl( fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval ) < 0 ) | |
187 printf( "AO: [dxr3] Unable to resume playback\n" ); | |
188 close( fd_control ); | |
189 } | |
2645 | 190 } |
191 | |
192 // return: how many bytes can be played without blocking | |
193 static int get_space() | |
194 { | |
2968 | 195 int space = 0; |
3186 | 196 if( ioctl(fd_audio, SNDCTL_DSP_GETODELAY, &space) < 0 ) |
2968 | 197 { |
3186 | 198 printf( "AO: [dxr3] Unable to get unplayed bytes in buffer\n" ); |
199 return ao_data.outburst; | |
2968 | 200 } |
3186 | 201 space = ao_data.buffersize - space; |
3201 | 202 space /= ao_data.outburst; /* This is a smart way of doing a fast modulo reduction */ |
203 space *= ao_data.outburst; /* fetched from ao_mpegpes.c */ | |
2968 | 204 return space; |
2645 | 205 } |
206 | |
3231
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
207 // playes 'len' bytes of 'data' |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
208 // upsamples if samplerate < 44100 |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
209 // return: number of bytes played |
2645 | 210 static int play(void* data,int len,int flags) |
211 { | |
3186 | 212 if( ioctl( fd_audio, EM8300_IOCTL_AUDIO_SETPTS, &ao_data.pts ) < 0 ) |
3201 | 213 printf( "AO: [dxr3] Unable to set PTS\n" ); |
3231
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
214 if( ao_data.samplerate < 44100 ) |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
215 { |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
216 int i,j,ratio,len2; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
217 unsigned char *data2,*s,*d; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
218 |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
219 ratio = 44100/ao_data.samplerate;ratio/=2;ratio*=2; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
220 len2 = len * ratio; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
221 data2 = malloc(len2); |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
222 |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
223 s = data; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
224 d = data2; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
225 |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
226 //Upsampler |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
227 if( ao_data.format == AFMT_U8 ) |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
228 { |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
229 for(i=0;i<ratio/2;i++) |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
230 for(j=0;j<len;j++) |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
231 { |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
232 *d = *s; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
233 d++; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
234 *d = *s; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
235 d++;s++; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
236 } |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
237 } |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
238 else |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
239 { |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
240 for(i=0;i<ratio/2;i++) |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
241 for(j=0;j<len/2;j++) |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
242 { |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
243 *d = *s; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
244 d++;s++; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
245 *d = *s; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
246 d++;s--; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
247 *d = *s; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
248 d++;s++; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
249 *d = *s; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
250 d++;s++; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
251 } |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
252 } |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
253 if( len2 < 0 ) return 0; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
254 write(fd_audio,data2,len2); |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
255 return len; |
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
256 } |
2921 | 257 return write(fd_audio,data,len); |
2645 | 258 } |
259 | |
3231
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
260 // return: delay in seconds between first and last sample in buffer |
3186 | 261 static float get_delay() |
2645 | 262 { |
3231
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
263 int r=0; |
3186 | 264 if( ioctl(fd_audio, SNDCTL_DSP_GETODELAY, &r) < 0 ) |
265 { | |
2968 | 266 printf( "AO: [dxr3] Unable to get unplayed bytes in buffer\n" ); |
3186 | 267 return ((float)ao_data.buffersize)/(float)ao_data.bps; |
268 } | |
3231
4bc4354ec88e
Added support for upsampling since dxr3/h+ only supports 44100Hz and 48000Hz, currently it only works on 44100/(2*ratio)
mswitch
parents:
3218
diff
changeset
|
269 return (((float)r)/(float)ao_data.bps); |
2645 | 270 } |
271 |