sf_count_t count;
switch (mCommand) {
case kDiskCmd_Read:
- count = buf->sndfile ? sf_readf_float(buf->sndfile, buf->data + mPos * buf->channels, mFrames) : 0;
+ count = buf->sndfile ? sf_readf_float(GETSNDFILE(buf), buf->data + mPos * buf->channels, mFrames) : 0;
if (count < mFrames) {
memset(buf->data + (mPos + count) * buf->channels, 0, (mFrames - count) * buf->channels * sizeof(float));
World_GetBuf(mWorld, mBufNum)->mask = mPos + count;
memset(buf->data + mPos * buf->channels, 0, mFrames * buf->channels * sizeof(float));
goto leave;
}
- count = sf_readf_float(buf->sndfile, buf->data + mPos * buf->channels, mFrames);
+ count = sf_readf_float(GETSNDFILE(buf), buf->data + mPos * buf->channels, mFrames);
while (mFrames -= count) {
- sf_seek(buf->sndfile, 0, SEEK_SET);
- count = sf_readf_float(buf->sndfile, buf->data + (mPos + count) * buf->channels, mFrames);
+ sf_seek(GETSNDFILE(buf), 0, SEEK_SET);
+ count = sf_readf_float(GETSNDFILE(buf), buf->data + (mPos + count) * buf->channels, mFrames);
}
break;
case kDiskCmd_Write:
// printf("kDiskCmd_Write %d %p\n", mBufNum, buf->sndfile);
if (!buf->sndfile)
goto leave;
- count = sf_writef_float(buf->sndfile, buf->data + mPos * buf->channels, mFrames);
+ count = sf_writef_float(GETSNDFILE(buf), buf->data + mPos * buf->channels, mFrames);
break;
}
if ((int)ZIN0(1)) { // loop
if (!bufr->sndfile)
memset(bufr->data + mPos * bufr->channels, 0, bufFrames2 * bufr->channels * sizeof(float));
- count = sf_readf_float(bufr->sndfile, bufr->data + mPos * bufr->channels, bufFrames2);
+ count = sf_readf_float(GETSNDFILE(bufr), bufr->data + mPos * bufr->channels, bufFrames2);
while (bufFrames2 -= count) {
- sf_seek(bufr->sndfile, 0, SEEK_SET);
- count = sf_readf_float(bufr->sndfile, bufr->data + (mPos + count) * bufr->channels, bufFrames2);
+ sf_seek(GETSNDFILE(bufr), 0, SEEK_SET);
+ count = sf_readf_float(GETSNDFILE(bufr), bufr->data + (mPos + count) * bufr->channels, bufFrames2);
}
} else { // non-loop
- count =
- bufr->sndfile ? sf_readf_float(bufr->sndfile, bufr->data + mPos * bufr->channels, bufFrames2) : 0;
+ count = bufr->sndfile ? sf_readf_float(GETSNDFILE(bufr), bufr->data + mPos * bufr->channels, bufFrames2)
+ : 0;
if (count < bufFrames2) {
memset(bufr->data + (mPos + count) * bufr->channels, 0,
(bufFrames2 - count) * bufr->channels * sizeof(float));
if ((int)ZIN0(2)) { // loop
if (!bufr->sndfile)
memset(bufr->data + mPos * bufr->channels, 0, bufFrames2 * bufr->channels * sizeof(float));
- count = sf_readf_float(bufr->sndfile, bufr->data + mPos * bufr->channels, bufFrames2);
+ count = sf_readf_float(GETSNDFILE(bufr), bufr->data + mPos * bufr->channels, bufFrames2);
while (bufFrames2 -= count) {
- sf_seek(bufr->sndfile, 0, SEEK_SET);
- count = sf_readf_float(bufr->sndfile, bufr->data + (mPos + count) * bufr->channels, bufFrames2);
+ sf_seek(GETSNDFILE(bufr), 0, SEEK_SET);
+ count = sf_readf_float(GETSNDFILE(bufr), bufr->data + (mPos + count) * bufr->channels, bufFrames2);
}
} else { // non-loop
- count = bufr->sndfile ? sf_readf_float(bufr->sndfile, bufr->data + mPos * bufr->channels, bufFrames2) : 0;
+ count =
+ bufr->sndfile ? sf_readf_float(GETSNDFILE(bufr), bufr->data + mPos * bufr->channels, bufFrames2) : 0;
if (count < bufFrames2) {
memset(bufr->data + (mPos + count) * bufr->channels, 0,
(bufFrames2 - count) * bufr->channels * sizeof(float));