diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..de16fba --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +VERSION = 0.9.0beta7 +TOP = . +SUBDIRS = ac3dec as10k1 envy24control sb16_csp seq + +all: + @for i in $(SUBDIRS); do cd $(TOP)/$$i; ./cvscompile; cd ..; make -C $$i; done + +alsa-dist: + @mkdir -p $(TOP)/distdir + @for i in $(SUBDIRS); do cd $(TOP)/$$i; ./cvscompile; cd ..; make -C $$i alsa-dist; done + @mv distdir alsa-tools-$(VERSION) + @tar cIf alsa-tools-$(VERSION).tar.bz2 alsa-tools-$(VERSION) + @mv alsa-tools-$(VERSION) distdir + +clean: + rm -rf *~ distdir + @for i in $(SUBDIRS); do make -C $$i clean; done diff --git a/ac3dec/Makefile.am b/ac3dec/Makefile.am index a3d1560..b6c8a4b 100644 --- a/ac3dec/Makefile.am +++ b/ac3dec/Makefile.am @@ -12,8 +12,12 @@ ac3dec_SOURCES = ac3dec.c output.c ac3spdif.c ac3dec_DEPENDENCIES = libac3/libac3.a -EXTRA_DIST = README Changelog TODO plot_spectrum.m autogen.sh\ - output_linux.c output_irix.c output_solaris.c +EXTRA_DIST = README Changelog TODO plot_spectrum.m autogen.sh SUBDIRS = libac3 tools test . +alsa-dist: distdir + @rm -rf ../distdir/ac3dec + @mkdir -p ../distdir/ac3dec + @cp -RLpv $(distdir)/* ../distdir/ac3dec + @rm -rf $(distdir) diff --git a/ac3dec/output_irix.c b/ac3dec/output_irix.c deleted file mode 100644 index 931819b..0000000 --- a/ac3dec/output_irix.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * - * output_irix.c - * - * Copyright (C) Aaron Holtzman - May 1999 - * Port to IRIX by Jim Miller, SGI - Nov 1999 - * - * This file is part of ac3dec, a free Dolby AC-3 stream decoder. - * - * ac3dec is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * ac3dec 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include -#include - -#include - - -typedef signed short sint_16; -typedef unsigned int uint_32; -#include "output.h" - -static int init = 0; -static ALport alport = 0; -static ALconfig alconfig = 0; -static int bytesPerWord = 1; -static int nChannels = 2; - - -/* - * open the audio device for writing to - */ -int output_open(int bits, int rate, int channels) -{ - ALpv params[2]; - int dev = AL_DEFAULT_OUTPUT; - int wsize = AL_SAMPLE_16; - - nChannels = channels; - - if (!init) { - init = 1; - alconfig = alNewConfig(); - - if (alSetQueueSize(alconfig, BUFFER_SIZE) < 0) { - fprintf(stderr, "alSetQueueSize failed: %s\n", - alGetErrorString(oserror())); - return 0; - } - - if (alSetChannels(alconfig, channels) < 0) { - fprintf(stderr, "alSetChannels(%d) failed: %s\n", - channels, alGetErrorString(oserror())); - return 0; - } - - if (alSetDevice(alconfig, dev) < 0) { - fprintf(stderr, "alSetDevice failed: %s\n", - alGetErrorString(oserror())); - return 0; - } - - if (alSetSampFmt(alconfig, AL_SAMPFMT_TWOSCOMP) < 0) { - fprintf(stderr, "alSetSampFmt failed: %s\n", - alGetErrorString(oserror())); - return 0; - } - - alport = alOpenPort("AC3Decode", "w", 0); - if (!alport) { - fprintf(stderr, "alOpenPort failed: %s\n", - alGetErrorString(oserror())); - return 0; - } - - switch (bits) { - case 8: - bytesPerWord = 1; - wsize = AL_SAMPLE_8; - break; - case 16: - bytesPerWord = 2; - wsize = AL_SAMPLE_16; - break; - case 24: - bytesPerWord = 4; - wsize = AL_SAMPLE_24; - break; - default: - printf("Irix audio: unsupported bit with %d\n", bits); - break; - } - - if (alSetWidth(alconfig, wsize) < 0) { - fprintf(stderr, "alSetWidth failed: %s\n", alGetErrorString(oserror())); - return 0; - } - - params[0].param = AL_RATE; - params[0].value.ll = alDoubleToFixed((double)rate); - params[1].param = AL_MASTER_CLOCK; - params[1].value.i = AL_CRYSTAL_MCLK_TYPE; - if ( alSetParams(dev, params, 1) < 0) { - printf("alSetParams() failed: %s\n", alGetErrorString(oserror())); - return 0; - } - } - - printf("I've synced the IRIX code with the mainline blindly.\n Let me know if it works.\n"); - - return 1; -} - -/* - * play the sample to the already opened file descriptor - */ - -void output_play(sint_16* output_samples, uint_32 num_bytes) -{ - alWriteFrames(alport, output_samples, 6 * 256); -} - -void -output_close(void) -{ - alClosePort(alport); - alFreeConfig(alconfig); - alport = 0; - alconfig = 0; - init = 0; -} diff --git a/ac3dec/output_linux.c b/ac3dec/output_linux.c deleted file mode 100644 index 9a467bd..0000000 --- a/ac3dec/output_linux.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * - * output_linux.c - * - * Copyright (C) Aaron Holtzman - May 1999 - * - * This file is part of ac3dec, a free Dolby AC-3 stream decoder. - * - * ac3dec is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * ac3dec 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#if defined(__OpenBSD__) -#include -#elif defined(__FreeBSD__) -#include -#else -#include -#endif -#include - -//this sux...types should go in config.h methinks -typedef signed short sint_16; -typedef unsigned int uint_32; - -#include "output.h" - - -static char dev[] = "/dev/dsp"; -static int fd; - - -/* - * open the audio device for writing to - */ -int output_open(int bits, int rate, int channels) -{ - int tmp; - - /* - * Open the device driver - */ - - fd=open(dev,O_WRONLY); - if(fd < 0) - { - fprintf(stderr,"%s: Opening audio device %s\n", - strerror(errno), dev); - goto ERR; - } - - tmp = channels == 2 ? 1 : 0; - ioctl(fd,SNDCTL_DSP_STEREO,&tmp); - - tmp = bits; - ioctl(fd,SNDCTL_DSP_SAMPLESIZE,&tmp); - - tmp = rate; - ioctl(fd,SNDCTL_DSP_SPEED, &tmp); - - //this is cheating - tmp = 256; -// ioctl(fd,SNDCTL_DSP_SETFRAGMENT,&tmp); - - - - return 1; - -ERR: - if(fd >= 0) { close(fd); } - return 0; -} - -/* - * play the sample to the already opened file descriptor - */ -void output_play(sint_16* output_samples, uint_32 num_bytes) -{ -// if(fd < 0) -// return; - - write(fd,output_samples,1024 * 6); -} - - -void -output_close(void) -{ - close(fd); -} diff --git a/ac3dec/output_solaris.c b/ac3dec/output_solaris.c deleted file mode 100644 index df4e1ed..0000000 --- a/ac3dec/output_solaris.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * - * output_solaris.c - * - * Copyright (C) Aaron Holtzman - May 1999 - * - * This file is part of ac3dec, a free Dolby AC-3 stream decoder. - * - * ac3dec is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * ac3dec 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//FIXME broken solaris headers! -int usleep(unsigned int useconds); - - -//this sux...types should go in config.h methinks -typedef signed short sint_16; -typedef unsigned int uint_32; - -#include "output.h" - -/* Global to keep track of old state */ -static audio_info_t info; -static char dev[] = "/dev/audio"; -static int fd; - - -/* - * open the audio device for writing to - */ -int output_open(int bits, int rate, int channels) -{ - - /* - * Open the device driver - */ - - fd=open(dev,O_WRONLY); - if(fd < 0) - { - fprintf(stderr,"%s: Opening audio device %s\n", - strerror(errno), dev); - goto ERR; - } - fprintf(stderr,"Opened audio device \"%s\"\n",dev); - - /* Setup our parameters */ - AUDIO_INITINFO(&info); - - info.play.sample_rate = rate; - info.play.precision = bits; - info.play.channels = channels; - info.play.buffer_size = 1024; - info.play.encoding = AUDIO_ENCODING_LINEAR; - //info.play.port = AUDIO_SPEAKER; - //info.play.gain = 110; - - /* Write our configuration */ - /* An implicit GETINFO is also performed so we can get - * the buffer_size */ - - if(ioctl(fd, AUDIO_SETINFO, &info) < 0) - { - fprintf(stderr, "%s: Writing audio config block\n",strerror(errno)); - goto ERR; - } - - return 1; - -ERR: - if(fd >= 0) { close(fd); } - return 0; -} - -unsigned long j= 0 ; -/* - * play the sample to the already opened file descriptor - */ -void output_play(sint_16* output_samples, uint_32 num_bytes) -{ - write(fd,&output_samples[0 * 512],1024); - write(fd,&output_samples[1 * 512],1024); - write(fd,&output_samples[2 * 512],1024); - write(fd,&output_samples[3 * 512],1024); - write(fd,&output_samples[4 * 512],1024); - write(fd,&output_samples[5 * 512],1024); -} - - -void -output_close(void) -{ - close(fd); -} - diff --git a/as10k1/Makefile.am b/as10k1/Makefile.am index 682ae2c..6f7a3f4 100644 --- a/as10k1/Makefile.am +++ b/as10k1/Makefile.am @@ -1,5 +1,6 @@ bin_PROGRAMS = as10k1 as10k1_SOURCES = as10k1.c parse.c assemble.c macro.c +noinst_HEADERS = as10k1.h list.h parse.h proto.h types.h EXTRA_DIST = cvscompile output.doc examples/Makefile examples/*.asm dsp: @@ -8,3 +9,9 @@ dsp: clean: rm -rf .deps *~ $(MAKE) -C examples clean + +alsa-dist: distdir + @rm -rf ../distdir/as10k1 + @mkdir -p ../distdir/as10k1 + @cp -RLpv $(distdir)/* ../distdir/as10k1 + @rm -rf $(distdir) diff --git a/cvscompile b/cvscompile new file mode 100644 index 0000000..5b139ec --- /dev/null +++ b/cvscompile @@ -0,0 +1,3 @@ +#!/bin/sh + +make diff --git a/envy24control/Makefile.am b/envy24control/Makefile.am index af36056..088b980 100644 --- a/envy24control/Makefile.am +++ b/envy24control/Makefile.am @@ -7,3 +7,8 @@ EXTRA_DIST = cvscompile clean: rm -rf .deps *~ +alsa-dist: distdir + @rm -rf ../distdir/envy24control + @mkdir -p ../distdir/envy24control + @cp -RLpv $(distdir)/* ../distdir/envy24control + @rm -rf $(distdir) diff --git a/sb16_csp/Makefile.am b/sb16_csp/Makefile.am index 5b00c27..3d8d5d1 100644 --- a/sb16_csp/Makefile.am +++ b/sb16_csp/Makefile.am @@ -8,4 +8,10 @@ man_MANS = cspctl.1 cspctl_SOURCES = cspctl.c -EXTRA_DIST = README COPYING +EXTRA_DIST = README COPYING cspctl.1 + +alsa-dist: distdir + @rm -rf ../distdir/sb16_csp + @mkdir -p ../distdir/sb16_csp + @cp -RLpv $(distdir)/* ../distdir/sb16_csp + @rm -rf $(distdir) diff --git a/sb16_csp/README b/sb16_csp/README index 3426e63..3b28ab5 100644 --- a/sb16_csp/README +++ b/sb16_csp/README @@ -2,7 +2,9 @@ TO COMPILE: 1. install ALSA driver 2. compile with: - 'make' + './configure; make' + or + './cvscompile' 3. install with: 'make install' 4. read cspctl.1 manpage: diff --git a/seq/Makefile b/seq/Makefile new file mode 100644 index 0000000..9de5cda --- /dev/null +++ b/seq/Makefile @@ -0,0 +1,10 @@ +SUBDIRS = sbiload + +all: + @for i in $(SUBDIRS); do cd $$i; ./cvscompile; cd ..; $(MAKE) -C $$i; done + +alsa-dist: + @for i in $(SUBDIRS); do $(MAKE) -C $$i alsa-dist; done + +clean: + @for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done diff --git a/seq/sbiload/Makefile.am b/seq/sbiload/Makefile.am index 9ea6d65..688ab5c 100644 --- a/seq/sbiload/Makefile.am +++ b/seq/sbiload/Makefile.am @@ -9,3 +9,9 @@ bin_PROGRAMS = sbiload sbiload_SOURCES = sbiload.c EXTRA_DIST = README COPYING + +alsa-dist: distdir + @rm -rf ../../distdir/seq/sbiload + @mkdir -p ../../distdir/seq/sbiload + @cp -RLpv $(distdir)/* ../../distdir/seq/sbiload + @rm -rf $(distdir)