Skip to content

Commit 33a827a

Browse files
committed
corrected the behaviour of starting writing back after negative indices
1 parent c5aa4a5 commit 33a827a

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

IBufWr.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ void IBufWr_next(IBufWr *unit, int n) {
194194
for(chan = 0; chan < nc;chan++)
195195
valeur[chan] = IN(chan+4)[j]; // transfer the new previous value
196196
}
197+
index_precedent = index; // transfer the new previous address
197198
}
198-
index_precedent = index; // transfer the new previous address
199199
}
200200
}
201201
else {
@@ -270,8 +270,8 @@ void IBufWr_next(IBufWr *unit, int n) {
270270
for(chan = 0; chan < nc;chan++)
271271
valeur[chan] = IN(chan+4)[j]; // transfer the new previous value
272272
}
273+
index_precedent = index; // transfer the new previous address
273274
}
274-
index_precedent = index; // transfer the new previous address
275275
}
276276
}
277277
}
@@ -379,8 +379,8 @@ void IBufWr_next(IBufWr *unit, int n) {
379379
for(chan = 0; chan < nc;chan++)
380380
valeur[chan] = IN(chan+4)[j]; // transfer the new previous value
381381
}
382+
index_precedent = index; // transfer the new previous address
382383
}
383-
index_precedent = index; // transfer the new previous address
384384
}
385385
}
386386
else {
@@ -457,8 +457,8 @@ void IBufWr_next(IBufWr *unit, int n) {
457457
for(chan = 0; chan < nc;chan++)
458458
valeur[chan] = IN(chan+4)[j]; // transfer the new previous value
459459
}
460+
index_precedent = index; // transfer the new previous address
460461
}
461-
index_precedent = index; // transfer the new previous address
462462
}
463463
}
464464
}

release-packaging/IBufWr/HelpSource/Classes/IBufWr.schelp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ d = Buffer.read(s, p);
202202
x = d.play(true, 0.1)
203203

204204
// add a basic delay after using the built-in DelayN, 6dB lower -- feedbback does not work, needs a block delay (InFeedback)
205-
y = {arg gain = 0.5, feed = 0.5; [0, DelayN.ar((In.ar(0) * gain) + (In.ar(1) * feed),1,1)]}.play(addAction:'addToTail')
205+
y = {arg gain = 0.5, feed = 0.5; [0, DelayN.ar((In.ar(0) * gain) + (In.ar(1) * feed),0.5,0.5)]}.play(addAction:'addToTail')
206206

207207
// so free that
208208
y.free
@@ -282,7 +282,7 @@ e= Buffer.alloc(s,1000,2);
282282
(
283283
{
284284
// each second an impulse selects a index to write a random value in each channels, interpolating on the way
285-
IBufWr.kr(LFNoise0.kr([1,1]),e.bufnum,Impulse.kr(1,0,LFNoise0.kr(1).range(0,e.numFrames),-1));
285+
IBufWr.kr(LFNoise0.kr([1,1]),e.bufnum,LFNoise0.kr(1).range(0,e.numFrames));
286286

287287
// you could 'quantize' the index/phase by rouding the range out to a subdivision of you choice... but the grid is boring, no?
288288

release-packaging/IBufWr/HelpSource/Guides/BufferWritingGuide.schelp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ g = Group.new;
141141
100.do({Synth(\testIBufWr , target:g)})
142142
)
143143

144-
// worse by about 40%. Free them.
144+
// worse by about 25%. Free them.
145145
g.free
146146

147147

@@ -218,23 +218,29 @@ A feature of link::Classes/IBufWr:: is that the writing can be paused at any tim
218218
code::
219219
s.boot;
220220

221-
//allocate a second-long buffer
221+
//allocate a buffer...
222222
b = Buffer.alloc(s, s.sampleRate/10);
223+
// and fill it with a constant
224+
b.fill(0,b.numFrames,2000);
225+
// plot to check
226+
b.plot;
223227

224-
//writing with a switch on the index every 250ms
228+
//writing with a switch on the index every 25ms
225229
(
226-
b.zero;
230+
// b.zero;
227231
{
228232
IBufWr.ar(
229233
Phasor.ar(0, 1 , 0, b.numFrames),// writing values, incremented one sample per sample
230234
b.bufnum,
231235
LFPulse.ar(40,mul:Phasor.ar(0, 1 , 1, b.numFrames+1),add:-1), // writes one sample per sample when the pulse is up, otherwise is stable at -1
232-
1
236+
0
233237
);
234238
}.plot(0.1)
235239
)
240+
// what we see in this plot is the writing index
236241

237-
b.plot
242+
// plot the buffer: observe it has left the constant values untouched when the index was -1
243+
b.plot;
238244

245+
// clear up
239246
b.free
240-
::

0 commit comments

Comments
 (0)