/[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 1256 by stargo, Sun Sep 17 11:42:22 2006 UTC revision 1260 by stargo, Sun Sep 17 15:25:10 2006 UTC
# Line 35  Line 35 
35  #define DEFAULTDEVICE   "/dev/audio"  #define DEFAULTDEVICE   "/dev/audio"
36    
37  static BOOL g_reopened;  static BOOL g_reopened;
 static BOOL g_swapaudio;  
38  static short g_samplewidth;  static short g_samplewidth;
39  static char *dsp_dev;  static char *dsp_dev;
40    
# Line 97  sun_set_format(WAVEFORMATEX * pwfx) Line 96  sun_set_format(WAVEFORMATEX * pwfx)
96          audio_info_t info;          audio_info_t info;
97    
98          ioctl(g_dsp_fd, AUDIO_DRAIN, 0);          ioctl(g_dsp_fd, AUDIO_DRAIN, 0);
         g_swapaudio = False;  
99          AUDIO_INITINFO(&info);          AUDIO_INITINFO(&info);
100    
101    
# Line 108  sun_set_format(WAVEFORMATEX * pwfx) Line 106  sun_set_format(WAVEFORMATEX * pwfx)
106          else if (pwfx->wBitsPerSample == 16)          else if (pwfx->wBitsPerSample == 16)
107          {          {
108                  info.play.encoding = AUDIO_ENCODING_LINEAR;                  info.play.encoding = AUDIO_ENCODING_LINEAR;
                 /* Do we need to swap the 16bit values? (Are we BigEndian) */  
 #ifdef B_ENDIAN  
                 g_swapaudio = 1;  
 #else  
                 g_swapaudio = 0;  
 #endif  
109          }          }
110    
111          g_samplewidth = pwfx->wBitsPerSample / 8;          g_samplewidth = pwfx->wBitsPerSample / 8;
# Line 184  sun_play(void) Line 176  sun_play(void)
176          audio_info_t info;          audio_info_t info;
177          ssize_t len;          ssize_t len;
178          unsigned int i;          unsigned int i;
         uint8 swap;  
179          STREAM out;          STREAM out;
         static BOOL swapped = False;  
180          static BOOL sentcompletion = True;          static BOOL sentcompletion = True;
181          static uint32 samplecnt = 0;          static uint32 samplecnt = 0;
182          static uint32 numsamples;          static uint32 numsamples;
# Line 197  sun_play(void) Line 187  sun_play(void)
187                  {                  {
188                          /* Device was just (re)openend */                          /* Device was just (re)openend */
189                          samplecnt = 0;                          samplecnt = 0;
                         swapped = False;  
190                          sentcompletion = True;                          sentcompletion = True;
191                          g_reopened = False;                          g_reopened = False;
192                  }                  }
# Line 211  sun_play(void) Line 200  sun_play(void)
200                  packet = rdpsnd_queue_current_packet();                  packet = rdpsnd_queue_current_packet();
201                  out = &packet->s;                  out = &packet->s;
202    
                 /* 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;  
                 }  
   
203                  if (sentcompletion)                  if (sentcompletion)
204                  {                  {
205                          sentcompletion = False;                          sentcompletion = False;
# Line 260  sun_play(void) Line 237  sun_play(void)
237                                   * playing this packet */                                   * playing this packet */
238                                  rdpsnd_send_completion(packet->tick + 50, packet->index);                                  rdpsnd_send_completion(packet->tick + 50, packet->index);
239                                  rdpsnd_queue_next();                                  rdpsnd_queue_next();
                                 swapped = False;  
240                                  sentcompletion = True;                                  sentcompletion = True;
241                          }                          }
242                          else                          else
# Line 287  sun_register(char *options) Line 263  sun_register(char *options)
263          sun_driver.name = xstrdup("sun");          sun_driver.name = xstrdup("sun");
264          sun_driver.description =          sun_driver.description =
265                  xstrdup("SUN/BSD output driver, default device: " DEFAULTDEVICE " or $AUDIODEV");                  xstrdup("SUN/BSD output driver, default device: " DEFAULTDEVICE " or $AUDIODEV");
266            sun_driver.need_byteswap_on_be = 1;
267          sun_driver.next = NULL;          sun_driver.next = NULL;
268    
269          if (options)          if (options)

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

  ViewVC Help
Powered by ViewVC 1.1.26