00001 /* 00002 diskin2.h: 00003 00004 Copyright (C) 2005 Istvan Varga 00005 00006 This file is part of Csound. 00007 00008 The Csound Library is free software; you can redistribute it 00009 and/or modify it under the terms of the GNU Lesser General Public 00010 License as published by the Free Software Foundation; either 00011 version 2.1 of the License, or (at your option) any later version. 00012 00013 Csound is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with Csound; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 00021 02111-1307 USA 00022 */ 00023 00024 #ifndef CSOUND_DISKIN2_H 00025 #define CSOUND_DISKIN2_H 00026 00027 #include <sndfile.h> 00028 00029 #define DISKIN2_MAXCHN 24 /* for consistency with soundin */ 00030 #define POS_FRAC_SHIFT 28 /* allows pitch accuracy of 2^-28 */ 00031 #define POS_FRAC_SCALE 0x10000000 00032 #define POS_FRAC_MASK 0x0FFFFFFF 00033 00034 typedef struct { 00035 OPDS h; 00036 MYFLT *aOut[DISKIN2_MAXCHN]; 00037 MYFLT *iFileCode; 00038 MYFLT *kTranspose; 00039 MYFLT *iSkipTime; 00040 MYFLT *iWrapMode; 00041 MYFLT *iSampleFormat; 00042 MYFLT *iWinSize; 00043 MYFLT *iBufSize; 00044 MYFLT *iSkipInit; 00045 /* ------------------------------------- */ 00046 int initDone; 00047 int nChannels; 00048 int bufSize; /* in sample frames, power of two */ 00049 int wrapMode; 00050 long fileLength; /* in sample frames */ 00051 long bufStartPos; 00052 int64_t pos_frac; /* type should be defined in sysdep.h */ 00053 int64_t pos_frac_inc; 00054 long prvBufStartPos; 00055 long winSize; 00056 MYFLT *buf; 00057 MYFLT *prvBuf; 00058 MYFLT prv_kTranspose; 00059 MYFLT winFact; 00060 double warpScale; 00061 SNDFILE *sf; 00062 FDCH fdch; 00063 AUXCH auxData; /* for dynamically allocated buffers */ 00064 } DISKIN2; 00065 00066 int diskin2_init(CSOUND *csound, DISKIN2 *p); 00067 int diskin2_perf(CSOUND *csound, DISKIN2 *p); 00068 00069 typedef struct { 00070 OPDS h; 00071 MYFLT *aOut[DISKIN2_MAXCHN]; 00072 MYFLT *iFileCode, *iSkipTime, *iSampleFormat, *iSkipInit, *iBufSize; 00073 int nChannels; 00074 int bufSize; /* in sample frames (power of two) */ 00075 int_least64_t fileLength; /* in sample frames */ 00076 int_least64_t bufStartPos; 00077 int_least64_t read_pos; /* current sample frame being read */ 00078 MYFLT *buf; 00079 SNDFILE *sf; 00080 MYFLT scaleFac; 00081 FDCH fdch; 00082 AUXCH auxData; /* for dynamically allocated buffers */ 00083 } SOUNDIN_; 00084 00085 #endif /* CSOUND_DISKIN2_H */ 00086