Lines Matching defs:psf
42 static sf_count_t interleave_read_short (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
43 static sf_count_t interleave_read_int (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
44 static sf_count_t interleave_read_float (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
45 static sf_count_t interleave_read_double (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
53 interleave_init (SF_PRIVATE *psf)
56 if (psf->file.mode != SFM_READ)
59 if (psf->interleave)
60 { psf_log_printf (psf, "*** Weird, already have interleave.\n") ;
70 psf->interleave = pdata ;
73 pdata->read_short = psf->read_short ;
74 pdata->read_int = psf->read_int ;
75 pdata->read_float = psf->read_float ;
76 pdata->read_double = psf->read_double ;
78 pdata->channel_len = psf->sf.frames * psf->bytewidth ;
81 psf->read_short = interleave_read_short ;
82 psf->read_int = interleave_read_int ;
83 psf->read_float = interleave_read_float ;
84 psf->read_double = interleave_read_double ;
86 psf->seek = interleave_seek ;
95 interleave_read_short (SF_PRIVATE *psf, short *ptr, sf_count_t len)
101 if (! (pdata = psf->interleave))
106 for (chan = 0 ; chan < psf->sf.channels ; chan++)
109 offset = psf->dataoffset + chan * psf->bytewidth * psf->read_current ;
111 if (psf_fseek (psf, offset, SEEK_SET) != offset)
112 { psf->error = SFE_INTERLEAVE_SEEK ;
116 templen = len / psf->sf.channels ;
124 if (pdata->read_short (psf, inptr, count) != count)
125 { psf->error = SFE_INTERLEAVE_READ ;
131 outptr += psf->sf.channels ;
142 interleave_read_int (SF_PRIVATE *psf, int *ptr, sf_count_t len)
148 if (! (pdata = psf->interleave))
153 for (chan = 0 ; chan < psf->sf.channels ; chan++)
156 offset = psf->dataoffset + chan * psf->bytewidth * psf->read_current ;
158 if (psf_fseek (psf, offset, SEEK_SET) != offset)
159 { psf->error = SFE_INTERLEAVE_SEEK ;
163 templen = len / psf->sf.channels ;
171 if (pdata->read_int (psf, inptr, count) != count)
172 { psf->error = SFE_INTERLEAVE_READ ;
178 outptr += psf->sf.channels ;
189 interleave_read_float (SF_PRIVATE *psf, float *ptr, sf_count_t len)
195 if (! (pdata = psf->interleave))
200 for (chan = 0 ; chan < psf->sf.channels ; chan++)
203 offset = psf->dataoffset + pdata->channel_len * chan + psf->read_current * psf->bytewidth ;
205 /*-printf ("chan : %d read_current : %6lld offset : %6lld\n", chan, psf->read_current, offset) ;-*/
207 if (psf_fseek (psf, offset, SEEK_SET) != offset)
208 { psf->error = SFE_INTERLEAVE_SEEK ;
213 templen = len / psf->sf.channels ;
221 if (pdata->read_float (psf, inptr, count) != count)
222 { psf->error = SFE_INTERLEAVE_READ ;
229 outptr += psf->sf.channels ;
240 interleave_read_double (SF_PRIVATE *psf, double *ptr, sf_count_t len)
246 if (! (pdata = psf->interleave))
251 for (chan = 0 ; chan < psf->sf.channels ; chan++)
254 offset = psf->dataoffset + chan * psf->bytewidth * psf->read_current ;
256 if (psf_fseek (psf, offset, SEEK_SET) != offset)
257 { psf->error = SFE_INTERLEAVE_SEEK ;
261 templen = len / psf->sf.channels ;
269 if (pdata->read_double (psf, inptr, count) != count)
270 { psf->error = SFE_INTERLEAVE_READ ;
276 outptr += psf->sf.channels ;
290 interleave_seek (SF_PRIVATE * UNUSED (psf), int UNUSED (mode), sf_count_t samples_from_start)