Old 04-11-2023, 08:17 AM   #1
aletheia
Human being with feelings
 
Join Date: Nov 2019
Posts: 54
Default reaper. ShowOpenDialog in Linux

This function does not seem to be recognized under Linux.Why?
How to override this function to select a file?

Last edited by aletheia; 04-11-2023 at 08:29 AM.
aletheia is offline   Reply With Quote
Old 04-11-2023, 08:50 AM   #2
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Where did you find this function? Never seen it.

This will open a dialog with 'Dialog title' title and set mp3 extension. When user chooses file, you get retval = true and filenameNeed4096 = [file_path]
Code:
retval, filenameNeed4096 = reaper.GetUserFileNameForRead('', 'Dialog title', 'mp3')
If then you want to insert such file into a project, you need to use this function, where mode is:
Quote:
mode: 0=add to current track, 1=add new track, 3=add to selected items as takes, &4=stretch/loop to fit time sel, &8=try to match tempo 1x, &16=try to match tempo 0.5x, &32=try to match tempo 2x, &64=don't preserve pitch when matching tempo, &128=no loop/section if startpct/endpct set, &256=force loop regardless of global preference for looping imported items, &512=use high word as absolute track index if mode&3==0 or mode&2048, &1024=insert into reasamplomatic on a new track (add 1 to insert on last selected track), &2048=insert into open reasamplomatic instance (add 512 to use high word as absolute track index), &4096=move to source preferred position (BWF start offset), &8192=reverse
Code:
 reaper.InsertMedia( file, mode )
or this function, if you want to insert only a part of file:

Code:
 reaper.InsertMediaSection( file, mode, startpct, endpct, pitchshift )
vitalker is online now   Reply With Quote
Old 04-11-2023, 11:31 AM   #3
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

I fear ChatGPT was lying to you, aletheia...
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 04-13-2023, 03:43 AM   #4
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Did you solve your problem?
vitalker is online now   Reply With Quote
Old 04-13-2023, 08:11 AM   #5
aletheia
Human being with feelings
 
Join Date: Nov 2019
Posts: 54
Default

Yes! width:
Code:
retval, filepath = reaper.GetUserFileNameForRead("", "Select a file", "")

 file, err = io.open(filepath, "r")
...
thanks
aletheia is offline   Reply With Quote
Old 04-13-2023, 09:19 AM   #6
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

You're welcome.
vitalker is online now   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 05:46 AM.


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