[PD-cvs] externals/august/readanysf~/include Fifo.h, NONE, 1.1 Input.h, NONE, 1.1 InputFile.h, NONE, 1.1 InputStream.h, NONE, 1.1 Makefile, NONE, 1.1 Makefile.am, NONE, 1.1 Makefile.in, NONE, 1.1 ReadFlac.h, NONE, 1.1 ReadFlac.h.seekable, NONE, 1.1 ReadMad.h, NONE, 1.1 ReadRaw.h, NONE, 1.1 ReadVorbis.h, NONE, 1.1 Readsf.h, NONE, 1.1 generic.h, NONE, 1.1 main.h, NONE, 1.1 stamp-h2.in, NONE, 1.1

B. Bogart bbogart at users.sourceforge.net
Sat Aug 13 03:17:01 CEST 2005


Update of /cvsroot/pure-data/externals/august/readanysf~/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26207/include

Added Files:
	Fifo.h Input.h InputFile.h InputStream.h Makefile Makefile.am 
	Makefile.in ReadFlac.h ReadFlac.h.seekable ReadMad.h ReadRaw.h 
	ReadVorbis.h Readsf.h generic.h main.h stamp-h2.in 
Log Message:
Initial commit of readanysf~ 0.13.1 for August


--- NEW FILE: Fifo.h ---
#ifndef _FIFO_H_
#define _FIFO_H_

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif


#include <memory.h>
#include <pthread.h>

class Fifo
{
 public:
  Fifo();
  Fifo(unsigned int size);
  ~Fifo();
  void Flush();
  int IsAlloc(void) { return astate; }
  int ReAlloc(unsigned int size);
  void * Read(void *buf, unsigned int &len);
  int Write(void *buf, unsigned int len);
  unsigned int FreeSpace(void);
  unsigned int UsedSpace(void);
 private:
  char *buffer;
  unsigned int astate;
  unsigned int totsize, start, datasize;
  pthread_mutex_t mut;
};
#endif

--- NEW FILE: Input.h ---
#ifndef _INPUT_H_
#define _INPUT_H_

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <sys/types.h>		// open
#include <sys/stat.h>		// open
#include <fcntl.h>		// open
#include <unistd.h>		// read
#include <netdb.h>		// for gethostbyname
#include <sys/socket.h>		// socket

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>


#include <string>  // save filename
using namespace std;
#include "generic.h"

class Input {
 public:
  Input();
  virtual ~ Input();
  
  virtual int Open(const char *pathname);	// open file or stream and return formt
  virtual int Close();	// close or disconnect
  virtual int Read(void *buf, unsigned int count);	//read into buf count times.
  
  virtual long SeekSet(long offset);	// lseek using SEEK_SET
  virtual long SeekCur(long offset);	// lseek using SEEK_CUR
  virtual long SeekEnd(long offset);	// lseek using SEEK_END
  //int getEof() { return  eof(fd); }
  virtual float get_cachesize();      // return amount of buffer that is used.  0.0 for InputFile
  
  virtual bool get_recover( ) { return recover; }
  void set_recover( bool x) { recover =x;}
  

  void SetVerbosity(int d) { verbosity = d; } // set debug level 0-3 protected:
  int get_fd() { return fd;}
  int get_format() { return format;}
  const char * get_filename() { return filename.c_str(); }
  
 protected:
  int fd;			//file descriptor for files and sockets
  int format;		//what format?  OGG,MP3,NEXT etc. see defines above
  int verbosity;	//how much debugging/info to print
  //we need to be able to set this dynamically for http 
  bool recover;        // whether to recover connections on the net 
  string filename;    // store the path/filename of what is opened for reading
};
#endif

--- NEW FILE: Makefile.in ---
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am

# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.


SHELL = @SHELL@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@

bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include

DESTDIR =

pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@

top_builddir = ..

ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@

NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AS = @AS@
CC = @CC@
CXX = @CXX@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
EXEEXT = @EXEEXT@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
NO_PREFIX_PACKAGE_DATA_DIR = @NO_PREFIX_PACKAGE_DATA_DIR@
NO_PREFIX_PACKAGE_DOC_DIR = @NO_PREFIX_PACKAGE_DOC_DIR@
NO_PREFIX_PACKAGE_HELP_DIR = @NO_PREFIX_PACKAGE_HELP_DIR@
NO_PREFIX_PACKAGE_MENU_DIR = @NO_PREFIX_PACKAGE_MENU_DIR@
NO_PREFIX_PACKAGE_PIXMAPS_DIR = @NO_PREFIX_PACKAGE_PIXMAPS_DIR@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_DATA_DIR = @PACKAGE_DATA_DIR@
PACKAGE_DOC_DIR = @PACKAGE_DOC_DIR@
PACKAGE_HELP_DIR = @PACKAGE_HELP_DIR@
PACKAGE_MENU_DIR = @PACKAGE_MENU_DIR@
PACKAGE_PIXMAPS_DIR = @PACKAGE_PIXMAPS_DIR@
RANLIB = @RANLIB@
STRIP = @STRIP@
VERSION = @VERSION@

readanysf_includedir = $(pkgincludedir)

readanysf_include_DATA =  	Fifo.h 	Input.h 	InputFile.h 	InputStream.h 	Readsf.h 	ReadRaw.h 	generic.h 	main.h 	ReadMad.h 	ReadVorbis.h


EXTRA_DIST = $(readanysf_include_DATA)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES = 
DATA =  $(readanysf_include_DATA)

DIST_COMMON =  Makefile.am Makefile.in


DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)

TAR = tar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
	cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile

Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
	cd $(top_builddir) \
	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status


install-readanysf_includeDATA: $(readanysf_include_DATA)
	@$(NORMAL_INSTALL)
	$(mkinstalldirs) $(DESTDIR)$(readanysf_includedir)
	@list='$(readanysf_include_DATA)'; for p in $$list; do \
	  if test -f $(srcdir)/$$p; then \
	    echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(readanysf_includedir)/$$p"; \
	    $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(readanysf_includedir)/$$p; \
	  else if test -f $$p; then \
	    echo " $(INSTALL_DATA) $$p $(DESTDIR)$(readanysf_includedir)/$$p"; \
	    $(INSTALL_DATA) $$p $(DESTDIR)$(readanysf_includedir)/$$p; \
	  fi; fi; \
	done

uninstall-readanysf_includeDATA:
	@$(NORMAL_UNINSTALL)
	list='$(readanysf_include_DATA)'; for p in $$list; do \
	  rm -f $(DESTDIR)$(readanysf_includedir)/$$p; \
	done
tags: TAGS
TAGS:


distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)

subdir = include

distdir: $(DISTFILES)
	here=`cd $(top_builddir) && pwd`; \
	top_distdir=`cd $(top_distdir) && pwd`; \
	distdir=`cd $(distdir) && pwd`; \
	cd $(top_srcdir) \
	  && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu include/Makefile
	@for file in $(DISTFILES); do \
	  d=$(srcdir); \
	  if test -d $$d/$$file; then \
	    cp -pr $$d/$$file $(distdir)/$$file; \
	  else \
	    test -f $(distdir)/$$file \
	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
	    || cp -p $$d/$$file $(distdir)/$$file || :; \
	  fi; \
	done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am

install-data-am: install-readanysf_includeDATA
install-data: install-data-am

install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-readanysf_includeDATA
uninstall: uninstall-am
all-am: Makefile $(DATA)
all-redirect: all-am
install-strip:
	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
	$(mkinstalldirs)  $(DESTDIR)$(readanysf_includedir)


mostlyclean-generic:

clean-generic:

distclean-generic:
	-rm -f Makefile $(CONFIG_CLEAN_FILES)
	-rm -f config.cache config.log stamp-h stamp-h[0-9]*

maintainer-clean-generic:
mostlyclean-am:  mostlyclean-generic

mostlyclean: mostlyclean-am

clean-am:  clean-generic mostlyclean-am

clean: clean-am

distclean-am:  distclean-generic clean-am
	-rm -f libtool

distclean: distclean-am

maintainer-clean-am:  maintainer-clean-generic distclean-am
	@echo "This command is intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."

maintainer-clean: maintainer-clean-am

.PHONY: uninstall-readanysf_includeDATA install-readanysf_includeDATA \
tags distdir info-am info dvi-am dvi check check-am installcheck-am \
installcheck install-exec-am install-exec install-data-am install-data \
install-am install uninstall-am uninstall all-redirect all-am all \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean


# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

--- NEW FILE: InputStream.h ---
#ifndef _INPUTSTREAM_H_
#define _INPUTSTREAM_H_

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "Input.h"
#include "Fifo.h"

#include <string>
#include <pthread.h>
#include <dlfcn.h>


#include <sys/types.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#ifdef UNIX
#include <sys/time.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#define SOCKET_ERROR -1
#else
#include <winsock.h>
#endif

using namespace std;

class InputStream : public Input {
 public:
  InputStream ();
  virtual ~InputStream();
  
  virtual int Open( const char *pathname );
  virtual int Close();
  virtual int Read( void *buf, unsigned int count );
  
  virtual long SeekSet ( long offset );
  virtual long SeekCur ( long offset );
  virtual long SeekEnd ( long offset );
  virtual float get_cachesize(); 
  virtual bool get_recover( ) { return recover; }
 
  pthread_mutex_t *get_mutex() { return &mut;}
  pthread_cond_t *get_condition(){ return &cond;}
  
  void set_threaded( bool b ) { threaded = b;} 
  
  Fifo * get_fifo() { return infifo;}
  bool get_quit() { return quit;}
  
  int socket_connect ( ); 

 private:
  //int socket_connect (string hostname, string mountpoint, int portno); 
  //int socket_connect (char *hostname, char *mountpoint, int portno);  
  // connects to socket and checks for ice or shout
  // returns type of stream(ogg, mp3) or -1 for failure
  
  string ParseHttp( string str, string parse ); // parse x-audio* vars from icecast
  int SetUrl (const char *url);  	// breaks http://server:port/mount down to hostname,port,mountpoint
  // return 1 for success, 0 for failure
  
  int get_line( char * str, int sock, int maxget);
  
  Fifo *infifo;		// fifo for thread buffering
  string hostname;    // hostname of URL
  string mountpoint;  // mountpoint for Icecast URL
  int port;			// port number URL
  bool threaded;		// if thread is running or not, true if running 
  bool quit;			// if we should quit thread or not
  
  pthread_mutex_t mut;
  pthread_cond_t cond;
  pthread_t childthread;
  
};
#endif

--- NEW FILE: ReadVorbis.h ---
/*
 * readanysf~  external for pd. 
 * 
 * Copyright (C) 2003 August Black
 *
 * This program 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 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * ReadVorbisUrl.h
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#ifdef READ_VORBIS

#ifndef _READVORBISURL_H_
#define _READVORBISURL_H_

#include "Readsf.h"
#include "generic.h"

extern "C" {
#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>
}

#include <sys/types.h>
#include <ctype.h>
#include <string.h>

#include <stdio.h>
#include <errno.h>
#include <fcntl.h>

//#include <stdlib.h>
//#include <math.h>

#ifdef NT
#include <io.h> /* for 'write' in pute-function only */
#include <winsock.h>
#include <winbase.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/time.h>
#include <unistd.h>
#define SOCKET_ERROR -1
#endif



//#define VSTREAM_FIFOSIZE (32 * 1024)
//#define VSTREAM_BUFFERSIZE (4 * 1024)
//#define VSOCKET_READSIZE 1024
//#define     STRBUF_SIZE             1024


class ReadVorbis : public Readsf {
 private:

  OggVorbis_File vf;
  ov_callbacks callbacks;
  
  static size_t read_func(void *ptr, size_t size, size_t nmemb, void *datasource);
  static int seek_func(void *datasource, ogg_int64_t offset, int whence);
  static int close_func(void *datasource);
  static long tell_func(void *datasource);
  bool seekable;

 public:
  ReadVorbis( Input *input );
  virtual ~ReadVorbis();
  virtual bool Initialize();
  virtual int Decode(float *buffer, int size);
  virtual bool Rewind();
  virtual bool PCM_seek(long bytes);
  virtual bool TIME_seek(double seconds);
  bool is_seekable() { return seekable;};

};

#endif
#endif //ifdef READVORBIS

--- NEW FILE: generic.h ---
#ifndef _GENERIC_H_
#define _GENERIC_H_


#define FLOATSIZE sizeof(float)
#define SHORTSIZE sizeof(short)
#define CHUNKSIZE 4096*FLOATSIZE
#define WAVCHUNKSIZE 1024
//#define MAD_CHUNKSIZE 2016*FLOATSIZE //576
#define INOUTSIZE (CHUNKSIZE*4)+1

#define FIFOSIZE (CHUNKSIZE*16)
#define FIFOSECONDS (FIFOSIZE/FLOATSIZE/44100) //assume samplerate
#define READBUFFER (1024*16)

#define R_NOTHING   0
#define R_OPEN      1
#define R_CLOSE     2
#define R_QUIT      3
#define R_PROCESS   4
#define R_STOP      5 

#define STATE_IDLE			0
#define STATE_STARTUP		1
#define STATE_STREAM		2
#define STATE_IDLE_CLOSED	3

#define FORMAT_WAVE         0
#define FORMAT_AIFF         1
#define FORMAT_NEXT         2
#define FORMAT_VORBIS       3
#define FORMAT_MAD          4
#define FORMAT_FLAC         5
#define FORMAT_HTTP_MP3     6
#define FORMAT_HTTP_VORBIS  7



#define STREAM_FIFOSIZE       (32 * 1152)
#define SOCKET_READSIZE       1024 //1152/4
#define     sys_closesocket close  // windows uses sys_closesocket 
#define     STRBUF_SIZE             1024

//#define STREAM_BUFFERSIZE (4 * 1152)
//#define FRAME_RESERVE 2000
//#define     STRDUP strdup

#endif

--- NEW FILE: InputFile.h ---
#ifndef _INPUTFILE_H_
#define _INPUTFILE_H_

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif


#include "Input.h"

class InputFile : public Input {
 public:
  InputFile();
  virtual ~InputFile();
  
  virtual int Open( const char *pathname );
  virtual int Close();
  virtual int Read( void *buf, unsigned int count );
  
  virtual long SeekSet ( long offset );
  virtual long SeekCur ( long offset );
  virtual long SeekEnd ( long offset );
  virtual float get_cachesize() { return 0.0; }; 
  virtual bool get_recover( ) { return false; }
 private:
		 	
	
};
#endif

--- NEW FILE: Makefile ---
# Generated automatically from Makefile.in by configure.
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am

# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.


SHELL = /bin/sh

srcdir = .
top_srcdir = ..
prefix = /usr/local
exec_prefix = ${prefix}

bindir = ${exec_prefix}/bin
sbindir = ${exec_prefix}/sbin
libexecdir = ${exec_prefix}/libexec
datadir = ${prefix}/share
sysconfdir = ${prefix}/etc
sharedstatedir = ${prefix}/com
localstatedir = ${prefix}/var
libdir = ${exec_prefix}/lib
infodir = ${prefix}/info
mandir = ${prefix}/man
includedir = ${prefix}/include
oldincludedir = /usr/include

DESTDIR =

pkgdatadir = $(datadir)/readanysf
pkglibdir = $(libdir)/readanysf
pkgincludedir = $(includedir)/readanysf

top_builddir = ..

ACLOCAL = aclocal-1.4
AUTOCONF = autoconf
AUTOMAKE = automake-1.4
AUTOHEADER = autoheader

INSTALL = /bin/install -c
INSTALL_PROGRAM = ${INSTALL} $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_SCRIPT = ${INSTALL_PROGRAM}
transform = s,x,x,

NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = i686-pc-linux-gnu
host_triplet = i686-pc-linux-gnu
AS = @AS@
CC = gcc
CXX = g++
DLLTOOL = @DLLTOOL@
ECHO = echo
EXEEXT = 
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LN_S = ln -s
MAKEINFO = makeinfo
NO_PREFIX_PACKAGE_DATA_DIR = share/readanysf
NO_PREFIX_PACKAGE_DOC_DIR = doc/readanysf
NO_PREFIX_PACKAGE_HELP_DIR = share/readanysf/help
NO_PREFIX_PACKAGE_MENU_DIR = share/readanysf
NO_PREFIX_PACKAGE_PIXMAPS_DIR = share/readanysf/pixmaps
OBJDUMP = @OBJDUMP@
OBJEXT = o
PACKAGE = readanysf
PACKAGE_DATA_DIR = /usr/local/share/readanysf
PACKAGE_DOC_DIR = /usr/local/doc/readanysf
PACKAGE_HELP_DIR = /usr/local/share/readanysf/help
PACKAGE_MENU_DIR = /usr/local/share/readanysf
PACKAGE_PIXMAPS_DIR = /usr/local/share/readanysf/pixmaps
RANLIB = ranlib
STRIP = strip
VERSION = 0.13

readanysf_includedir = $(pkgincludedir)

readanysf_include_DATA =  	Fifo.h 	Input.h 	InputFile.h 	InputStream.h 	Readsf.h 	ReadRaw.h 	generic.h 	main.h 	ReadMad.h 	ReadVorbis.h


EXTRA_DIST = $(readanysf_include_DATA)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES = 
DATA =  $(readanysf_include_DATA)

DIST_COMMON =  Makefile.am Makefile.in


DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)

TAR = tar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
	cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile

Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
	cd $(top_builddir) \
	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status


install-readanysf_includeDATA: $(readanysf_include_DATA)
	@$(NORMAL_INSTALL)
	$(mkinstalldirs) $(DESTDIR)$(readanysf_includedir)
	@list='$(readanysf_include_DATA)'; for p in $$list; do \
	  if test -f $(srcdir)/$$p; then \
	    echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(readanysf_includedir)/$$p"; \
	    $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(readanysf_includedir)/$$p; \
	  else if test -f $$p; then \
	    echo " $(INSTALL_DATA) $$p $(DESTDIR)$(readanysf_includedir)/$$p"; \
	    $(INSTALL_DATA) $$p $(DESTDIR)$(readanysf_includedir)/$$p; \
	  fi; fi; \
	done

uninstall-readanysf_includeDATA:
	@$(NORMAL_UNINSTALL)
	list='$(readanysf_include_DATA)'; for p in $$list; do \
	  rm -f $(DESTDIR)$(readanysf_includedir)/$$p; \
	done
tags: TAGS
TAGS:


distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)

subdir = include

distdir: $(DISTFILES)
	here=`cd $(top_builddir) && pwd`; \
	top_distdir=`cd $(top_distdir) && pwd`; \
	distdir=`cd $(distdir) && pwd`; \
	cd $(top_srcdir) \
	  && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu include/Makefile
	@for file in $(DISTFILES); do \
	  d=$(srcdir); \
	  if test -d $$d/$$file; then \
	    cp -pr $$d/$$file $(distdir)/$$file; \
	  else \
	    test -f $(distdir)/$$file \
	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
	    || cp -p $$d/$$file $(distdir)/$$file || :; \
	  fi; \
	done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am

install-data-am: install-readanysf_includeDATA
install-data: install-data-am

install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-readanysf_includeDATA
uninstall: uninstall-am
all-am: Makefile $(DATA)
all-redirect: all-am
install-strip:
	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
	$(mkinstalldirs)  $(DESTDIR)$(readanysf_includedir)


mostlyclean-generic:

clean-generic:

distclean-generic:
	-rm -f Makefile $(CONFIG_CLEAN_FILES)
	-rm -f config.cache config.log stamp-h stamp-h[0-9]*

maintainer-clean-generic:
mostlyclean-am:  mostlyclean-generic

mostlyclean: mostlyclean-am

clean-am:  clean-generic mostlyclean-am

clean: clean-am

distclean-am:  distclean-generic clean-am
	-rm -f libtool

distclean: distclean-am

maintainer-clean-am:  maintainer-clean-generic distclean-am
	@echo "This command is intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."

maintainer-clean: maintainer-clean-am

.PHONY: uninstall-readanysf_includeDATA install-readanysf_includeDATA \
tags distdir info-am info dvi-am dvi check check-am installcheck-am \
installcheck install-exec-am install-exec install-data-am install-data \
install-am install uninstall-am uninstall all-redirect all-am all \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean


# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

--- NEW FILE: ReadMad.h ---
/*
 * readanysf~  external for pd. 
 * 
 * Copyright (C) 2003 August Black
 *
 * This program 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 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * ReadMad.cpp  || much code studied from Andy Lo-A-Foe <www.alsaplayer.org>
 */


#ifdef HAVE_CONFIG_H
#include <config.h>
#endif


#ifdef READ_MAD

#ifndef _READMAD_H_
#define _READMAD_H_

#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>


#define MAD_BUFSIZE (4 * 1024)
#define XING_MAGIC    (('X' << 24) | ('i' << 16) | ('n' << 8) | 'g')

extern "C" { 	
#include <mad.h>
}

//#include "xing.h"
#include "Readsf.h"
#include "Input.h"


#define FRAME_RESERVE	2000


struct xing {
  long flags;			/* valid fields (see below) */
  unsigned long frames;		/* total number of frames */
  unsigned long bytes;		/* total number of bytes */
  unsigned char toc[100];	/* 100-point seek table */
  long scale;			/* ?? */
};

enum {
  XING_FRAMES = 0x00000001L,
  XING_BYTES  = 0x00000002L,
  XING_TOC    = 0x00000004L,
  XING_SCALE  = 0x00000008L
};

# define xing_finish(xing)	/* nothing */


class ReadMad : public Readsf {

 private:
  //FILE *mad_fd;
  uint8_t mad_map[MAD_BUFSIZE];
  long map_offset;
  int bytes_avail;

  struct mad_synth  synth; 
  struct mad_stream stream;
  struct mad_frame  frame;
  mad_timer_t timer;
  struct xing xing;

  int mad_init;
  ssize_t offset;
  ssize_t filesize;
  //  int samplerate;
  int bitrate;
  int samplesperframe;
  long samplestotal;
  long time;
  int seekable;
  int nr_frames;

  //float my_scale(mad_fixed_t sample);
  bool fill_buffer( );
  bool fill_buffer( long newoffset );
  int mad_frame_seek( int frame );
  ssize_t find_initial_frame(uint8_t *buf, int size);
  void seek_bytes(long byte_offset);
  
  void xing_init(struct xing *);
  int xing_parse(struct xing *, struct mad_bitptr, unsigned int);

 public:
  ReadMad();
  ReadMad( Input *input );
  virtual ~ReadMad();
  virtual bool Initialize();
  virtual int Decode(float *buffer, int size);
  virtual bool Rewind();
  virtual bool PCM_seek(long bytes);
  virtual bool TIME_seek(double seconds);  
};		

#endif
#endif //ifdef READ_MAD

--- NEW FILE: Makefile.am ---
## Process this file with automake to produce Makefile.in

## Created by Anjuta - will be overwritten
## If you don't want it to overwrite it,
## 	Please disable it in the Anjuta project configuration

readanysf_includedir = $(pkgincludedir)

readanysf_include_DATA = \
	Fifo.h\
	Input.h\
	InputFile.h\
	InputStream.h\
	Readsf.h\
	ReadRaw.h\
	generic.h\
	main.h\
	ReadMad.h\
	ReadVorbis.h

EXTRA_DIST = $(readanysf_include_DATA)

--- NEW FILE: Readsf.h ---
/*
 * readanysf~  external for pd. 
 * 
 * Copyright (C) 2003 August Black
 *
 * This program 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 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Readsf.h
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#ifndef _READSF_H_
#define _READSF_H_

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "Input.h"

class Readsf  {

private:


 public:
  Readsf();
  Readsf( Input *input );
  
  virtual ~Readsf();
  virtual bool Initialize();
  virtual int Decode(float *buffer, int size);
  virtual bool Rewind();
  virtual bool PCM_seek(long bytes);
  virtual bool TIME_seek(double seconds);
  double get_samplerate() { return samplerate;}
  int get_channels() { return num_channels;}
  float get_lengthinseconds() { return lengthinseconds; }

 protected:
  Input *in;
  double samplerate;
  int num_channels;
  float lengthinseconds;
  bool eof;
};

#endif

--- NEW FILE: main.h ---
/*
 * readanysf~  external for pd. 
 * 
 * Copyright (C) 2003 August Black
 *
 * This program 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 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * main.h
 */


#ifdef HAVE_CONFIG_H
#include <config.h>
#endif


#include <flext.h>
#include <stdio.h>


extern "C" {
#include <samplerate.h>  //libsamplerate
}

#include "Readsf.h"
#include "ReadRaw.h"
#ifdef READ_VORBIS
#include "ReadVorbis.h"
#endif
#ifdef READ_MAD
#include "ReadMad.h"
#endif
#ifdef READ_MAD_URL
#include "ReadMadUrl.h"
#endif
#ifdef READ_FLAC
#include "ReadFlac.h"
#endif

#include "Fifo.h"
#include "generic.h"
#include "Input.h"
#include "InputFile.h"
#include "InputStream.h"

// check for appropriate flext version
#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
#error You need at least flext version 0.4.0
#endif


class readanysf: public flext_dsp
{
  // obligatory flext header (class name,base class name)
  FLEXT_HEADER(readanysf, flext_dsp)

public:
  
  readanysf();
  ~readanysf();

  
protected:
  // here we declare the virtual DSP function
  virtual void m_signal(int n, float *const *in, float *const *out);

  void m_open(t_symbol *s);		// open file Input; set req = R_OPEN
  void m_reopen();		// re open a file Input; set req = R_OPEN
  void m_start();				// set state = S_PROCESS
  void m_pause();				// set state = S_IDLE
  void m_stop();				// set state = S_STATE; cond.signal();

  void m_child();
  void FillFifo();
  
  //void m_loop_s(t_symbol *s);
  void m_recover(float f);
  void m_loop_f(float f);
  void m_set_tick(int i);
  void m_pcm_seek(int i);
  void m_time_seek(float f);
  void m_src_factor(float f);

  void m_bang();

  int m_resample(int frames);

  int getState();
  int getRequest();
  void setState(int i);
  void setRequest(int i);
  void setSys(int state, int request);
private:
  FLEXT_CALLBACK_S(m_open)     
  FLEXT_CALLBACK(m_reopen)     


  FLEXT_CALLBACK_F(m_loop_f)     
  FLEXT_CALLBACK_F(m_recover)     
  FLEXT_CALLBACK_I(m_set_tick)     
  FLEXT_CALLBACK(m_start)     
  FLEXT_CALLBACK(m_pause)     
  FLEXT_CALLBACK(m_stop)     

  FLEXT_CALLBACK_I(m_pcm_seek)     
  FLEXT_CALLBACK_F(m_time_seek)

  FLEXT_CALLBACK_F(m_src_factor)     

  FLEXT_THREAD(m_child)
  FLEXT_CALLBACK(m_bang)


  Readsf *readsf;
  ThrCond cond;
  ThrMutex sysmut;
  ThrMutex varmutex;
  Fifo *fifo;
  Input *in;
  int format;
  int outtick, counttick;
  int fifosecondsize;

  volatile int state, request;
  volatile bool loop, eof, quit, sendout;
  volatile float floatmsg, cachemsg, lengthinseconds;
  
  char filename[1024];
  int num_channels;
  double samplerate;

  volatile long pcmseek;
  volatile double timeseek;

  float read_buffer[READBUFFER];
  float pd_buffer[1024*2*FLOATSIZE];

  ///Secret Rabbit Code stuff
  int src_channels;
  float *src_buffer;
  SRC_STATE * src_state;
  SRC_DATA  src_data;
  double src_factor;
  int src_error;
  int src_mode;
};

--- NEW FILE: stamp-h2.in ---

--- NEW FILE: ReadRaw.h ---
/*
 * readanysf~  external for pd. 
 * 
 * Copyright (C) 2003 August Black
 *
 * This program 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 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * ReadRaw.h
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif


#ifndef _READRAW_H_
#define _READRAW_H_

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "Readsf.h"

typedef struct _nextstep
{
    char ns_fileid[4];      /* magic number '.snd' if file is big-endian */
    unsigned int ns_onset;        /* byte offset of first sample */
    unsigned int ns_length;       /* length of sound in bytes */
    unsigned int ns_format;        /* format; see below */
    unsigned int ns_sr;           /* sample rate */
    unsigned int ns_nchans;       /* number of channels */
    char ns_info[4];        /* comment */
} t_nextstep;

typedef struct _wave
{
    char  w_fileid[4];	    	    /* chunk id 'RIFF'            */
    unsigned int w_chunksize;     	    /* chunk size                 */
    char  w_waveid[4];	    	    /* wave chunk id 'WAVE'       */
    char  w_fmtid[4];	    	    /* format chunk id 'fmt '     */
    unsigned int w_fmtchunksize;   	    /* format chunk size          */
    unsigned short  w_fmttag;	    	    /* format tag, 1 for PCM      */
    unsigned short  w_nchannels;    	    /* number of channels         */
    unsigned int w_samplespersec;  	    /* sample rate in hz          */
    unsigned int w_navgbytespersec; 	    /* average bytes per second   */
    unsigned short  w_nblockalign;    	    /* number of bytes per frame  */
    unsigned short  w_nbitspersample; 	    /* number of bits in a sample */
    char  w_datachunkid[4]; 	    /* data chunk id 'data'       */
    unsigned int w_datachunksize;         /* length of data chunk       */
} t_wave;

typedef struct _fmt	    /* format chunk */
{
    unsigned short f_fmttag;	    	    /* format tag, 1 for PCM      */
    unsigned short f_nchannels;    	    /* number of channels         */
    unsigned int f_samplespersec;  	    /* sample rate in hz          */
    unsigned int f_navgbytespersec; 	    /* average bytes per second   */
    unsigned short f_nblockalign;    	    /* number of bytes per frame  */
    unsigned short f_nbitspersample; 	    /* number of bits in a sample */
} t_fmt;

typedef struct _wavechunk	    /* ... and the last two items */
{
    char  wc_id[4]; 	    	    /* data chunk id, e.g., 'data' or 'fmt ' */
    unsigned int wc_size;         	    /* length of data chunk       */
} t_wavechunk;

/* the AIFF header.  I'm assuming AIFC is compatible but don't really know
    that. */

typedef struct _datachunk
{
    char  dc_id[4]; 	    	    /* data chunk id 'SSND'       */
    unsigned int dc_size;         	    /* length of data chunk       */
} t_datachunk;

typedef struct _comm
{
    unsigned short c_nchannels;	            /* number of channels         */
    unsigned short c_nframeshi;    	    /* # of sample frames (hi)    */
    unsigned short c_nframeslo;    	    /* # of sample frames (lo)    */
    unsigned short c_bitspersamp;  	    /* bits per sample            */
    unsigned char c_samprate[10];   /* sample rate, 80-bit float! */
} t_comm;

    /* this version is more convenient for writing them out: */
typedef struct _aiff
{
    char  a_fileid[4];	    	    /* chunk id 'FORM'            */
    unsigned int a_chunksize;     	    /* chunk size                 */
    char  a_aiffid[4];	    	    /* aiff chunk id 'AIFF'       */
    char  a_fmtid[4];	    	    /* format chunk id 'COMM'     */
    unsigned int a_fmtchunksize;   	    /* format chunk size, 18      */
    unsigned short a_nchannels;	            /* number of channels         */
    unsigned short a_nframeshi;    	    /* # of sample frames (hi)    */
    unsigned short a_nframeslo;    	    /* # of sample frames (lo)    */
    unsigned short a_bitspersamp;  	    /* bits per sample            */
    unsigned char a_samprate[10];   /* sample rate, 80-bit float! */
} t_aiff;


#define NS_FORMAT_LINEAR_16     3
#define NS_FORMAT_LINEAR_24     4
#define NS_FORMAT_FLOAT         6
#define SCALE (1./(1024. * 1024. * 1024. * 2.))


#define AIFFHDRSIZE 38	    /* probably not what sizeof() gives */
#define AIFFPLUS (AIFFHDRSIZE + 8)  /* header size including first chunk hdr */

#define WHDR1 sizeof(t_nextstep)
#define WHDR2 (sizeof(t_wave) > WHDR1 ? sizeof (t_wave) : WHDR1)
#define WRITEHDRSIZE (AIFFPLUS > WHDR2 ? AIFFPLUS : WHDR2)

#define READHDRSIZE (16 > WHDR2 + 2 ? 16 : WHDR2 + 2)


class ReadRaw : public Readsf {
 private:

  long ret;
  unsigned char data[WAVCHUNKSIZE * 4 * 2]; //WAVCHUNKSIZE * bytespersamp * num_channels;
  
  int headersize;
  int bytespersamp;
  int bigendian;
 public:
  ReadRaw ( );
  ReadRaw( Input *input );
  virtual ~ReadRaw();
  virtual bool Initialize();
  virtual int Decode(float *buffer,int size);
  virtual bool Rewind();
  virtual bool PCM_seek(long bytes);
  virtual bool TIME_seek(double seconds);
};





#endif

--- NEW FILE: ReadFlac.h ---
/*
 * readanysf~  external for pd. 
 * 
 * Copyright (C) 2003, 2004 August Black
 *
 * This program 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 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * ReadFlac.h
 */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#ifdef READ_FLAC

#ifndef _READFLAC_H
#define _READFLAC_H

extern "C" {
#include "FLAC/stream_decoder.h"
};

#include "Readsf.h"
#include "generic.h"

class ReadFlac  : public Readsf {
 public:
  ReadFlac( Input *input);
  virtual ~ReadFlac();
  virtual bool Initialize();
  virtual int Decode(float *buffer, int size);
  virtual bool Rewind();
  virtual bool PCM_seek(long bytes);
  virtual bool TIME_seek(double seconds);

 protected:
  bool needs_seek;
  FLAC__uint64 seek_sample;
  unsigned samples_in_reservoir;
  bool abort_flag;
  FLAC__StreamDecoder *decoder;
  FLAC__StreamMetadata streaminfo;
  FLAC__int16 reservoir[FLAC__MAX_BLOCK_SIZE * 2 * 2]; // *2 for max channels, another *2 for overflow
  //unsigned char output[576 * 2 * (16/8)]; // *2 for max channels, (16/8) for max bytes per sample
  
  unsigned lengthInMsec() { return (unsigned)((FLAC__uint64)1000 * streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate); }
 private:
  void ErrorCheck(int state);
  long filelength;
  void cleanup();



  static FLAC__StreamDecoderReadStatus readCallback_(const FLAC__StreamDecoder *decoder, 
							     FLAC__byte buffer[], 
							     unsigned *bytes, 
							     void *client_data);

  static FLAC__StreamDecoderWriteStatus writeCallback_(const FLAC__StreamDecoder *decoder, 
						       const FLAC__Frame *frame, 
						       const FLAC__int32 * const buffer[], 
						       void *client_data);


  static FLAC__bool eofCallback_(const FLAC__StreamDecoder *decoder, void *client_data);

  static void metadataCallback_(const FLAC__StreamDecoder *decoder, 
				const FLAC__StreamMetadata *metadata, 
				void *client_data);
  static void errorCallback_(const FLAC__StreamDecoder *decoder, 
			     FLAC__StreamDecoderErrorStatus status, 
			     void *client_data);
};

#endif
#endif //#ifdef READ_FLAC

--- NEW FILE: ReadFlac.h.seekable ---
/*
 * readanysf~  external for pd. 
 * 
 * Copyright (C) 2003, 2004 August Black
 *
 * This program 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 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * ReadFlac.h
 */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#ifdef READ_FLAC

#ifndef _READFLAC_H
#define _READFLAC_H

extern "C" {
#include "FLAC/seekable_stream_decoder.h"
};

#include "Readsf.h"
#include "generic.h"

class ReadFlac  : public Readsf {
 public:
  ReadFlac( Input *input);
  virtual ~ReadFlac();
  virtual bool Initialize();
  virtual int Decode(float *buffer, int size);
  virtual bool Rewind();
  virtual bool PCM_seek(long bytes);
  virtual bool TIME_seek(double seconds);

 protected:
  bool needs_seek;
  FLAC__uint64 seek_sample;
  unsigned samples_in_reservoir;
  bool abort_flag;
  FLAC__SeekableStreamDecoder *decoder;
  FLAC__StreamMetadata streaminfo;
  FLAC__int16 reservoir[FLAC__MAX_BLOCK_SIZE * 2 * 2]; // *2 for max channels, another *2 for overflow
  //unsigned char output[576 * 2 * (16/8)]; // *2 for max channels, (16/8) for max bytes per sample
  
  unsigned lengthInMsec() { return (unsigned)((FLAC__uint64)1000 * streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate); }
 private:
  void ErrorCheck(int state);
  long filelength;
  void cleanup();



  static FLAC__SeekableStreamDecoderReadStatus readCallback_(const FLAC__SeekableStreamDecoder *decoder, 
							     FLAC__byte buffer[], 
							     unsigned *bytes, 
							     void *client_data);
  static FLAC__SeekableStreamDecoderSeekStatus seekCallback_(const FLAC__SeekableStreamDecoder *decoder, 
							     FLAC__uint64 absolute_byte_offset, 
							     void *client_data);
  static FLAC__SeekableStreamDecoderTellStatus tellCallback_(const FLAC__SeekableStreamDecoder *decoder, 
							     FLAC__uint64 *absolute_byte_offset, 
							     void *client_data);
  static FLAC__SeekableStreamDecoderLengthStatus lengthCallback_(const FLAC__SeekableStreamDecoder *decoder,
								 FLAC__uint64 *stream_length, 
								 void *client_data);
  static FLAC__bool eofCallback_(const FLAC__SeekableStreamDecoder *decoder, void *client_data);
  static FLAC__StreamDecoderWriteStatus writeCallback_(const FLAC__SeekableStreamDecoder *decoder, 
						       const FLAC__Frame *frame, 
						       const FLAC__int32 * const buffer[], 
						       void *client_data);
  static void metadataCallback_(const FLAC__SeekableStreamDecoder *decoder, 
				const FLAC__StreamMetadata *metadata, 
				void *client_data);
  static void errorCallback_(const FLAC__SeekableStreamDecoder *decoder, 
			     FLAC__StreamDecoderErrorStatus status, 
			     void *client_data);
};

#endif
#endif //#ifdef READ_FLAC





More information about the Pd-cvs mailing list