/[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 509 by stargo, Sun Oct 19 11:59:41 2003 UTC revision 510 by stargo, Thu Oct 23 11:11:31 2003 UTC
# Line 32  Line 32 
32    
33  int g_dsp_fd;  int g_dsp_fd;
34  BOOL g_dsp_busy = False;  BOOL g_dsp_busy = False;
35  static BOOL reopened;  static BOOL g_reopened;
36  static BOOL swapaudio;  static BOOL g_swapaudio;
37  static short samplewidth;  static short g_samplewidth;
38    
39  static struct audio_packet  static struct audio_packet
40  {  {
# Line 64  wave_out_open(void) Line 64  wave_out_open(void)
64          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);
65    
66          queue_lo = queue_hi = 0;          queue_lo = queue_hi = 0;
67          reopened = True;          g_reopened = True;
68    
69          return True;          return True;
70  }  }
# Line 105  wave_out_set_format(WAVEFORMATEX * pwfx) Line 105  wave_out_set_format(WAVEFORMATEX * pwfx)
105          int test = 1;          int test = 1;
106    
107          ioctl(g_dsp_fd, AUDIO_DRAIN, 0);          ioctl(g_dsp_fd, AUDIO_DRAIN, 0);
108          swapaudio = False;          g_swapaudio = False;
109          AUDIO_INITINFO(&info);          AUDIO_INITINFO(&info);
110    
111    
# Line 117  wave_out_set_format(WAVEFORMATEX * pwfx) Line 117  wave_out_set_format(WAVEFORMATEX * pwfx)
117          {          {
118                  info.play.encoding = AUDIO_ENCODING_LINEAR;                  info.play.encoding = AUDIO_ENCODING_LINEAR;
119                  /* Do we need to swap the 16bit values? (Are we BigEndian) */                  /* Do we need to swap the 16bit values? (Are we BigEndian) */
120                  swapaudio = !(*(uint8 *) (&test));                  g_swapaudio = !(*(uint8 *) (&test));
121          }          }
122    
123          samplewidth = pwfx->wBitsPerSample / 8;          g_samplewidth = pwfx->wBitsPerSample / 8;
124    
125          if (pwfx->nChannels == 1)          if (pwfx->nChannels == 1)
126          {          {
# Line 129  wave_out_set_format(WAVEFORMATEX * pwfx) Line 129  wave_out_set_format(WAVEFORMATEX * pwfx)
129          else if (pwfx->nChannels == 2)          else if (pwfx->nChannels == 2)
130          {          {
131                  info.play.channels = AUDIO_CHANNELS_STEREO;                  info.play.channels = AUDIO_CHANNELS_STEREO;
132                  samplewidth *= 2;                  g_samplewidth *= 2;
133          }          }
134    
135          info.play.sample_rate = pwfx->nSamplesPerSec;          info.play.sample_rate = pwfx->nSamplesPerSec;
# Line 137  wave_out_set_format(WAVEFORMATEX * pwfx) Line 137  wave_out_set_format(WAVEFORMATEX * pwfx)
137          info.play.samples = 0;          info.play.samples = 0;
138          info.play.eof = 0;          info.play.eof = 0;
139          info.play.error = 0;          info.play.error = 0;
140          reopened = True;          g_reopened = True;
141    
142          if (ioctl(g_dsp_fd, AUDIO_SETINFO, &info) == -1)          if (ioctl(g_dsp_fd, AUDIO_SETINFO, &info) == -1)
143          {          {
# Line 227  wave_out_play(void) Line 227  wave_out_play(void)
227    
228          while (1)          while (1)
229          {          {
230                  if (reopened)                  if (g_reopened)
231                  {                  {
232                          /* Device was just (re)openend */                          /* Device was just (re)openend */
233                          samplecnt = 0;                          samplecnt = 0;
234                          swapped = False;                          swapped = False;
235                          sentcompletion = True;                          sentcompletion = True;
236                          reopened = False;                          g_reopened = False;
237                  }                  }
238    
239                  if (queue_lo == queue_hi)                  if (queue_lo == queue_hi)
# Line 246  wave_out_play(void) Line 246  wave_out_play(void)
246                  out = &packet->s;                  out = &packet->s;
247    
248                  /* Swap the current packet, but only once */                  /* Swap the current packet, but only once */
249                  if (swapaudio && !swapped)                  if (g_swapaudio && !swapped)
250                  {                  {
251                          for (i = 0; i < out->end - out->p; i += 2)                          for (i = 0; i < out->end - out->p; i += 2)
252                          {                          {
# Line 260  wave_out_play(void) Line 260  wave_out_play(void)
260                  if (sentcompletion)                  if (sentcompletion)
261                  {                  {
262                          sentcompletion = False;                          sentcompletion = False;
263                          numsamples = (out->end - out->p) / samplewidth;                          numsamples = (out->end - out->p) / g_samplewidth;
264                  }                  }
265    
266                  len = 0;                  len = 0;

Legend:
Removed from v.509  
changed lines
  Added in v.510

  ViewVC Help
Powered by ViewVC 1.1.26