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

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

revision 1255 by stargo, Sun Sep 17 11:04:50 2006 UTC revision 1345 by ossman_, Thu Dec 7 11:54:29 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 70  sgi_open(void) Line 68  sgi_open(void)
68                  min_volume, max_volume, volume_range);                  min_volume, max_volume, volume_range);
69  #endif  #endif
70    
         rdpsnd_queue_init();  
   
71          audioconfig = alNewConfig();          audioconfig = alNewConfig();
72          if (audioconfig == (ALconfig) 0)          if (audioconfig == (ALconfig) 0)
73          {          {
# Line 101  sgi_close(void) Line 97  sgi_close(void)
97  #endif  #endif
98    
99          while (!rdpsnd_queue_empty())          while (!rdpsnd_queue_empty())
100          {                  rdpsnd_queue_next(0);
                 /* We need to add 50 to tell windows that time has passed while  
                  * playing this packet */  
                 rdpsnd_send_completion(rdpsnd_queue_current_packet()->tick + 50,  
                                        rdpsnd_queue_current_packet()->index);  
                 rdpsnd_queue_next();  
         }  
101          alDiscardFrames(output_port, 0);          alDiscardFrames(output_port, 0);
102    
103          alClosePort(output_port);          alClosePort(output_port);
# Line 141  sgi_set_format(WAVEFORMATEX * pwfx) Line 131  sgi_set_format(WAVEFORMATEX * pwfx)
131          fprintf(stderr, "sgi_set_format: init...\n");          fprintf(stderr, "sgi_set_format: init...\n");
132  #endif  #endif
133    
         g_swapaudio = False;  
134          if (pwfx->wBitsPerSample == 8)          if (pwfx->wBitsPerSample == 8)
135                  width = AL_SAMPLE_8;                  width = AL_SAMPLE_8;
136          else if (pwfx->wBitsPerSample == 16)          else if (pwfx->wBitsPerSample == 16)
         {  
137                  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  
         }  
138    
139          /* Limited support to configure an opened audio port in IRIX.  The          /* Limited support to configure an opened audio port in IRIX.  The
140             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 234  sgi_play(void)
234          struct audio_packet *packet;          struct audio_packet *packet;
235          ssize_t len;          ssize_t len;
236          unsigned int i;          unsigned int i;
         uint8 swap;  
237          STREAM out;          STREAM out;
         static BOOL swapped = False;  
238          int gf;          int gf;
239    
240          while (1)          while (1)
# Line 269  sgi_play(void) Line 248  sgi_play(void)
248                  packet = rdpsnd_queue_current_packet();                  packet = rdpsnd_queue_current_packet();
249                  out = &packet->s;                  out = &packet->s;
250    
                 /* 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;  
                 }  
   
251                  len = out->end - out->p;                  len = out->end - out->p;
252    
253                  alWriteFrames(output_port, out->p, len / combinedFrameSize);                  alWriteFrames(output_port, out->p, len / combinedFrameSize);
# Line 291  sgi_play(void) Line 258  sgi_play(void)
258                          gf = alGetFilled(output_port);                          gf = alGetFilled(output_port);
259                          if (gf < (4 * maxFillable / 10))                          if (gf < (4 * maxFillable / 10))
260                          {                          {
261                                  rdpsnd_send_completion(packet->tick, packet->index);                                  rdpsnd_queue_next(0);
                                 rdpsnd_queue_next();  
                                 swapped = False;  
262                          }                          }
263                          else                          else
264                          {                          {
# Line 309  sgi_play(void) Line 274  sgi_play(void)
274  }  }
275    
276  static struct audio_driver sgi_driver = {  static struct audio_driver sgi_driver = {
277        wave_out_write:rdpsnd_queue_write,          .name = "sgi",
278        wave_out_open:sgi_open,          .description = "SGI output driver",
279        wave_out_close:sgi_close,  
280        wave_out_format_supported:sgi_format_supported,          .wave_out_open = sgi_open,
281        wave_out_set_format:sgi_set_format,          .wave_out_close = sgi_close,
282        wave_out_volume:sgi_volume,          .wave_out_format_supported = sgi_format_supported,
283        wave_out_play:sgi_play,          .wave_out_set_format = sgi_set_format,
284        name:"sgi",          .wave_out_volume = sgi_volume,
285        description:"SGI output driver",          .wave_out_play = sgi_play,
286        next:NULL,  
287            .need_byteswap_on_be = 1,
288            .need_resampling = 0,
289  };  };
290    
291  struct audio_driver *  struct audio_driver *

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

  ViewVC Help
Powered by ViewVC 1.1.26