/[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 1268 by stargo, Sun Sep 17 15:25:10 2006 UTC revision 1269 by stargo, Mon Sep 18 10:17:24 2006 UTC
# Line 29  Line 29 
29    
30  #include "rdesktop.h"  #include "rdesktop.h"
31  #include "rdpsnd.h"  #include "rdpsnd.h"
32    #include "rdpsnd_dsp.h"
33  #include <unistd.h>  #include <unistd.h>
34  #include <fcntl.h>  #include <fcntl.h>
35  #include <errno.h>  #include <errno.h>
# Line 42  Line 43 
43  static int snd_rate;  static int snd_rate;
44  static short samplewidth;  static short samplewidth;
45  static char *dsp_dev;  static char *dsp_dev;
46    static struct audio_driver oss_driver;
47    
48  BOOL  BOOL
49  oss_open(void)  oss_open(void)
# Line 153  oss_set_format(WAVEFORMATEX * pwfx) Line 155  oss_set_format(WAVEFORMATEX * pwfx)
155  void  void
156  oss_volume(uint16 left, uint16 right)  oss_volume(uint16 left, uint16 right)
157  {  {
         static BOOL use_dev_mixer = False;  
158          uint32 volume;          uint32 volume;
         int fd_mix = -1;  
159    
160          volume = left / (65536 / 100);          volume = left / (65536 / 100);
161          volume |= right / (65536 / 100) << 8;          volume |= right / (65536 / 100) << 8;
162    
         if (use_dev_mixer)  
         {  
                 if ((fd_mix = open("/dev/mixer", O_RDWR | O_NONBLOCK)) == -1)  
                 {  
                         perror("open /dev/mixer");  
                         return;  
                 }  
   
                 if (ioctl(fd_mix, MIXER_WRITE(SOUND_MIXER_PCM), &volume) == -1)  
                 {  
                         perror("MIXER_WRITE(SOUND_MIXER_PCM)");  
                         return;  
                 }  
   
                 close(fd_mix);  
         }  
   
163          if (ioctl(g_dsp_fd, MIXER_WRITE(SOUND_MIXER_PCM), &volume) == -1)          if (ioctl(g_dsp_fd, MIXER_WRITE(SOUND_MIXER_PCM), &volume) == -1)
164          {          {
165                  perror("MIXER_WRITE(SOUND_MIXER_PCM)");                  perror("MIXER_WRITE(SOUND_MIXER_PCM)");
166                  use_dev_mixer = True;                  oss_driver.wave_out_volume = rdpsnd_dsp_softvol_set;
167                  return;                  return;
168          }          }
169  }  }
# Line 255  oss_play(void) Line 238  oss_play(void)
238  struct audio_driver *  struct audio_driver *
239  oss_register(char *options)  oss_register(char *options)
240  {  {
         static struct audio_driver oss_driver;  
   
241          oss_driver.wave_out_write = rdpsnd_queue_write;          oss_driver.wave_out_write = rdpsnd_queue_write;
242          oss_driver.wave_out_open = oss_open;          oss_driver.wave_out_open = oss_open;
243          oss_driver.wave_out_close = oss_close;          oss_driver.wave_out_close = oss_close;

Legend:
Removed from v.1268  
changed lines
  Added in v.1269

  ViewVC Help
Powered by ViewVC 1.1.26