a180a41bba1d50822df23fff0099e90b86638b89vboxsync/* -*- c-basic-offset: 8 -*-
a180a41bba1d50822df23fff0099e90b86638b89vboxsync rdesktop: A Remote Desktop Protocol client.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync Sound Channel Process Functions - SGI/IRIX
a180a41bba1d50822df23fff0099e90b86638b89vboxsync Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 2003-2008
a180a41bba1d50822df23fff0099e90b86638b89vboxsync Copyright (C) GuoJunBo <guojunbo@ict.ac.cn> 2003
a180a41bba1d50822df23fff0099e90b86638b89vboxsync Copyright (C) Jeremy Meng <void.foo@gmail.com> 2004-2005
a180a41bba1d50822df23fff0099e90b86638b89vboxsync This program is free software: you can redistribute it and/or modify
a180a41bba1d50822df23fff0099e90b86638b89vboxsync it under the terms of the GNU General Public License as published by
a180a41bba1d50822df23fff0099e90b86638b89vboxsync the Free Software Foundation, either version 3 of the License, or
a180a41bba1d50822df23fff0099e90b86638b89vboxsync (at your option) any later version.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync This program is distributed in the hope that it will be useful,
a180a41bba1d50822df23fff0099e90b86638b89vboxsync but WITHOUT ANY WARRANTY; without even the implied warranty of
a180a41bba1d50822df23fff0099e90b86638b89vboxsync MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a180a41bba1d50822df23fff0099e90b86638b89vboxsync GNU General Public License for more details.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync You should have received a copy of the GNU General Public License
a180a41bba1d50822df23fff0099e90b86638b89vboxsync along with this program. If not, see <http://www.gnu.org/licenses/>.
6e9aa255e3376b2da5824c09c4c62bc233463bfevboxsync * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
6e9aa255e3376b2da5824c09c4c62bc233463bfevboxsync * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
6e9aa255e3376b2da5824c09c4c62bc233463bfevboxsync * the General Public License version 2 (GPLv2) at this time for any software where
6e9aa255e3376b2da5824c09c4c62bc233463bfevboxsync * a choice of GPL license versions is made available with the language indicating
6e9aa255e3376b2da5824c09c4c62bc233463bfevboxsync * that GPLv2 or any later version may be used, or where a choice of which version
6e9aa255e3376b2da5824c09c4c62bc233463bfevboxsync * of the GPL is applied is otherwise unspecified.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync/* #define IRIX_DEBUG 1 */
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncsgi_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv)
a180a41bba1d50822df23fff0099e90b86638b89vboxsync /* We need to be called rather often... */
a180a41bba1d50822df23fff0099e90b86638b89vboxsync if (output_port != (ALport) 0 && !rdpsnd_queue_empty())
a180a41bba1d50822df23fff0099e90b86638b89vboxsync#if (defined(IRIX_DEBUG))
a180a41bba1d50822df23fff0099e90b86638b89vboxsync warning("device-options not supported for libao-driver\n");
a180a41bba1d50822df23fff0099e90b86638b89vboxsync if (alGetParamInfo(AL_DEFAULT_OUTPUT, AL_GAIN, &pinfo) < 0)
a180a41bba1d50822df23fff0099e90b86638b89vboxsync fprintf(stderr, "sgi_open: alGetParamInfo failed: %s\n",
a180a41bba1d50822df23fff0099e90b86638b89vboxsync#if (defined(IRIX_DEBUG))
a180a41bba1d50822df23fff0099e90b86638b89vboxsync fprintf(stderr, "sgi_open: minvol = %lf, maxvol= %lf, range = %lf.\n",
a180a41bba1d50822df23fff0099e90b86638b89vboxsync fprintf(stderr, "sgi_open: alNewConfig failed: %s\n", alGetErrorString(oserror()));
a180a41bba1d50822df23fff0099e90b86638b89vboxsync fprintf(stderr, "sgi_open: alOpenPort failed: %s\n", alGetErrorString(oserror()));
a180a41bba1d50822df23fff0099e90b86638b89vboxsync#if (defined(IRIX_DEBUG))
a180a41bba1d50822df23fff0099e90b86638b89vboxsync /* Ack all remaining packets */
a180a41bba1d50822df23fff0099e90b86638b89vboxsync#if (defined(IRIX_DEBUG))
a180a41bba1d50822df23fff0099e90b86638b89vboxsync#if (defined(IRIX_DEBUG))
a180a41bba1d50822df23fff0099e90b86638b89vboxsync if ((pwfx->nChannels != 1) && (pwfx->nChannels != 2))
a180a41bba1d50822df23fff0099e90b86638b89vboxsync if ((pwfx->wBitsPerSample != 8) && (pwfx->wBitsPerSample != 16))
a180a41bba1d50822df23fff0099e90b86638b89vboxsync#if (defined(IRIX_DEBUG))
a180a41bba1d50822df23fff0099e90b86638b89vboxsync /* Limited support to configure an opened audio port in IRIX. The
a180a41bba1d50822df23fff0099e90b86638b89vboxsync number of channels is a static setting and can not be changed after
a180a41bba1d50822df23fff0099e90b86638b89vboxsync a port is opened. So if the number of channels remains the same, we
a180a41bba1d50822df23fff0099e90b86638b89vboxsync can configure other settings; otherwise we have to reopen the audio
a180a41bba1d50822df23fff0099e90b86638b89vboxsync port, using same config. */
a180a41bba1d50822df23fff0099e90b86638b89vboxsync output_port = alOpenPort("rdpsnd", "w", audioconfig);
a180a41bba1d50822df23fff0099e90b86638b89vboxsync fprintf(stderr, "sgi_set_format: alOpenPort failed: %s\n",
a180a41bba1d50822df23fff0099e90b86638b89vboxsync fprintf(stderr, "sgi_set_format: bad frameSize or channelCount\n");
a180a41bba1d50822df23fff0099e90b86638b89vboxsync fprintf(stderr, "wave_set_format: alSetParams failed: %s\n",
a180a41bba1d50822df23fff0099e90b86638b89vboxsync fprintf(stderr, "wave_set_format: invalid rate %d\n", g_snd_rate);
a180a41bba1d50822df23fff0099e90b86638b89vboxsync#if (defined(IRIX_DEBUG))
a180a41bba1d50822df23fff0099e90b86638b89vboxsync#if (defined(IRIX_DEBUG))
a180a41bba1d50822df23fff0099e90b86638b89vboxsync fprintf(stderr, "left='%d', right='%d'\n", left, right);
a180a41bba1d50822df23fff0099e90b86638b89vboxsync gain[0] = alDoubleToFixed(min_volume + gainleft * volume_range);
a180a41bba1d50822df23fff0099e90b86638b89vboxsync gain[1] = alDoubleToFixed(min_volume + gainright * volume_range);
a180a41bba1d50822df23fff0099e90b86638b89vboxsync fprintf(stderr, "sgi_volume: alSetParams failed: %s\n",
a180a41bba1d50822df23fff0099e90b86638b89vboxsync#if (defined(IRIX_DEBUG))
a180a41bba1d50822df23fff0099e90b86638b89vboxsync unsigned int i;
a180a41bba1d50822df23fff0099e90b86638b89vboxsync alWriteFrames(output_port, out->p, len / combinedFrameSize);
a180a41bba1d50822df23fff0099e90b86638b89vboxsync#if (defined(IRIX_DEBUG))
a180a41bba1d50822df23fff0099e90b86638b89vboxsync/* fprintf(stderr,"Busy playing...\n"); */