From c10b87993644635eba2fc59eb1f8c7bce046a7ec Mon Sep 17 00:00:00 2001 From: Ted Moore Date: Wed, 8 Dec 2021 20:22:11 +0000 Subject: [PATCH] allow for passing the file name in as well --- release-packaging/Classes/FluidFilesPath.sc | 4 +++- test/FluidFilesPath_test.scd | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/release-packaging/Classes/FluidFilesPath.sc b/release-packaging/Classes/FluidFilesPath.sc index 0b03015..7a3c82e 100644 --- a/release-packaging/Classes/FluidFilesPath.sc +++ b/release-packaging/Classes/FluidFilesPath.sc @@ -1,5 +1,7 @@ FluidFilesPath { *new { - ^"%/../AudioFiles/".format(File.realpath(FluidDataSet.class.filenameSymbol).dirname); + arg fileName; + fileName = fileName ? ""; + ^("%/../AudioFiles/".format(File.realpath(FluidDataSet.class.filenameSymbol).dirname) +/+ fileName); } } \ No newline at end of file diff --git a/test/FluidFilesPath_test.scd b/test/FluidFilesPath_test.scd index 37addff..585f577 100644 --- a/test/FluidFilesPath_test.scd +++ b/test/FluidFilesPath_test.scd @@ -1,3 +1,10 @@ +( +// should all return the same path: +(FluidFilesPath()++"Nicol-LoopE-M.wav").postln; +FluidFilesPath("Nicol-LoopE-M.wav").postln; +FluidFilesPath("/Nicol-LoopE-M.wav").postln; +) + ( s.waitForBoot{ Routine{ @@ -9,4 +16,17 @@ s.waitForBoot{ buf.play; }.play; } +) + +( +s.waitForBoot{ + Routine{ + var path = FluidFilesPath("Nicol-LoopE-M.wav"); + var buf = Buffer.read(s,path); + + s.sync; + + buf.play; + }.play; +} ) \ No newline at end of file