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