/[rdesktop]/sourceforge.net/trunk/rdesktop/rdpsnd_oss.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_oss.c

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

revision 510 by stargo, Thu Oct 23 11:11:31 2003 UTC revision 760 by stargo, Fri Sep 3 18:04:48 2004 UTC
# Line 45  static unsigned int queue_hi, queue_lo; Line 45  static unsigned int queue_hi, queue_lo;
45  BOOL  BOOL
46  wave_out_open(void)  wave_out_open(void)
47  {  {
48          char *dsp_dev = "/dev/dsp";          char *dsp_dev = getenv("AUDIODEV");
49    
50            if (dsp_dev == NULL)
51            {
52                    dsp_dev = "/dev/dsp";
53            }
54    
55          if ((g_dsp_fd = open(dsp_dev, O_WRONLY | O_NONBLOCK)) == -1)          if ((g_dsp_fd = open(dsp_dev, O_WRONLY | O_NONBLOCK)) == -1)
56          {          {
# Line 80  wave_out_format_supported(WAVEFORMATEX * Line 85  wave_out_format_supported(WAVEFORMATEX *
85  BOOL  BOOL
86  wave_out_set_format(WAVEFORMATEX * pwfx)  wave_out_set_format(WAVEFORMATEX * pwfx)
87  {  {
88          int channels, format;          int stereo, format;
89    
90          ioctl(g_dsp_fd, SNDCTL_DSP_RESET, NULL);          ioctl(g_dsp_fd, SNDCTL_DSP_RESET, NULL);
91          ioctl(g_dsp_fd, SNDCTL_DSP_SYNC, NULL);          ioctl(g_dsp_fd, SNDCTL_DSP_SYNC, NULL);
# Line 99  wave_out_set_format(WAVEFORMATEX * pwfx) Line 104  wave_out_set_format(WAVEFORMATEX * pwfx)
104                  return False;                  return False;
105          }          }
106    
107          channels = pwfx->nChannels;          if (pwfx->nChannels == 2)
         if (ioctl(g_dsp_fd, SNDCTL_DSP_CHANNELS, &channels) == -1)  
108          {          {
109                  perror("SNDCTL_DSP_CHANNELS");                  stereo = 1;
110                  close(g_dsp_fd);                  g_samplewidth *= 2;
111                  return False;          }
112            else
113            {
114                    stereo = 0;
115          }          }
116    
117          if (channels == 2)          if (ioctl(g_dsp_fd, SNDCTL_DSP_STEREO, &stereo) == -1)
118          {          {
119                  g_samplewidth *= 2;                  perror("SNDCTL_DSP_CHANNELS");
120                    close(g_dsp_fd);
121                    return False;
122          }          }
123    
124          g_snd_rate = pwfx->nSamplesPerSec;          g_snd_rate = pwfx->nSamplesPerSec;
# Line 135  wave_out_volume(uint16 left, uint16 righ Line 144  wave_out_volume(uint16 left, uint16 righ
144    
145          if (use_dev_mixer)          if (use_dev_mixer)
146          {          {
147                  if ((fd_mix = open( "/dev/mixer", O_RDWR|O_NONBLOCK )) == -1 )                  if ((fd_mix = open("/dev/mixer", O_RDWR | O_NONBLOCK)) == -1)
148                  {                  {
149                          perror("open /dev/mixer");                          perror("open /dev/mixer");
150                          return;                          return;
# Line 228  wave_out_play(void) Line 237  wave_out_play(void)
237                  {                  {
238                          long long duration;                          long long duration;
239                          long elapsed;                          long elapsed;
240                            
241                          gettimeofday(&tv, NULL);                          gettimeofday(&tv, NULL);
242                          duration =                          duration = (out->size * (1000000 / (g_samplewidth * g_snd_rate)));
243                                  (out->size * (1000000 /                          elapsed = (tv.tv_sec - startedat_s) * 1000000 + (tv.tv_usec - startedat_us);
                                 (g_samplewidth * g_snd_rate)));  
                         elapsed =  
                                 (tv.tv_sec - startedat_s) * 1000000 +  
                                 (tv.tv_usec - startedat_us);  
244    
245                          if ( elapsed >= (duration * 7) / 10 )                          if (elapsed >= (duration * 85) / 100)
246                          {                          {
247                                  rdpsnd_send_completion(packet->tick, packet->index);                                  rdpsnd_send_completion(packet->tick, packet->index);
248                                  free(out->data);                                  free(out->data);

Legend:
Removed from v.510  
changed lines
  Added in v.760

  ViewVC Help
Powered by ViewVC 1.1.26