/[rdesktop]/jpeg/rdesktop/trunk/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 /jpeg/rdesktop/trunk/rdpsnd_sun.c

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

revision 1254 by stargo, Sun Sep 17 10:32:18 2006 UTC revision 1256 by stargo, Sun Sep 17 11:42:22 2006 UTC
# Line 37  Line 37 
37  static BOOL g_reopened;  static BOOL g_reopened;
38  static BOOL g_swapaudio;  static BOOL g_swapaudio;
39  static short g_samplewidth;  static short g_samplewidth;
40    static char *dsp_dev;
41    
42  BOOL  BOOL
43  wave_out_open(void)  sun_open(void)
44  {  {
         char *dsp_dev = getenv("AUDIODEV");  
   
         if (dsp_dev == NULL)  
         {  
                 dsp_dev = xstrdup(DEFAULTDEVICE);  
         }  
   
45          if ((g_dsp_fd = open(dsp_dev, O_WRONLY | O_NONBLOCK)) == -1)          if ((g_dsp_fd = open(dsp_dev, O_WRONLY | O_NONBLOCK)) == -1)
46          {          {
47                  perror(dsp_dev);                  perror(dsp_dev);
# Line 64  wave_out_open(void) Line 58  wave_out_open(void)
58  }  }
59    
60  void  void
61  wave_out_close(void)  sun_close(void)
62  {  {
63          /* Ack all remaining packets */          /* Ack all remaining packets */
64          while (!rdpsnd_queue_empty())          while (!rdpsnd_queue_empty())
# Line 85  wave_out_close(void) Line 79  wave_out_close(void)
79  }  }
80    
81  BOOL  BOOL
82  wave_out_format_supported(WAVEFORMATEX * pwfx)  sun_format_supported(WAVEFORMATEX * pwfx)
83  {  {
84          if (pwfx->wFormatTag != WAVE_FORMAT_PCM)          if (pwfx->wFormatTag != WAVE_FORMAT_PCM)
85                  return False;                  return False;
# Line 98  wave_out_format_supported(WAVEFORMATEX * Line 92  wave_out_format_supported(WAVEFORMATEX *
92  }  }
93    
94  BOOL  BOOL
95  wave_out_set_format(WAVEFORMATEX * pwfx)  sun_set_format(WAVEFORMATEX * pwfx)
96  {  {
97          audio_info_t info;          audio_info_t info;
98    
# Line 152  wave_out_set_format(WAVEFORMATEX * pwfx) Line 146  wave_out_set_format(WAVEFORMATEX * pwfx)
146  }  }
147    
148  void  void
149  wave_out_volume(uint16 left, uint16 right)  sun_volume(uint16 left, uint16 right)
150  {  {
151          audio_info_t info;          audio_info_t info;
152          uint balance;          uint balance;
# Line 184  wave_out_volume(uint16 left, uint16 righ Line 178  wave_out_volume(uint16 left, uint16 righ
178  }  }
179    
180  void  void
181  wave_out_play(void)  sun_play(void)
182  {  {
183          struct audio_packet *packet;          struct audio_packet *packet;
184          audio_info_t info;          audio_info_t info;
# Line 277  wave_out_play(void) Line 271  wave_out_play(void)
271                  }                  }
272          }          }
273  }  }
274    
275    struct audio_driver *
276    sun_register(char *options)
277    {
278            static struct audio_driver sun_driver;
279    
280            sun_driver.wave_out_write = rdpsnd_queue_write;
281            sun_driver.wave_out_open = sun_open;
282            sun_driver.wave_out_close = sun_close;
283            sun_driver.wave_out_format_supported = sun_format_supported;
284            sun_driver.wave_out_set_format = sun_set_format;
285            sun_driver.wave_out_volume = sun_volume;
286            sun_driver.wave_out_play = sun_play;
287            sun_driver.name = xstrdup("sun");
288            sun_driver.description =
289                    xstrdup("SUN/BSD output driver, default device: " DEFAULTDEVICE " or $AUDIODEV");
290            sun_driver.next = NULL;
291    
292            if (options)
293            {
294                    dsp_dev = xstrdup(options);
295            }
296            else
297            {
298                    dsp_dev = getenv("AUDIODEV");
299    
300                    if (dsp_dev == NULL)
301                    {
302                            dsp_dev = xstrdup(DEFAULTDEVICE);
303                    }
304            }
305    
306            return &sun_driver;
307    }

Legend:
Removed from v.1254  
changed lines
  Added in v.1256

  ViewVC Help
Powered by ViewVC 1.1.26