CVS: rdesktop rdpsnd_sgi.c,1.4,1.5
Michael Gernoth <[email protected]>
| Newsgroups | gmane.network.rdesktop.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/rdesktop/rdesktop In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21867 Modified Files: rdpsnd_sgi.c Log Message: SGI sound fixes from Jeremy Meng <[email protected]> Index: rdpsnd_sgi.c =================================================================== RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_sgi.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** rdpsnd_sgi.c 15 Mar 2005 11:25:50 -0000 1.4 --- rdpsnd_sgi.c 30 Apr 2005 09:13:13 -0000 1.5 *************** *** 39,43 **** static int g_snd_rate; static BOOL g_swapaudio; - static short g_samplewidth; static int width = AL_SAMPLE_16; --- 39,42 ---- *************** *** 146,155 **** fprintf(stderr, "wave_out_set_format: init...\n"); #endif - /* limited support to configure an opened audio port in IRIX */ - /* have to reopen the audio port, using same config */ - alClosePort(output_port); g_swapaudio = False; - if (pwfx->wBitsPerSample == 8) width = AL_SAMPLE_8; --- 145,150 ---- *************** *** 158,162 **** width = AL_SAMPLE_16; /* Do we need to swap the 16bit values? (Are we BigEndian) */ ! #if (defined(IRIX_DEBUG)) g_swapaudio = 1; #else --- 153,157 ---- width = AL_SAMPLE_16; /* Do we need to swap the 16bit values? (Are we BigEndian) */ ! #if (defined(B_ENDIAN)) g_swapaudio = 1; #else *************** *** 165,169 **** } ! g_samplewidth = pwfx->wBitsPerSample / 8; channels = pwfx->nChannels; g_snd_rate = pwfx->nSamplesPerSec; --- 160,169 ---- } ! /* Limited support to configure an opened audio port in IRIX The ! number of channels is a static setting and can not be changed after ! a port is opened. So if the number of channels remains the same, we ! can configure other settings Otherwise we have to reopen the audio ! port, using same config. */ ! channels = pwfx->nChannels; g_snd_rate = pwfx->nSamplesPerSec; *************** *** 171,183 **** alSetSampFmt(audioconfig, AL_SAMPFMT_TWOSCOMP); alSetWidth(audioconfig, width); ! alSetChannels(audioconfig, channels); ! output_port = alOpenPort("rdpsnd", "w", audioconfig); - if (output_port == (ALport) 0) - { - fprintf(stderr, "wave_out_set_format: alOpenPort failed: %s\n", - alGetErrorString(oserror())); - return False; } --- 171,187 ---- alSetSampFmt(audioconfig, AL_SAMPFMT_TWOSCOMP); alSetWidth(audioconfig, width); ! if ( channels != alGetChannels(audioconfig) ) ! { ! alClosePort(output_port); ! alSetChannels(audioconfig, channels); ! output_port = alOpenPort("rdpsnd", "w", audioconfig); ! if (output_port == (ALport) 0) ! { ! fprintf(stderr, "wave_out_set_format: alOpenPort failed: %s\n", ! alGetErrorString(oserror())); ! return False; ! } } *************** *** 282,292 **** uint8 swap; STREAM out; - static long startedat_us; - static long startedat_s; - static BOOL started = False; static BOOL swapped = False; - struct timeval tv; int gf; - static long long temp; while (1) --- 286,291 ---- *************** *** 313,333 **** } - if (!started) - { - gettimeofday(&tv, NULL); - startedat_us = tv.tv_usec; - startedat_s = tv.tv_sec; - started = True; - } - len = out->end - out->p; - gf = alGetFillable(output_port); - if (len > gf) - { - /* len = gf * combinedFrameSize; */ - #if (defined(IRIX_DEBUG)) - /* fprintf(stderr,"Fillable...\n"); */ - #endif - } alWriteFrames(output_port, out->p, len / combinedFrameSize); --- 312,316 ---- *************** *** 336,352 **** if (out->p == out->end) { ! long long duration; ! long elapsed; ! ! gettimeofday(&tv, NULL); ! duration = (out->size * (1000000 / (g_samplewidth * g_snd_rate))); ! elapsed = (tv.tv_sec - startedat_s) * 1000000 + (tv.tv_usec - startedat_us); ! /* 7/10 is not good for IRIX audio port, 4x/100 is suitable */ ! if (elapsed >= (duration * 485) / 1000) { rdpsnd_send_completion(packet->tick, packet->index); free(out->data); queue_lo = (queue_lo + 1) % MAX_QUEUE; - started = False; swapped = False; } --- 319,328 ---- if (out->p == out->end) { ! gf = alGetFilled(output_port); ! if ( gf < (4 * maxFillable / 10) ) { rdpsnd_send_completion(packet->tick, packet->index); free(out->data); queue_lo = (queue_lo + 1) % MAX_QUEUE; swapped = False; } *************** *** 354,358 **** { #if (defined(IRIX_DEBUG)) ! /* fprintf(stderr,"Busy playing...\n"); */ #endif g_dsp_busy = True; --- 330,334 ---- { #if (defined(IRIX_DEBUG)) ! /* fprintf(stderr,"Busy playing...\n"); */ #endif g_dsp_busy = True; ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20