I think the problem here is that DiskIn expects part of the sound file to be loaded into the buffer, and the file should be left open so that DiskIn can get more audio from disk as needed. Buffer:loadDialog doesn't do that -- it closes the file after filling the buffer from disk, and this is (most likely) causing DiskIn not to work.
Also, since your code doesn't specify a buffer size, it will load the entire file into server memory. In that case, DiskIn is superfluous because the whole point of that unit generator is to read audio incrementally into a smaller buffer.
I would suggest something like this. There is a bunch of stuff in here that I don't have time to explain tonight, but ask more questions and I'll be happy to fill in the blanks. Keeping track of the buffers and synths is not covered in this code but will be very important for handling multiple buffers and files.
James
(
CocoaGUI.dialog.getPaths({ |path|
var sf = SoundFile.openRead(path[0]), condition = Condition.new, defname;
if(sf.notNil and: { sf.isOpen }) {
protect {
fork {
defname = "diskin" ++ sf.numChannels;
SynthDef(defname, { |buffer, out, loop = 1|
Out.ar(out, DiskIn.ar(sf.numChannels, buffer, loop))
}).send(s);
b = Buffer.cueSoundFile(s, path[0],
startFrame: 0,
numChannels: sf.numChannels,
bufferSize: 131072);
s.sync(condition);
x = Synth(defname, [buffer: b]);
}
} {
sf !? { sf.close };
}
} {
"% is not a valid soundfile.".format(path[0]).die;
};
});
)
x.free;