From 66861f2f95fe06d4efc897cb1af3856d56f1525b Mon Sep 17 00:00:00 2001 From: stephena Date: Mon, 12 Jun 2006 00:11:12 +0000 Subject: [PATCH] Forgot to include the rsynth module.mk file in the last commit. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1114 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/rsynth/config/NeXTplay.c | 130 ------ stella/src/emucore/rsynth/config/alsaplay.c | 209 --------- stella/src/emucore/rsynth/config/config.win32 | 103 ----- stella/src/emucore/rsynth/config/dummyplay.c | 22 - .../src/emucore/rsynth/config/freebsdplay.c | 144 ------ stella/src/emucore/rsynth/config/hpuxplay.c | 187 -------- stella/src/emucore/rsynth/config/make_dist | 21 - stella/src/emucore/rsynth/config/mmsystem.h | 210 --------- stella/src/emucore/rsynth/config/naplay.c | 150 ------- stella/src/emucore/rsynth/config/ossplay.c | 316 ------------- stella/src/emucore/rsynth/config/pipeplay.c | 29 -- stella/src/emucore/rsynth/config/sgiplay.c | 92 ---- stella/src/emucore/rsynth/config/sunplay.c | 311 ------------- stella/src/emucore/rsynth/config/sunplay_mm.c | 425 ------------------ stella/src/emucore/rsynth/config/win32play.c | 317 ------------- stella/src/emucore/rsynth/module.mk | 21 + 16 files changed, 21 insertions(+), 2666 deletions(-) delete mode 100644 stella/src/emucore/rsynth/config/NeXTplay.c delete mode 100644 stella/src/emucore/rsynth/config/alsaplay.c delete mode 100644 stella/src/emucore/rsynth/config/config.win32 delete mode 100644 stella/src/emucore/rsynth/config/dummyplay.c delete mode 100644 stella/src/emucore/rsynth/config/freebsdplay.c delete mode 100644 stella/src/emucore/rsynth/config/hpuxplay.c delete mode 100644 stella/src/emucore/rsynth/config/make_dist delete mode 100644 stella/src/emucore/rsynth/config/mmsystem.h delete mode 100644 stella/src/emucore/rsynth/config/naplay.c delete mode 100644 stella/src/emucore/rsynth/config/ossplay.c delete mode 100644 stella/src/emucore/rsynth/config/pipeplay.c delete mode 100644 stella/src/emucore/rsynth/config/sgiplay.c delete mode 100644 stella/src/emucore/rsynth/config/sunplay.c delete mode 100644 stella/src/emucore/rsynth/config/sunplay_mm.c delete mode 100644 stella/src/emucore/rsynth/config/win32play.c create mode 100644 stella/src/emucore/rsynth/module.mk diff --git a/stella/src/emucore/rsynth/config/NeXTplay.c b/stella/src/emucore/rsynth/config/NeXTplay.c deleted file mode 100644 index ad8a454b5..000000000 --- a/stella/src/emucore/rsynth/config/NeXTplay.c +++ /dev/null @@ -1,130 +0,0 @@ -/*****************************************************************/ -/*****************************************************************/ -/*** ***/ -/*** ***/ -/*** Play out a file on the NeXT ***/ -/*** ***/ -/*** ***/ -/*** B. Stuyts 21-feb-94 ***/ -/*** ***/ -/*** ***/ -/*****************************************************************/ -/*****************************************************************/ - -#include -#include -#include -#include "getargs.h" -#include "hplay.h" - -#undef DEBUG - -#define SAMP_RATE SND_RATE_CODEC -long samp_rate = SAMP_RATE; - -SNDSoundStruct *sound = NULL; - -int -audio_init(int argc, char *argv[]) -{ - int err; - int rate_set = 0; - -#ifdef DEBUG - int i; - - printf("audio_init: %d\n", argc); - for (i = 0; i < argc; i++) - printf("audio_init arg %d = %s\n", i, argv[i]); -#endif - - argc = getargs("NeXT audio",argc, argv, - "r", "%d", &rate_set, "Sample rate", - NULL); - if (help_only) - return argc; - - if (rate_set) - samp_rate = rate_set; - - err = SNDAlloc(&sound, 1000000, SND_FORMAT_LINEAR_16, samp_rate, 1, 0); - if (err) - { - fprintf(stderr, "audio_init: %s\n", SNDSoundError(err)); - exit(1); - } - return argc; -} - -void -audio_play(int n, short *data) -{ - int err; - -#ifdef DEBUG - printf("audio_play: %d words\n", n); -#if 0 - printf("audio_play: sound = %ld\n", sound); - printf("audio_play: dataLocation = %ld\n", sound->dataLocation); - printf("audio_play: sum = %ld\n", (char *) sound + sound->dataLocation); -#endif -#endif - - if (n > 0) - { - /* Wait for previous sound to finish before changing - fields in sound - */ - err = SNDWait(0); - if (err) - { - fprintf(stderr, "SNDWait: %s\n", SNDSoundError(err)); - exit(1); - } - sound->dataSize = n * sizeof(short); - /* Patch from benstn@olivetti.nl (Ben Stuyts) - Thanks to ugubser@avalon.unizh.ch for finding out why the NEXTSTEP - version of rsynth didn't work on Intel systems. As suspected, it was a - byte-order problem. - */ -#if i386 - swab((char *) data, (char *) sound + sound->dataLocation, n * sizeof(short)); -#else /* i386 */ - bcopy(data, (char *) sound + sound->dataLocation, n * sizeof(short)); -#endif - - err = SNDStartPlaying(sound, 1, 5, 0, 0, 0); - if (err) - { - fprintf(stderr, "audio_play: %s\n", SNDSoundError(err)); - exit(1); - } - } -} - -void -audio_term() -{ - int err; - -#ifdef DEBUG - printf("audio_term\n"); -#endif - - if(!sound) - return; - - err = SNDWait(0); - if (err) - { - fprintf(stderr, "audio_play: %s\n", SNDSoundError(err)); - exit(1); - } - - err = SNDFree(sound); - if (err) - { - fprintf(stderr, "audio_term: %s\n", SNDSoundError(err)); - exit(1); - } -} diff --git a/stella/src/emucore/rsynth/config/alsaplay.c b/stella/src/emucore/rsynth/config/alsaplay.c deleted file mode 100644 index dd98d63d1..000000000 --- a/stella/src/emucore/rsynth/config/alsaplay.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - Copyright (c) 2003 Nick Ing-Simmons. - All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA - -*/ - -#include "config.h" - - -#include "useconfig.h" -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -// #define ALSA_PCM_OLD_HW_PARAMS_API - -#include -#include "l2u.h" - -char *pcm_name = "default"; - -#include "getargs.h" -#include "hplay.h" - -#define SAMP_RATE 11025 -long samp_rate = SAMP_RATE; - -/* Audio Parameters */ - -static int linear_fd = -1; - -char *prog = "hplay"; -static snd_pcm_t *pcm; -static snd_pcm_hw_params_t *hwparams; -static snd_pcm_uframes_t chunk; - -static int -audio_open(void) -{ - int err; - if ((err = snd_pcm_open(&pcm,pcm_name,SND_PCM_STREAM_PLAYBACK,0)) < 0) - { - fprintf(stderr,"Cannot open %s:%s",pcm_name,snd_strerror(err)); - return 0; - } - else - { - unsigned int want = samp_rate; - int dir = 0; - snd_pcm_hw_params_malloc(&hwparams); - snd_pcm_hw_params_any(pcm,hwparams); - /* Check capabilities */ - if ((err = snd_pcm_hw_params_set_access(pcm, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) - { - fprintf(stderr,"Cannot set access %s:%s",pcm_name,snd_strerror(err)); - return 0; - } - /* Set sample format */ - if ((err=snd_pcm_hw_params_set_format(pcm, hwparams, SND_PCM_FORMAT_S16)) < 0) - { - fprintf(stderr,"Error setting format %s:%s",pcm_name,snd_strerror(err)); - return(0); - } -#ifdef ALSA_PCM_OLD_HW_PARAMS_API - want = snd_pcm_hw_params_set_rate_near(pcm, hwparams, want, &dir); -#else - err = snd_pcm_hw_params_set_rate_near(pcm, hwparams, &want, &dir); -#endif - if (dir != 0 || want != samp_rate) - { - fprintf(stderr,"Wanted %ldHz, got %uHz (%d)",samp_rate,want,dir); - samp_rate = want; - } - if ((err=snd_pcm_hw_params_set_channels(pcm, hwparams, 1)) < 0) - { - fprintf(stderr,"Error setting channels %s:%s",pcm_name,snd_strerror(err)); - return(0); - } - /* Apply HW parameter settings to */ - /* PCM device and prepare device */ - if ((err=snd_pcm_hw_params(pcm, hwparams)) < 0) - { - fprintf(stderr,"Error setting parameters %s:%s",pcm_name,snd_strerror(err)); - return(0); - } -#ifdef ALSA_PCM_OLD_HW_PARAMS_API - chunk = snd_pcm_hw_params_get_buffer_size (hwparams); -#else - snd_pcm_hw_params_get_buffer_size (hwparams,&chunk); -#endif - return 1; - } -} - -int -audio_init(int argc, char *argv[]) -{ - int rate_set = 0; - int use_audio = 1; - - prog = argv[0]; - - argc = getargs("ALSA Sound driver",argc, argv, - "r", "%d", &rate_set, "Sample rate", - "A", "default", &pcm_name, "Device", - "a", NULL, &use_audio, "Audio enable", - NULL); - - if (help_only) - return argc; - - if (rate_set) - samp_rate = rate_set; - - if (use_audio) - audio_open(); - - return argc; -} - -void -audio_term(void) -{ - /* Finish linear file */ - if (linear_fd >= 0) - { - ftruncate(linear_fd, lseek(linear_fd, 0L, SEEK_CUR)); - close(linear_fd); - linear_fd = -1; - } - - /* Close audio system */ - if (pcm) - { - int err = snd_pcm_drain(pcm); - if (err < 0) - { - fprintf(stderr,"%s:%s\n",pcm_name,snd_strerror(err)); - } - if ((err = snd_pcm_close(pcm)) < 0) - { - fprintf(stderr,"%s:%s\n",pcm_name,snd_strerror(err)); - } - pcm = 0; - } - - if (hwparams) - { - snd_pcm_hw_params_free(hwparams); - hwparams = 0; - } -} - -void -audio_play(int n, short *data) -{ - if (n > 0) - { - if (linear_fd >= 0) - { - if (write(linear_fd, data, n) != n) - perror("write"); - } - if (pcm) - { - snd_pcm_sframes_t ret; - while (n > 0) - { - size_t amount = ((size_t) n > chunk) ? chunk : (size_t) n; - while ((ret = snd_pcm_writei(pcm, data, amount)) < 0) - { - /* Pipe may well drain - but harmless as we write - whole words to the pipe - */ - if (ret != -EPIPE) - { - fprintf(stderr,"%s:%s\n",pcm_name,snd_strerror(ret)); - } - snd_pcm_prepare(pcm); - } - n -= ret; - data += ret; - } - } - } -} diff --git a/stella/src/emucore/rsynth/config/config.win32 b/stella/src/emucore/rsynth/config/config.win32 deleted file mode 100644 index 0b8c7c1a3..000000000 --- a/stella/src/emucore/rsynth/config/config.win32 +++ /dev/null @@ -1,103 +0,0 @@ -/* config.h. Generated automatically by configure. */ -/* config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define to empty if the keyword does not work. */ -/* #undef const */ - -/* Define to `long' if doesn't define. */ -/* #undef off_t */ - -/* Define if you need to in order for stat and other things to work. */ -/* #undef _POSIX_SOURCE */ - -/* Define as the return type of signal handlers (int or void). */ -#define RETSIGTYPE void - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if prototype cannot use a type of float if followed by K&R defn. */ -#define NOPROTOFLOAT 1 - -/* turn off strict IEEE compliance in favour of speed */ -/* #undef HAVE_NONSTDARITH */ - - -/* Define if we can find -lX11 */ -#define HAVE_LIBX11 1 - - -/* Define if we can find nas -laudio */ -/* #define HAVE_NAS 1 */ - -/* Define if we can find /dev/dsp - linux/FreeBSD */ -/* #undef HAVE_DEV_DSP */ - -/* Define if we can find /dev/sbdsp - linux (older drivers) */ -/* #undef HAVE_DEV_SBDSP */ - -/* Define if you have the memcpy function. */ -/* #undef HAVE_MEMCPY */ - -/* Define if you have the strchr function. */ -/* #undef HAVE_STRCHR */ - -/* Define if you have the