/[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 491 by stargo, Mon Oct 13 16:09:45 2003 UTC revision 499 by astrand, Wed Oct 15 14:01:32 2003 UTC
# Line 31  Line 31 
31  int g_dsp_fd;  int g_dsp_fd;
32  BOOL g_dsp_busy;  BOOL g_dsp_busy;
33    
34  static struct audio_packet {  static struct audio_packet
35    {
36          struct stream s;          struct stream s;
37          uint16 tick;          uint16 tick;
38          uint8 index;          uint8 index;
# Line 43  wave_out_open(void) Line 44  wave_out_open(void)
44  {  {
45          char *dsp_dev = "/dev/dsp";          char *dsp_dev = "/dev/dsp";
46    
47          if ((g_dsp_fd = open(dsp_dev, O_WRONLY|O_NONBLOCK)) == -1)          if ((g_dsp_fd = open(dsp_dev, O_WRONLY | O_NONBLOCK)) == -1)
48          {          {
49                  perror(dsp_dev);                  perror(dsp_dev);
50                  return False;                  return False;
51          }          }
52    
53          /* Non-blocking so that user interface is responsive */          /* Non-blocking so that user interface is responsive */
54          fcntl(g_dsp_fd, F_SETFL, fcntl(g_dsp_fd, F_GETFL)|O_NONBLOCK);          fcntl(g_dsp_fd, F_SETFL, fcntl(g_dsp_fd, F_GETFL) | O_NONBLOCK);
55          return True;          return True;
56  }  }
57    
# Line 61  wave_out_close(void) Line 62  wave_out_close(void)
62  }  }
63    
64  BOOL  BOOL
65  wave_out_format_supported(WAVEFORMATEX *pwfx)  wave_out_format_supported(WAVEFORMATEX * pwfx)
66  {  {
67          if (pwfx->wFormatTag != WAVE_FORMAT_PCM)          if (pwfx->wFormatTag != WAVE_FORMAT_PCM)
68                  return False;                  return False;
# Line 74  wave_out_format_supported(WAVEFORMATEX * Line 75  wave_out_format_supported(WAVEFORMATEX *
75  }  }
76    
77  BOOL  BOOL
78  wave_out_set_format(WAVEFORMATEX *pwfx)  wave_out_set_format(WAVEFORMATEX * pwfx)
79  {  {
80          int speed, channels, format;          int speed, channels, format;
81    
# Line 117  wave_out_volume(uint16 left, uint16 righ Line 118  wave_out_volume(uint16 left, uint16 righ
118  {  {
119          uint32 volume;          uint32 volume;
120    
121          volume = left/(65536/100);          volume = left / (65536 / 100);
122          volume |= right/(65536/100) << 8;          volume |= right / (65536 / 100) << 8;
123          if (ioctl(g_dsp_fd, MIXER_WRITE(SOUND_MIXER_PCM), &volume) == -1)          if (ioctl(g_dsp_fd, MIXER_WRITE(SOUND_MIXER_PCM), &volume) == -1)
124          {          {
125                  perror("MIXER_WRITE(SOUND_MIXER_PCM)");                  perror("MIXER_WRITE(SOUND_MIXER_PCM)");
# Line 170  wave_out_play(void) Line 171  wave_out_play(void)
171                  packet = &packet_queue[queue_lo];                  packet = &packet_queue[queue_lo];
172                  out = &packet->s;                  out = &packet->s;
173    
174                  len = write(g_dsp_fd, out->p, out->end-out->p);                  len = write(g_dsp_fd, out->p, out->end - out->p);
175                  if (len == -1)                  if (len == -1)
176                  {                  {
177                          if (errno != EWOULDBLOCK)                          if (errno != EWOULDBLOCK)

Legend:
Removed from v.491  
changed lines
  Added in v.499

  ViewVC Help
Powered by ViewVC 1.1.26