BelaPlatform / supercollider

an environment and programming language for real time audio synthesis and algorithmic composition
GNU General Public License v3.0
14 stars 8 forks source link

DiskIO UGens cause mode changes #52

Closed sensestage closed 3 years ago

sensestage commented 7 years ago

DiskOut: mode changes are happening. Probably this will also happen with DiskIn.

DiskIO_UGens create a disk io thread that runs in non real time to write the buffer to disk

sensestage commented 7 years ago

File: server/plugins/DiskIO_UGens.cpp

giuliomoro commented 6 years ago

@sensestage do you have any SC code to test this please?

giuliomoro commented 6 years ago

ok nevermind, I got some from http://doc.sccode.org/Classes/DiskOut.html

Server.default = s = Server("belaServer", NetAddr("192.168.7.2", 57110));
OSCFunc.trace(true,true);
s.options.maxLogins( 4 );
s.options.asOptionsString
s.boot;

(
s.dumpOSC(1);
s.initTree;
s.startAliveThread;
);

(
// something to record
SynthDef("bubbles", {
    var f, zout;
    f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function
    zout = CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4); // echoing sine wave
    Out.ar(0, zout);
}).add;

// this will record to the disk
SynthDef("help-Diskout", {arg bufnum;
    DiskOut.ar(bufnum, In.ar(0,2));
}).add;

// this will play it back
SynthDef("help-Diskin-2chan", { arg bufnum = 0;
    Out.ar(0, DiskIn.ar(2, bufnum));
}).add;
)

// start something to record
x = Synth.new("bubbles");
// allocate a disk i/o buffer
b= Buffer.alloc(s, 65536, 2);
// create an output file for this buffer, leave it open
b.write("~/diskouttest.aiff".standardizePath, "aiff", "int16", 0, 0, true);

// This next line actually starts the mode switches ...
// create the diskout node; making sure it comes after the source
d = Synth.tail(nil, "help-Diskout", ["bufnum", b]);
// ... and this stops them:
// stop recording
d.free;
// stop the bubbles
x.free;
// close the buffer and the soundfile
b.close;
// free the buffer
b.free;

// The following block starts mode switches again
// play it back
(
x = Synth.basicNew("help-Diskin-2chan");
m = { arg buf; x.addToHeadMsg(nil, [\bufnum,buf])};

b = Buffer.cueSoundFile(s,"~/diskouttest.aiff".standardizePath, 0, 2, completionMessage: m);
)
// ... and this stops them 
x.free; b.close; b.free; // cleanup
giuliomoro commented 6 years ago

Ok these are caused by mDiskFifoHasData.Signal and the likes. #62 will fix this.