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

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

revision 559 by stargo, Thu Dec 11 12:25:38 2003 UTC revision 963 by astrand, Wed Aug 3 10:56:16 2005 UTC
# Line 1  Line 1 
1  /*  /* -*- c-basic-offset: 8 -*-
2     rdesktop: A Remote Desktop Protocol client.     rdesktop: A Remote Desktop Protocol client.
3     Sound Channel Process Functions - Sun     Sound Channel Process Functions - Sun
4     Copyright (C) Matthew Chapman 2003     Copyright (C) Matthew Chapman 2003
# Line 27  Line 27 
27  #include <sys/ioctl.h>  #include <sys/ioctl.h>
28  #include <sys/audioio.h>  #include <sys/audioio.h>
29    
30    #if (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
31    #include <stropts.h>
32    #endif
33    
34  #define MAX_QUEUE       10  #define MAX_QUEUE       10
35    
36  int g_dsp_fd;  int g_dsp_fd;
# Line 50  wave_out_open(void) Line 54  wave_out_open(void)
54    
55          if (dsp_dev == NULL)          if (dsp_dev == NULL)
56          {          {
57                  dsp_dev = "/dev/audio";                  dsp_dev = strdup("/dev/audio");
58          }          }
59    
60          if ((g_dsp_fd = open(dsp_dev, O_WRONLY | O_NONBLOCK)) == -1)          if ((g_dsp_fd = open(dsp_dev, O_WRONLY | O_NONBLOCK)) == -1)
# Line 83  wave_out_close(void) Line 87  wave_out_close(void)
87          /* Flush the audiobuffer */          /* Flush the audiobuffer */
88          ioctl(g_dsp_fd, I_FLUSH, FLUSHW);          ioctl(g_dsp_fd, I_FLUSH, FLUSHW);
89  #endif  #endif
90    #if defined AUDIO_FLUSH
91            ioctl(g_dsp_fd, AUDIO_FLUSH, NULL);
92    #endif
93          close(g_dsp_fd);          close(g_dsp_fd);
94  }  }
95    
# Line 103  BOOL Line 110  BOOL
110  wave_out_set_format(WAVEFORMATEX * pwfx)  wave_out_set_format(WAVEFORMATEX * pwfx)
111  {  {
112          audio_info_t info;          audio_info_t info;
         int test = 1;  
113    
114          ioctl(g_dsp_fd, AUDIO_DRAIN, 0);          ioctl(g_dsp_fd, AUDIO_DRAIN, 0);
115          g_swapaudio = False;          g_swapaudio = False;
# Line 118  wave_out_set_format(WAVEFORMATEX * pwfx) Line 124  wave_out_set_format(WAVEFORMATEX * pwfx)
124          {          {
125                  info.play.encoding = AUDIO_ENCODING_LINEAR;                  info.play.encoding = AUDIO_ENCODING_LINEAR;
126                  /* Do we need to swap the 16bit values? (Are we BigEndian) */                  /* Do we need to swap the 16bit values? (Are we BigEndian) */
127                  g_swapaudio = !(*(uint8 *) (&test));  #ifdef B_ENDIAN
128                    g_swapaudio = 1;
129    #else
130                    g_swapaudio = 0;
131    #endif
132          }          }
133    
134          g_samplewidth = pwfx->wBitsPerSample / 8;          g_samplewidth = pwfx->wBitsPerSample / 8;
# Line 157  wave_out_volume(uint16 left, uint16 righ Line 167  wave_out_volume(uint16 left, uint16 righ
167          uint balance;          uint balance;
168          uint volume;          uint volume;
169    
170          if (ioctl(g_dsp_fd, AUDIO_GETINFO, &info) == -1)          AUDIO_INITINFO(&info);
         {  
                 perror("AUDIO_GETINFO");  
                 return;  
         }  
171    
172          volume = (left > right) ? left : right;          volume = (left > right) ? left : right;
173    

Legend:
Removed from v.559  
changed lines
  Added in v.963

  ViewVC Help
Powered by ViewVC 1.1.26