57 |
void sun_play(void); |
void sun_play(void); |
58 |
void sun_record(void); |
void sun_record(void); |
59 |
|
|
60 |
|
static int |
61 |
|
sun_pause(void) |
62 |
|
{ |
63 |
|
audio_info_t info; |
64 |
|
|
65 |
|
AUDIO_INITINFO(&info); |
66 |
|
|
67 |
|
info.record.pause = 1; |
68 |
|
|
69 |
|
if (ioctl(dsp_fd, AUDIO_SETINFO, &info) == -1) |
70 |
|
return -1; |
71 |
|
|
72 |
|
#if defined I_FLUSH && defined FLUSHR |
73 |
|
if (ioctl(dsp_fd, I_FLUSH, FLUSHR) == -1) |
74 |
|
return -1; |
75 |
|
#endif |
76 |
|
|
77 |
|
return 0; |
78 |
|
} |
79 |
|
|
80 |
|
static int |
81 |
|
sun_resume(void) |
82 |
|
{ |
83 |
|
audio_info_t info; |
84 |
|
|
85 |
|
AUDIO_INITINFO(&info); |
86 |
|
|
87 |
|
info.record.pause = 0; |
88 |
|
|
89 |
|
if (ioctl(dsp_fd, AUDIO_SETINFO, &info) == -1) |
90 |
|
return -1; |
91 |
|
|
92 |
|
return 0; |
93 |
|
} |
94 |
|
|
95 |
void |
void |
96 |
sun_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv) |
sun_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv) |
97 |
{ |
{ |
165 |
} |
} |
166 |
} |
} |
167 |
|
|
168 |
|
/* |
169 |
|
* Pause recording until we actually start using it. |
170 |
|
*/ |
171 |
|
if (dsp_mode != O_WRONLY) |
172 |
|
{ |
173 |
|
if (sun_pause() == -1) |
174 |
|
{ |
175 |
|
close(dsp_fd); |
176 |
|
dsp_fd = -1; |
177 |
|
return False; |
178 |
|
} |
179 |
|
} |
180 |
|
|
181 |
dsp_refs++; |
dsp_refs++; |
182 |
|
|
183 |
return True; |
return True; |
229 |
RD_BOOL |
RD_BOOL |
230 |
sun_open_in(void) |
sun_open_in(void) |
231 |
{ |
{ |
232 |
|
#if ! (defined I_FLUSH && defined FLUSHR) |
233 |
|
/* |
234 |
|
* It is not possible to reliably use the recording without |
235 |
|
* flush operations. |
236 |
|
*/ |
237 |
|
return False; |
238 |
|
#endif |
239 |
|
|
240 |
if (!sun_open(O_RDONLY)) |
if (!sun_open(O_RDONLY)) |
241 |
return False; |
return False; |
242 |
|
|
243 |
|
/* |
244 |
|
* Unpause the stream now that we have someone using it. |
245 |
|
*/ |
246 |
|
if (sun_resume() == -1) |
247 |
|
{ |
248 |
|
sun_close(); |
249 |
|
return False; |
250 |
|
} |
251 |
|
|
252 |
dsp_in = True; |
dsp_in = True; |
253 |
|
|
254 |
return True; |
return True; |
257 |
void |
void |
258 |
sun_close_in(void) |
sun_close_in(void) |
259 |
{ |
{ |
260 |
|
/* |
261 |
|
* Repause the stream when the user goes away. |
262 |
|
*/ |
263 |
|
sun_pause(); |
264 |
|
|
265 |
sun_close(); |
sun_close(); |
266 |
|
|
267 |
dsp_in = False; |
dsp_in = False; |
304 |
return True; |
return True; |
305 |
} |
} |
306 |
|
|
307 |
|
sun_pause(); |
308 |
|
|
309 |
if (pwfx->wBitsPerSample == 8) |
if (pwfx->wBitsPerSample == 8) |
310 |
{ |
{ |
311 |
info.play.encoding = AUDIO_ENCODING_LINEAR8; |
info.play.encoding = AUDIO_ENCODING_LINEAR8; |
351 |
|
|
352 |
dsp_configured = True; |
dsp_configured = True; |
353 |
|
|
354 |
|
if (dsp_in) |
355 |
|
sun_resume(); |
356 |
|
|
357 |
return True; |
return True; |
358 |
} |
} |
359 |
|
|