[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] VDiskIn sending back msg

ok, I think I've now solved this correctly. To do this perfectly, we need to add one change in the SndBuf struct though, making it remember some file info. I think this makes sense anyway, maybe some other ugens can make use of it, too.

(if this is too much of a change, we can also require the user to do a modulo of the reply value with the numFrames.)

apart from the attached diff in VDiskIn, the change would be:

Index: SC_SequencedCommand.cpp
--- SC_SequencedCommand.cpp	(revision 8312)
+++ SC_SequencedCommand.cpp	(working copy)
@@ -666,6 +666,9 @@
 		return false;
+	buf->fileinfo = fileinfo; // keep fileinfo.
 	if (mFileOffset < 0) mFileOffset = 0;
 	else if (mFileOffset > fileinfo.frames) mFileOffset = fileinfo.frames;
if (mNumFrames < 0 || mNumFrames + mFileOffset > fileinfo.frames) mNumFrames = fileinfo.frames - mFileOffset;

Index: plugin_interface/SC_SndBuf.h
--- plugin_interface/SC_SndBuf.h	(revision 8312)
+++ plugin_interface/SC_SndBuf.h	(working copy)
@@ -36,6 +36,7 @@
 	int mask1;	// for interpolating oscillators.
 	int coord;	// used by fft ugens
 	SNDFILE *sndfile; // used by disk i/o
+	SF_INFO fileinfo; // used by disk i/o
 typedef struct SndBuf SndBuf;

does this make sense? Does anyone see a problem in this change?
I'm not sure if there are memory implications to this.



Attachment: vdisk.diff
Description: Binary data