Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Feature Requests

Reply
 
Thread Tools Display Modes
Old 04-17-2020, 12:05 AM   #1
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,909
Default JSFX: allow absolute filepath + access for read/write from ReaScript

Request
Allow to read/write file data with given absolute filepath withing JSFX. And access to it via ReaScript (Lua/EEL).

Benefit
Ability to create samplers, convolution stuff, tuners. Any custom stuff which require loading external files (for reading/parsing or just custom libraries).

Reason
There is no way to store external file paths other than hardcoding it in the code or using gmem, which is awful workaround for stuff like that. The only way is only
Quote:
slider1:/some_path:default_value:slider description
In the above example, the /some_path specifies a subdirectory of the REAPER\Data path, which will be scanned for .wav, .txt, .ogg, or .raw files. default_value defines a default filename. If this is used, the script will generally use file_open(slider1) in the @serialize code section to read the contents of the selected file.
Implementation Suggestion
  • JSFX side: file_browse(id, init_path, description), "Browse" button, what GetUserFileNameForRead() actually do in ReaScript. If init_path is empty, use /Reaper or /Reaper/Data. Optionally update init_path on change file path.
    Code:
    desc:new effect
    
    slider1:0<0,100,1>parameter1
    file_browse(12, "C:\", "Sample file name")
    
    @init
    
    @block
    handle = file_open(12);
    //do other stuff
  • ReaScript side: TrackFX_G(S)etNamedConfigParm (which can override initiated parameter)
    Code:
    local ret, fn = reaper.TrackFX_GetNamedConfigParm(track, JSFX_id, "FILE12")
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate

Last edited by mpl; 05-17-2020 at 04:37 AM.
mpl is offline   Reply With Quote
Old 04-21-2020, 06:13 AM   #2
sai'ke
Human being with feelings
 
sai'ke's Avatar
 
Join Date: Aug 2009
Location: NL
Posts: 1,164
Default

+1.

Quite similar to this request: https://forum.cockos.com/showthread.php?t=212561

Being able to load sample data from anywhere would open a lot of doors.

I'd also like to add, that even if you have the path, you can't load from an absolute path, only in specific paths.

Drag and drop seems to actually return a full path with gfx_getdropfile(0, strhandle), but when you try file_open, it seems that absolute paths don't work at all.
__________________
[Tracker Plugin: Thread|Github|Reapack] | [Routing Plugin: Thread|Reapack] | [More JSFX: Thread|Descriptions|Reapack]
sai'ke is online now   Reply With Quote
Old 04-21-2020, 06:26 AM   #3
Vagelis
Human being with feelings
 
Vagelis's Avatar
 
Join Date: Oct 2017
Location: Larisa, Greece
Posts: 1,394
Default

+1 because i would love to see what capable programmers like you guys could achieve.

More samplers and audio manglers please
Vagelis is offline   Reply With Quote
Old 04-21-2020, 02:35 PM   #4
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 2,528
Default

+1, would love to see this
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1400 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you wish
Meo-Ada Mespotine is online now   Reply With Quote
Old 05-17-2020, 05:38 AM   #5
BirdBird
Human being with feelings
 
BirdBird's Avatar
 
Join Date: Mar 2019
Posts: 244
Default

+1 This would be very useful to have.
BirdBird is online now   Reply With Quote
Old 05-17-2020, 11:44 AM   #6
juan_r
Human being with feelings
 
juan_r's Avatar
 
Join Date: Oct 2019
Posts: 355
Default

+1 let MPL and other talented guys code their hearts off, pleeeeze! :-P
juan_r is offline   Reply With Quote
Old 04-21-2021, 12:28 PM   #7
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,909
Default

Still not possible, right?
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate
mpl is offline   Reply With Quote
Old 04-21-2021, 02:54 PM   #8
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 10,736
Default

Supposedly never will be, as JSFX runs on the track's audio thread, while Reascripts run oin the Reaper GUI thread. And omnly the GUI thread can do file i/o in a save way.

-Michael
mschnell is offline   Reply With Quote
Old 04-21-2021, 05:42 PM   #9
BirdBird
Human being with feelings
 
BirdBird's Avatar
 
Join Date: Mar 2019
Posts: 244
Default

For absolute filepaths JSFX got support for it in this version.
Quote:
+ JSFX: support file_open() of media with absolute path [t=212561]
Saike's Amaranth supports drag/drop with absolute filepaths with it.
BirdBird is online now   Reply With Quote
Old 04-22-2021, 03:25 AM   #10
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 10,736
Default

AFAIR, it can't write to that files.
-Michael
mschnell is offline   Reply With Quote
Old 04-22-2021, 01:11 PM   #11
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,909
Default

Quote:
Originally Posted by BirdBird View Post
For absolute filepaths JSFX got support for it in this version.

Saike's Amaranth supports drag/drop with absolute filepaths with it.
This is great! Thanks.
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate
mpl is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:39 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.