Lines Matching defs:psf
40 txw_open (SF_PRIVATE *psf)
41 { if (psf)
61 static int txw_read_header (SF_PRIVATE *psf) ;
63 static sf_count_t txw_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
64 static sf_count_t txw_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
65 static sf_count_t txw_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
66 static sf_count_t txw_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
68 static sf_count_t txw_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ;
100 txw_open (SF_PRIVATE *psf)
103 if (psf->file.mode != SFM_READ)
106 if ((error = txw_read_header (psf)))
109 if (psf_fseek (psf, psf->dataoffset, SEEK_SET) != psf->dataoffset)
112 psf->read_short = txw_read_s ;
113 psf->read_int = txw_read_i ;
114 psf->read_float = txw_read_f ;
115 psf->read_double = txw_read_d ;
117 psf->seek = txw_seek ;
126 txw_read_header (SF_PRIVATE *psf)
133 psf_binheader_readf (psf, "pb", 0, ubuf.cbuf, 16) ;
138 psf_log_printf (psf, "Read only : Yamaha TX-16 Sampler (.txw)\nLM8953\n") ;
141 psf_binheader_readf (psf, "j11", 6, &txwh.format, &txwh.srate) ;
144 psf_binheader_readf (psf, "e33j", &txwh.attacklen, &txwh.repeatlen, 2) ;
160 psf_log_printf (psf, " Format : 0x%02x => ?????\n", txwh.format) ;
164 psf_log_printf (psf, " Format : 0x%02X => %s\n", txwh.format, strptr) ;
170 psf->sf.samplerate = 33333 ;
174 psf->sf.samplerate = 50000 ;
178 psf->sf.samplerate = 16667 ;
186 psf->sf.samplerate = 33333 ;
190 psf->sf.samplerate = 50000 ;
194 psf->sf.samplerate = 166667 ;
199 psf->sf.samplerate = 33333 ;
206 psf_log_printf (psf, strptr) ;
208 psf_log_printf (psf, " Sample Rate : %d (0x%X) => %d\n", txwh.srate, txwh.srhash, psf->sf.samplerate) ;
210 psf_log_printf (psf, " Sample Rate : %d => %d\n", txwh.srate, psf->sf.samplerate) ;
213 { psf_log_printf (psf, " Attack Len : %d\n", txwh.attacklen) ;
214 psf_log_printf (psf, " Repeat Len : %d\n", txwh.repeatlen) ;
217 psf->dataoffset = TXW_DATA_OFFSET ;
218 psf->datalength = psf->filelength - TXW_DATA_OFFSET ;
219 psf->sf.frames = 2 * psf->datalength / 3 ;
222 if (psf->datalength % 3 == 1)
223 psf_log_printf (psf, "*** File seems to be truncated, %d extra bytes.\n",
224 (int) (psf->datalength % 3)) ;
226 if (txwh.attacklen + txwh.repeatlen > psf->sf.frames)
227 psf_log_printf (psf, "*** File has been truncated.\n") ;
229 psf->sf.format = SF_FORMAT_TXW | SF_FORMAT_PCM_16 ;
230 psf->sf.channels = 1 ;
231 psf->sf.sections = 1 ;
232 psf->sf.seekable = SF_TRUE ;
238 txw_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
249 count = psf_fread (ubuf.cbuf, 3, readcount, psf) ;
268 txw_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
279 count = psf_fread (ubuf.cbuf, 3, readcount, psf) ;
298 txw_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
306 if (psf->norm_float == SF_TRUE)
315 count = psf_fread (ubuf.cbuf, 3, readcount, psf) ;
334 txw_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
342 if (psf->norm_double == SF_TRUE)
351 count = psf_fread (ubuf.cbuf, 3, readcount, psf) ;
370 txw_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
371 { if (psf && mode)