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

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

revision 836 by stargo, Tue Mar 8 12:09:20 2005 UTC revision 837 by stargo, Tue Mar 8 12:16:22 2005 UTC
# Line 116  wave_out_set_format(WAVEFORMATEX * pwfx) Line 116  wave_out_set_format(WAVEFORMATEX * pwfx)
116    
117          g_samplewidth = pwfx->wBitsPerSample / 8;          g_samplewidth = pwfx->wBitsPerSample / 8;
118    
119          if(o_device != NULL)          if (o_device != NULL)
120                  ao_close(o_device);                  ao_close(o_device);
121    
122          o_device = ao_open_live(default_driver, &format, NULL);          o_device = ao_open_live(default_driver, &format, NULL);
# Line 165  wave_out_play(void) Line 165  wave_out_play(void)
165  {  {
166          struct audio_packet *packet;          struct audio_packet *packet;
167          STREAM out;          STREAM out;
168          unsigned char expanded[WAVEOUTBUF];          unsigned char outbuf[WAVEOUTBUF];
169          int offset,len,i;          int offset, len, i;
170    
171          if (queue_lo == queue_hi)          if (queue_lo == queue_hi)
172          {          {
# Line 179  wave_out_play(void) Line 179  wave_out_play(void)
179    
180          len = 0;          len = 0;
181    
182          if (g_samplerate == 22050 )          if (g_samplerate == 22050)
183          {          {
184                  /* Resample to 44100 */                  /* Resample to 44100 */
185                  for(i=0; (i<((WAVEOUTBUF/8)*(3-g_samplewidth))) && (out->p < out->end); i++)                  for (i = 0; (i < ((WAVEOUTBUF / 8) * (3 - g_samplewidth))) && (out->p < out->end);
186                         i++)
187                  {                  {
188                          offset=i*4*g_samplewidth;                          offset = i * 4 * g_samplewidth;
189                          memcpy(&expanded[0*g_samplewidth+offset],out->p,g_samplewidth);                          memcpy(&outbuf[0 * g_samplewidth + offset], out->p, g_samplewidth);
190                          memcpy(&expanded[2*g_samplewidth+offset],out->p,g_samplewidth);                          memcpy(&outbuf[2 * g_samplewidth + offset], out->p, g_samplewidth);
191                          out->p += 2;                          out->p += 2;
192    
193                          memcpy(&expanded[1*g_samplewidth+offset],out->p,g_samplewidth);                          memcpy(&outbuf[1 * g_samplewidth + offset], out->p, g_samplewidth);
194                          memcpy(&expanded[3*g_samplewidth+offset],out->p,g_samplewidth);                          memcpy(&outbuf[3 * g_samplewidth + offset], out->p, g_samplewidth);
195                          out->p += 2;                          out->p += 2;
196                          len += 4*g_samplewidth;                          len += 4 * g_samplewidth;
197                  }                  }
198          }          }
199          else          else
200          {          {
201                  len = (WAVEOUTBUF > (out->end - out->p)) ? (out->end - out->p) : WAVEOUTBUF;                  len = (WAVEOUTBUF > (out->end - out->p)) ? (out->end - out->p) : WAVEOUTBUF;
202                  memcpy(expanded,out->p,len);                  memcpy(outbuf, out->p, len);
203                  out->p += len;                  out->p += len;
204          }          }
205    
206          ao_play(o_device, expanded, len);          ao_play(o_device, outbuf, len);
207    
208          if (out->p == out->end)          if (out->p == out->end)
209          {          {

Legend:
Removed from v.836  
changed lines
  Added in v.837

  ViewVC Help
Powered by ViewVC 1.1.26