|
From: Brenda L. <asp...@us...> - 2003-05-13 22:27:19
|
Update of /cvsroot/squeak/squeak/platforms/unix/plugins/SoundPlugin In directory sc8-pr-cvs1:/tmp/cvs-serv21322/SoundPlugin Modified Files: sqUnixSound.c Log Message: Ian Piumarta's release 3.5-1devel Index: sqUnixSound.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/plugins/SoundPlugin/sqUnixSound.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sqUnixSound.c 12 May 2003 07:39:07 -0000 1.5 --- sqUnixSound.c 13 May 2003 22:27:10 -0000 1.6 *************** *** 1,7 **** /* sqUnixSound.c -- sound support for various Unix sound systems * ! * Authors: Ian...@in... and Lex Spoon <le...@cc...> * ! * Last edited: 2002-10-26 14:37:22 by piumarta on emilia.inria.fr * * Copyright (C) 1996-2002 Ian Piumarta and other authors/contributors --- 1,7 ---- /* sqUnixSound.c -- sound support for various Unix sound systems * ! * Author: Ian...@in... * ! * Last edited: 2003-02-09 18:15:00 by piumarta on emilia.inria.fr * * Copyright (C) 1996-2002 Ian Piumarta and other authors/contributors *************** *** 9,12 **** --- 9,16 ---- * All rights reserved. * + * You are NOT ALLOWED to distribute modified versions of this file + * under its original name. If you want to modify it and then make + * your modifications available publicly, rename the file first. + * * This file is part of Unix Squeak. * *************** *** 17,21 **** * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of ! * this distribution, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not --- 21,25 ---- * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of ! * this distribution, subject to the following additional restrictions: * * 1. The origin of this software must not be misrepresented; you must not *************** *** 25,37 **** * would be appreciated but is not required. * ! * 2. This notice must not be removed or altered in any source distribution. * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. - * - * You are not allowed to distribute a modified version of this file - * under its original name without explicit permission to do so. If - * you change it, rename it. * * NOTE: The real sound support code is in one of the following files according --- 29,40 ---- * would be appreciated but is not required. * ! * 2. You must not distribute (or make publicly available by any ! * means) a modified copy of this file unless you first rename it. ! * ! * 3. This notice must not be removed or altered in any source distribution. * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. * * NOTE: The real sound support code is in one of the following files according *************** *** 41,58 **** * sqUnixSoundNAS.c (Network Audio System) * sqUnixSoundSun.c (SunOS/Solaris) ! * sqUnixSoundNone.c (no sound support) */ #include "sq.h" #include "SoundPlugin.h" extern int snd_Stop(void); - /*** module initialisation/shutdown ***/ int soundInit(void) { return 1; } --- 44,89 ---- * sqUnixSoundNAS.c (Network Audio System) * sqUnixSoundSun.c (SunOS/Solaris) ! * sqUnixSoundMacOSX.c (Mac OS 10 CoreAudio) ! * sqUnixSoundNull.c (sound disabled) */ #include "sq.h" #include "SoundPlugin.h" + #include "SqModule.h" + #include "SqSound.h" extern int snd_Stop(void); /*** module initialisation/shutdown ***/ + extern struct SqModule *soundModule; + extern struct SqModule *loadModule(char *type, char *name); + + static struct SqSound *snd= 0; int soundInit(void) { + if (!soundModule + && !(soundModule= getenv("SQUEAK_SOUND_OSS") ? loadModule("sound", "OSS") : 0) + && !(soundModule= getenv("SQUEAK_SOUND_NAS") ? loadModule("sound", "NAS") : 0) + && !(soundModule= getenv("SQUEAK_SOUND_SUN") ? loadModule("sound", "Sun") : 0) + && !(soundModule= getenv("SQUEAK_SOUND_MACOSX") ? loadModule("sound", "MacOSX") : 0) + && !(soundModule= getenv("AUDIOSERVER") ? loadModule("sound", "NAS") : 0) + && !(soundModule= loadModule("sound", "OSS")) + && !(soundModule= loadModule("sound", "Sun")) + && !(soundModule= loadModule("sound", "MacOSX")) + && !(soundModule= loadModule("sound", "null"))) + { + fprintf(stderr, "could not find any sound module\n"); + abort(); + } + printf("soundModule %p %s\n", soundModule, soundModule->name); + snd= (struct SqSound *)soundModule->makeInterface(); + if (SqSoundVersion != snd->version) + { + fprintf(stderr, "module %s interface version %x does not have required version %x\n", + soundModule->name, snd->version, SqSoundVersion); + abort(); + } return 1; } *************** *** 61,65 **** int soundShutdown(void) { ! snd_Stop(); return 1; } --- 92,157 ---- int soundShutdown(void) { ! if (snd) snd->snd_Stop(); return 1; } + + + /* output */ + + int snd_AvailableSpace(void) + { + return snd->snd_AvailableSpace(); + } + + int snd_InsertSamplesFromLeadTime(int frameCount, int srcBufPtr, int samplesOfLeadTime) + { + return snd->snd_InsertSamplesFromLeadTime(frameCount, srcBufPtr, samplesOfLeadTime); + } + + int snd_PlaySamplesFromAtLength(int frameCount, int arrayIndex, int startIndex) + { + return snd->snd_PlaySamplesFromAtLength(frameCount, arrayIndex, startIndex); + } + + int snd_PlaySilence(void) + { + return snd->snd_PlaySilence(); + } + + int snd_Start(int frameCount, int samplesPerSec, int stereo, int semaIndex) + { + return snd->snd_Start(frameCount, samplesPerSec, stereo, semaIndex); + } + + int snd_Stop(void) + { + return snd->snd_Stop(); + } + + /* input */ + + int snd_StartRecording(int desiredSamplesPerSec, int stereo, int semaIndex) + { + return snd->snd_StartRecording(desiredSamplesPerSec, stereo, semaIndex); + } + + int snd_StopRecording(void) + { + return snd->snd_StopRecording(); + } + + double snd_GetRecordingSampleRate(void) + { + return snd->snd_GetRecordingSampleRate(); + } + + int snd_RecordSamplesIntoAtLength(int buf, int startSliceIndex, int bufferSizeInBytes) + { + return snd->snd_RecordSamplesIntoAtLength(buf, startSliceIndex, bufferSizeInBytes); + } + + /* mixer */ + + void snd_Volume(double *left, double *right) { snd->snd_Volume(left, right); } + void snd_SetVolume(double left, double right) { snd->snd_SetVolume(left, right); } + int snd_SetRecordLevel(int level) { return snd->snd_SetRecordLevel(level); } |