Old 08-23-2019, 12:11 AM   #1
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default Why does GetMediaSourceFileName get a nil value?

There is an special item in this project. I can not using GetMediaSourceFileName to get it's source file path

Code:
local it=reaper.GetSelectedMediaItem(0, 0)

local tk=reaper.GetActiveTake(it)

local sr=reaper.GetMediaItemTake_Source(tk)

local file=reaper.GetMediaSourceFileName(sr, "")
But then I find out the value of file is nil. What's wrong with it?

Last edited by dsyrock; 04-14-2020 at 08:26 PM.
dsyrock is offline   Reply With Quote
Old 08-23-2019, 04:39 AM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,874
Default

Maybe your src is Loop, try to get parent source of it.
X-Raym is offline   Reply With Quote
Old 08-23-2019, 05:39 AM   #3
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

In this case it's because it's reversed (the 'Reverse' tickbox in Item Properties is ticked.)
https://forum.cockos.com/showthread....63#post1547463
nofish is offline   Reply With Quote
Old 08-23-2019, 09:39 AM   #4
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Quote:
Originally Posted by nofish View Post
In this case it's because it's reversed (the 'Reverse' tickbox in Item Properties is ticked.)
https://forum.cockos.com/showthread....63#post1547463
Thanks X-Raym and nofish, and yes it's exactly a reverse item.

Last edited by dsyrock; 08-23-2019 at 10:11 AM.
dsyrock is offline   Reply With Quote
Old 08-24-2019, 04:35 AM   #5
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by dsyrock View Post
Thanks X-Raym and nofish, and yes it's exactly a reverse item.
The following appears to work :
Code:
local it=reaper.GetSelectedMediaItem(0, 0)
local tk=reaper.GetActiveTake(it)
local sr=reaper.GetMediaItemTake_Source(tk)
local psr = reaper.GetMediaSourceParent(sr)
if psr then sr = psr end
local file=reaper.GetMediaSourceFileName(sr, "")
reaper.ShowConsoleMsg(file.."\n")
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios 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 02:11 AM.


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