/[rdesktop]/jpeg/rdesktop/trunk/rdpsnd_alsa.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_alsa.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 1255 by stargo, Sun Sep 17 11:04:50 2006 UTC
# Line 36  static snd_pcm_stream_t stream = SND_PCM Line 36  static snd_pcm_stream_t stream = SND_PCM
36  static BOOL reopened;  static BOOL reopened;
37  static short samplewidth;  static short samplewidth;
38  static int audiochannels;  static int audiochannels;
39    static char *pcm_name;
40    
41  BOOL  BOOL
42  wave_out_open(void)  alsa_open(void)
43  {  {
         char *pcm_name;  
44          int err;          int err;
45    
         pcm_name = xstrdup(DEFAULTDEVICE);  
   
46          if ((err = snd_pcm_open(&pcm_handle, pcm_name, stream, 0)) < 0)          if ((err = snd_pcm_open(&pcm_handle, pcm_name, stream, 0)) < 0)
47          {          {
48                  error("snd_pcm_open: %s\n", snd_strerror(err));                  error("snd_pcm_open: %s\n", snd_strerror(err));
# Line 60  wave_out_open(void) Line 58  wave_out_open(void)
58  }  }
59    
60  void  void
61  wave_out_close(void)  alsa_close(void)
62  {  {
63          /* Ack all remaining packets */          /* Ack all remaining packets */
64          while (!rdpsnd_queue_empty())          while (!rdpsnd_queue_empty())
# Line 70  wave_out_close(void) Line 68  wave_out_close(void)
68                  rdpsnd_queue_next();                  rdpsnd_queue_next();
69          }          }
70    
   
71          if (pcm_handle)          if (pcm_handle)
72          {          {
73                  snd_pcm_drop(pcm_handle);                  snd_pcm_drop(pcm_handle);
# Line 79  wave_out_close(void) Line 76  wave_out_close(void)
76  }  }
77    
78  BOOL  BOOL
79  wave_out_format_supported(WAVEFORMATEX * pwfx)  alsa_format_supported(WAVEFORMATEX * pwfx)
80  {  {
81  #if 0  #if 0
82          int err;          int err;
# Line 112  wave_out_format_supported(WAVEFORMATEX * Line 109  wave_out_format_supported(WAVEFORMATEX *
109  }  }
110    
111  BOOL  BOOL
112  wave_out_set_format(WAVEFORMATEX * pwfx)  alsa_set_format(WAVEFORMATEX * pwfx)
113  {  {
114          snd_pcm_hw_params_t *hwparams = NULL;          snd_pcm_hw_params_t *hwparams = NULL;
115          unsigned int rate, exact_rate;          unsigned int rate, exact_rate;
# Line 210  wave_out_set_format(WAVEFORMATEX * pwfx) Line 207  wave_out_set_format(WAVEFORMATEX * pwfx)
207  }  }
208    
209  void  void
210  wave_out_volume(uint16 left, uint16 right)  alsa_volume(uint16 left, uint16 right)
211  {  {
212          static int warned = 0;          static int warned = 0;
213    
214          if (!warned)          if (!warned)
215          {          {
216                  warning("volume changes currently not supported with experimental alsa-output\n");                  warning("volume changes currently not supported with alsa-output\n");
217                  warned = 1;                  warned = 1;
218          }          }
219  }  }
220    
221  void  void
222  wave_out_play(void)  alsa_play(void)
223  {  {
224          struct audio_packet *packet;          struct audio_packet *packet;
225          STREAM out;          STREAM out;
# Line 285  wave_out_play(void) Line 282  wave_out_play(void)
282          g_dsp_busy = 1;          g_dsp_busy = 1;
283          return;          return;
284  }  }
285    
286    static struct audio_driver alsa_driver = {
287          wave_out_write:rdpsnd_queue_write,
288          wave_out_open:alsa_open,
289          wave_out_close:alsa_close,
290          wave_out_format_supported:alsa_format_supported,
291          wave_out_set_format:alsa_set_format,
292          wave_out_volume:alsa_volume,
293          wave_out_play:alsa_play,
294          name:"alsa",
295          description:"ALSA output driver, default device: " DEFAULTDEVICE,
296          next:NULL,
297    };
298    
299    struct audio_driver *
300    alsa_register(char *options)
301    {
302            if (options)
303            {
304                    pcm_name = xstrdup(options);
305            }
306            else
307            {
308                    pcm_name = xstrdup(DEFAULTDEVICE);
309            }
310    
311            return &alsa_driver;
312    }

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

  ViewVC Help
Powered by ViewVC 1.1.26