Skip to content

Commit

Permalink
Merge pull request supercollider#28 from jamshark70/topic/LPCFixes
Browse files Browse the repository at this point in the history
LPCFile.sc: loadToBuffer: Use existing bufnum, don't loadToSignal twice
  • Loading branch information
telephon committed Feb 13, 2015
2 parents cb1320c + c86d3c1 commit 2c272d9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions source/JoshUGens/sc/classes/LPCFile.sc
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,14 @@ LPCFile : File {
loadToBuffer {
var c, numcycles, tmp;
c = Condition.new;
this.loadToSignal;
Routine.run{
this.server.sendMsg(\b_free, buffer);
this.server.sync(c);
this.loadToSignal;
tmp = Buffer.loadCollection(this.server, signal);
tmp = Buffer.alloc(this.server, signal.size, 1, bufnum: buffer);
this.server.sync(c);
tmp.loadCollection(signal, action: { c.unhang });
c.hang;
buffer = tmp.bufnum;
("LPC data loaded to buffer "++ buffer.asString).postln;
}
Expand Down Expand Up @@ -199,7 +202,11 @@ LPCFile : File {
}

asUGenInput {^buffer}
free {buffer.free}
free {
this.server.sendMsg(\b_free, buffer);
this.server.bufferAllocator.free(buffer);
buffer = nil
}
bufnum {^buffer}
asControlInput { ^buffer }
}

0 comments on commit 2c272d9

Please sign in to comment.