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

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

revision 1256 by stargo, Sun Sep 17 11:42:22 2006 UTC revision 1260 by stargo, Sun Sep 17 15:25:10 2006 UTC
# Line 31  Line 31 
31  ALconfig audioconfig;  ALconfig audioconfig;
32  ALport output_port;  ALport output_port;
33    
 static BOOL g_swapaudio;  
34  static int g_snd_rate;  static int g_snd_rate;
 static BOOL g_swapaudio;  
35  static int width = AL_SAMPLE_16;  static int width = AL_SAMPLE_16;
36  static char *sgi_output_device = NULL;  static char *sgi_output_device = NULL;
37    
# Line 141  sgi_set_format(WAVEFORMATEX * pwfx) Line 139  sgi_set_format(WAVEFORMATEX * pwfx)
139          fprintf(stderr, "sgi_set_format: init...\n");          fprintf(stderr, "sgi_set_format: init...\n");
140  #endif  #endif
141    
         g_swapaudio = False;  
142          if (pwfx->wBitsPerSample == 8)          if (pwfx->wBitsPerSample == 8)
143                  width = AL_SAMPLE_8;                  width = AL_SAMPLE_8;
144          else if (pwfx->wBitsPerSample == 16)          else if (pwfx->wBitsPerSample == 16)
         {  
145                  width = AL_SAMPLE_16;                  width = AL_SAMPLE_16;
                 /* Do we need to swap the 16bit values? (Are we BigEndian) */  
 #if (defined(B_ENDIAN))  
                 g_swapaudio = 1;  
 #else  
                 g_swapaudio = 0;  
 #endif  
         }  
146    
147          /* Limited support to configure an opened audio port in IRIX.  The          /* Limited support to configure an opened audio port in IRIX.  The
148             number of channels is a static setting and can not be changed after             number of channels is a static setting and can not be changed after
# Line 253  sgi_play(void) Line 242  sgi_play(void)
242          struct audio_packet *packet;          struct audio_packet *packet;
243          ssize_t len;          ssize_t len;
244          unsigned int i;          unsigned int i;
         uint8 swap;  
245          STREAM out;          STREAM out;
         static BOOL swapped = False;  
246          int gf;          int gf;
247    
248          while (1)          while (1)
# Line 269  sgi_play(void) Line 256  sgi_play(void)
256                  packet = rdpsnd_queue_current_packet();                  packet = rdpsnd_queue_current_packet();
257                  out = &packet->s;                  out = &packet->s;
258    
                 /* Swap the current packet, but only once */  
                 if (g_swapaudio && !swapped)  
                 {  
                         for (i = 0; i < out->end - out->p; i += 2)  
                         {  
                                 swap = *(out->p + i);  
                                 *(out->p + i) = *(out->p + i + 1);  
                                 *(out->p + i + 1) = swap;  
                         }  
                         swapped = True;  
                 }  
   
259                  len = out->end - out->p;                  len = out->end - out->p;
260    
261                  alWriteFrames(output_port, out->p, len / combinedFrameSize);                  alWriteFrames(output_port, out->p, len / combinedFrameSize);
# Line 293  sgi_play(void) Line 268  sgi_play(void)
268                          {                          {
269                                  rdpsnd_send_completion(packet->tick, packet->index);                                  rdpsnd_send_completion(packet->tick, packet->index);
270                                  rdpsnd_queue_next();                                  rdpsnd_queue_next();
                                 swapped = False;  
271                          }                          }
272                          else                          else
273                          {                          {
# Line 322  sgi_register(char *options) Line 296  sgi_register(char *options)
296          sgi_driver.wave_out_play = sgi_play;          sgi_driver.wave_out_play = sgi_play;
297          sgi_driver.name = xstrdup("sgi");          sgi_driver.name = xstrdup("sgi");
298          sgi_driver.description = xstrdup("SGI output driver");          sgi_driver.description = xstrdup("SGI output driver");
299            sgi_driver.need_byteswap_on_be = 1;
300          sgi_driver.next = NULL;          sgi_driver.next = NULL;
301    
302          if (options)          if (options)

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

  ViewVC Help
Powered by ViewVC 1.1.26