/[rdesktop]/sourceforge.net/trunk/rdesktop/rdpsnd_sun.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/rdpsnd_sun.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1428 by ossman_, Tue Jan 22 10:42:55 2008 UTC revision 1432 by ossman_, Fri Feb 8 10:36:28 2008 UTC
# Line 57  static uint_t written_samples; Line 57  static uint_t written_samples;
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  {  {
# Line 130  sun_open(int mode) Line 165  sun_open(int mode)
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;
# Line 181  sun_close_out(void) Line 229  sun_close_out(void)
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;
# Line 192  sun_open_in(void) Line 257  sun_open_in(void)
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;
# Line 234  sun_set_format(RD_WAVEFORMATEX * pwfx) Line 304  sun_set_format(RD_WAVEFORMATEX * pwfx)
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;
# Line 279  sun_set_format(RD_WAVEFORMATEX * pwfx) Line 351  sun_set_format(RD_WAVEFORMATEX * pwfx)
351    
352          dsp_configured = True;          dsp_configured = True;
353    
354            if (dsp_in)
355                    sun_resume();
356    
357          return True;          return True;
358  }  }
359    

Legend:
Removed from v.1428  
changed lines
  Added in v.1432

  ViewVC Help
Powered by ViewVC 1.1.26