I’m trying to convert:
"res/sample.wav"
to
"c://...documents/rack/plugins/fault/res/sample.wav"
as that appears to be how dr_wav() wants the file - tho I don’t see why?
So I’m using
pSampleData2 = drwav_open_and_read_file_f32(fs::absolute(p).string().c_str(), &c, &sr, &sc);
I assume you mean C++11 rather than C11 so I’ve edited the thread’s title.
– yes, thank you
You can’t use filesystem:: in C++11, although the Rack 2 API will add system::getAbsolute().
– As per investigation, understood.
However, dr_wav can load relative paths just fine, so I would look into that. You don’t need to pass absolute paths.
– That’s what it looks like in the docs - the comments in the code. I’m hoping so, because I thought I’d be able to submit the plugin today thinking I “only” have to convert my paths.
“I only have to” is as dangerous a phrase as “I just have to”
I tried using the location of the plugin as the relative base because of numerous mentions of “res/filename” in the code but so far, no success.
But your confimation is what I need to return to that line of investigation
If you’re trying to access plugin assets, although it’s possible for asset::plugin("res/filename") to return a relative path (if for example the user sets their Rack user dir to "."), it’s usually an absolute path. You shouldn’t pass the literal string "res/filename" to dr_wav because Rack’s working directory is not set to your plugin directory. You should use the path returned by asset::plugin("res/filename").
Excellent.
Thank you very much.
asset.plugin() was the missing piece.
Removing a function was really important
For aestetic purposes I don’t want the ability to load new samples.
The ability to cycle through the folder content, means you can add samples as a ‘hack’ by placing more in the correct folders.
I think it’s ready for MVP publishing. I’ll start the process tomorrow. It’s a really a simple device, but it will be the basis for some Machine Learning stuff (I hope)