Fix: fixing some stuff before SAMP version upgrade

This commit is contained in:
2024-02-24 01:05:14 +01:00
parent eaa29e7f6e
commit 14aa95f3cf
2 changed files with 34 additions and 16 deletions

View File

@ -8,7 +8,7 @@ Bank : Singleton {
var <paths, buffers, <channels, <foundRoot, <foundRootModTime, markersCache, atCache; var <paths, buffers, <channels, <foundRoot, <foundRootModTime, markersCache, atCache;
*initClass { *initClass {
root = "/Users/bubo/.config/livecoding/samples"; root = "/Users/bubo/.config/livecoding/samples".standardizePath;
extensions = ["wav", "aiff", "aif", "flac", "mp3"]; extensions = ["wav", "aiff", "aif", "flac", "mp3"];
} }
@ -227,8 +227,15 @@ Bank : Singleton {
^this.at(index); ^this.at(index);
} }
do { |...args| buffers.size.collect(this.bufferAt(_)).do(*args) } do {
collect { |...args| ^buffers.size.collect(this.bufferAt(_)).collect(*args) } |...args|
buffers.size.collect(this.bufferAt(_)).do(*args)
}
collect {
|...args|
^buffers.size.collect(this.bufferAt(_)).collect(*args)
}
prUpdateBuffers { prUpdateBuffers {
if (Server.default.serverBooting or: { if (Server.default.serverBooting or: {
@ -284,10 +291,19 @@ Bank : Singleton {
^Pindex(Pseq([this], inf), keyPat) ^Pindex(Pseq([this], inf), keyPat)
} }
// Single buffer support asBuffer {
asBuffer { ^this.singleSampleWrap(nil) } ^this.singleSampleWrap(nil)
asControlInput { |...args| ^this.prSingleSampleWrap(\asControlInput, *args) } }
play { |...args| ^this.prSingleSampleWrap(\play, *args) }
asControlInput {
|...args|
^this.prSingleSampleWrap(\asControlInput, *args)
}
play {
|...args|
^this.prSingleSampleWrap(\play, *args)
}
prSingleSampleWrap { prSingleSampleWrap {
|method ...args| |method ...args|

View File

@ -42,7 +42,7 @@ Boot {
this.samplePath = samplePath ? "/Users/bubo/.config/livecoding/samples"; this.samplePath = samplePath ? "/Users/bubo/.config/livecoding/samples";
// Setting up the audio samples/buffers manager // Setting up the audio samples/buffers manager
Bank.lazyLoading = true; Bank.lazyLoading = false;
Bank.root = this.samplePath; Bank.root = this.samplePath;
// Post actions: installing behavior after server boot // Post actions: installing behavior after server boot
@ -68,14 +68,16 @@ Boot {
Event.addEventType(\buboEvent, { Event.addEventType(\buboEvent, {
// This is a custom event that makes it easier to play samples // This is a custom event that makes it easier to play samples
arg server; arg server;
~sp = ~sp ?? 'default'; if (~sp.notNil && ~nb.notNil, {
~nb = ~nb ?? 0; ~sp = ~sp ?? 'default';
~buf = Bank(~sp)[~nb % Bank(~sp).paths.size]; ~nb = ~nb ?? 0;
if (~buf.numChannels == 1) { ~buf = Bank(~sp)[~nb % Bank(~sp).paths.size];
~instrument = \player; if (~buf.numChannels == 1) {
} { ~instrument = \player;
~instrument = \splayer; } {
}; ~instrument = \splayer;
};
});
~type = \note; ~type = \note;
currentEnvironment.play; currentEnvironment.play;
}); });