Old 08-23-2019, 12:11 AM   #1
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 161
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?
Attached Files
File Type: zip filesource.zip (574.7 KB, 10 views)
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: 5,971
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: 8,977
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: 161
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: 7,867
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")
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios 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:12 PM.


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