Post #1 · Posted at 2016-11-16 06:14:50am 7.4 years ago
leadbman | |
---|---|
Member | |
263 Posts | |
Reg. 2016-02-01 | |
"Working On: 5thMix BGA bgchanges" |
Hi all,
I'm just wondering if it is possible for me to load other files other than Banner, Background, Jacket, Disc, etc from the song folder? What I would like to do is be able to access the songs background video if it has one in the folder.
The way the code accesses things from inside the folder is by using for example:
This loads in the songs background image. So I'm curious if it would be possible to load in using this method the background video for the currently highlighted song. Would save me a tonne of time coding them in individually as well as being more portable for others.
Let me know if you have any ideas! Thanks in advance!
I'm just wondering if it is possible for me to load other files other than Banner, Background, Jacket, Disc, etc from the song folder? What I would like to do is be able to access the songs background video if it has one in the folder.
The way the code accesses things from inside the folder is by using for example:
Quote
LoadFromSongBackground( GAMESTATE:GetCurrentSong() )
This loads in the songs background image. So I'm curious if it would be possible to load in using this method the background video for the currently highlighted song. Would save me a tonne of time coding them in individually as well as being more portable for others.
Let me know if you have any ideas! Thanks in advance!
Post #2 · Posted at 2016-11-16 05:52:24pm 7.4 years ago
Jousway | |
---|---|
Member | |
137 Posts | |
Reg. 2011-07-12 | |
"Noteskins !== Quality " |
this is how I used to load iidx bga before proper support got added back in sm-ssc
local song = GAMESTATE:GetCurrentSong();
local startoffset = song:GetFirstBeat(); --There is no proper way to get video offset sadly
return Def.ActorFrame {
Def.Sprite {
InitCommand=cmd(stretchto,0,0,SCREEN_WIDTH/550,SCREEN_HEIGHT/294;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y-32);
OnCommand=cmd(sleep,startoffset;queuecommand,"Second");
SecondCommand=function(self)
if song then
local songDir = song:GetSongDir();
local dir = FILEMAN:GetDirListing(songDir);
local fileToLoad = nil;
local wat = 1;
for i=1,#dir do
if string.find(dir[i],".avi") then
fileToLoad = dir[i];
wat = 0;
self:Load(songDir..fileToLoad);
elseif string.find(dir[i],".png") and wat == 1 then
fileToLoad = dir[i];
self:Load(songDir..fileToLoad);
self:zoomx((SCREEN_WIDTH/2.15)/self:GetWidth());
self:zoomy((416)/self:GetHeight());
end;
end;
else
-- fallback crap for not having a song
end
end,
};
};
Quote
local song = GAMESTATE:GetCurrentSong();
local startoffset = song:GetFirstBeat(); --There is no proper way to get video offset sadly
return Def.ActorFrame {
Def.Sprite {
InitCommand=cmd(stretchto,0,0,SCREEN_WIDTH/550,SCREEN_HEIGHT/294;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y-32);
OnCommand=cmd(sleep,startoffset;queuecommand,"Second");
SecondCommand=function(self)
if song then
local songDir = song:GetSongDir();
local dir = FILEMAN:GetDirListing(songDir);
local fileToLoad = nil;
local wat = 1;
for i=1,#dir do
if string.find(dir[i],".avi") then
fileToLoad = dir[i];
wat = 0;
self:Load(songDir..fileToLoad);
elseif string.find(dir[i],".png") and wat == 1 then
fileToLoad = dir[i];
self:Load(songDir..fileToLoad);
self:zoomx((SCREEN_WIDTH/2.15)/self:GetWidth());
self:zoomy((416)/self:GetHeight());
end;
end;
else
-- fallback crap for not having a song
end
end,
};
};
Post #3 · Posted at 2016-11-17 03:53:52am 7.4 years ago
leadbman | |
---|---|
Member | |
263 Posts | |
Reg. 2016-02-01 | |
"Working On: 5thMix BGA bgchanges" |
Thanks a lot for that! I got something working by using some of the ideas in your code. I've got it to play the video that's in the folder. Only issue I'm having is, it continues to show even if I'm over a folder.
Normally I'd deal with this by doing:
But for some reason it's not working at this stage. I think I might have stuffed something up. I tried doing if not song as well as shown below but it didn't work either.
My full code is:
Can you see what I'm doing incorrectly? Thanks a lot for your help on this! I really appreciate it.
Normally I'd deal with this by doing:
Quote
if song then
--Code to call video
self:visible(true);
else
self:visible(false);
end;
--Code to call video
self:visible(true);
else
self:visible(false);
end;
But for some reason it's not working at this stage. I think I might have stuffed something up. I tried doing if not song as well as shown below but it didn't work either.
My full code is:
Quote
t[#t+1] = Def.Sprite {
CurrentSongChangedMessageCommand=cmd(playcommand,"Set");
InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y-105;);
OnCommand=cmd();
OffCommand=cmd(sleep,0.633;linear,0.05;diffusealpha,0);
SetCommand=function(self)
local song = GAMESTATE:GetCurrentSong();
local songDir = song:GetSongDir();
local songtitlet = song:GetTranslitFullTitle();
local songtitle = song:GetDisplayFullTitle();
local fileToLoad = songtitle..".avi"
local fileToLoadTrans = songtitlet..".avi"
local checkiftrans = songDir..fileToLoadTrans
if not song then
self:visible(false);
self:diffusealpha(0);
else
if not checkiftrans then
self:Load(songDir..fileToLoad);
self:stoptweening();
self:visible(true);
self:zoomtowidth(265);
self:zoomtoheight(265);
self:diffusealpha(0);
self:sleep(3);
self:linear(0.15);
self:diffusealpha(1);
else
self:Load(songDir..fileToLoadTrans);
self:stoptweening();
self:visible(true);
self:zoomtowidth(265);
self:zoomtoheight(265);
self:diffusealpha(0);
self:sleep(3);
self:linear(0.15);
self:diffusealpha(1);
end;
end;
end;
}
CurrentSongChangedMessageCommand=cmd(playcommand,"Set");
InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y-105;);
OnCommand=cmd();
OffCommand=cmd(sleep,0.633;linear,0.05;diffusealpha,0);
SetCommand=function(self)
local song = GAMESTATE:GetCurrentSong();
local songDir = song:GetSongDir();
local songtitlet = song:GetTranslitFullTitle();
local songtitle = song:GetDisplayFullTitle();
local fileToLoad = songtitle..".avi"
local fileToLoadTrans = songtitlet..".avi"
local checkiftrans = songDir..fileToLoadTrans
if not song then
self:visible(false);
self:diffusealpha(0);
else
if not checkiftrans then
self:Load(songDir..fileToLoad);
self:stoptweening();
self:visible(true);
self:zoomtowidth(265);
self:zoomtoheight(265);
self:diffusealpha(0);
self:sleep(3);
self:linear(0.15);
self:diffusealpha(1);
else
self:Load(songDir..fileToLoadTrans);
self:stoptweening();
self:visible(true);
self:zoomtowidth(265);
self:zoomtoheight(265);
self:diffusealpha(0);
self:sleep(3);
self:linear(0.15);
self:diffusealpha(1);
end;
end;
end;
}
Can you see what I'm doing incorrectly? Thanks a lot for your help on this! I really appreciate it.
Post #4 · Posted at 2016-11-17 05:02:19am 7.4 years ago
hmmm maybe visable doesnt work on video files???, I have no idea, maybe you can throw in a self:Load(THEME:GetPathG("_blank","")) in there to unload the fille?
Post #5 · Posted at 2016-11-17 05:07:08am 7.4 years ago
leadbman | |
---|---|
Member | |
263 Posts | |
Reg. 2016-02-01 | |
"Working On: 5thMix BGA bgchanges" |
Last updated: 2016-11-17 05:08am
I'll try that. Setting the visibility does work for videos, however I think because the files get loaded/unloaded when needed, the visibility may not be applying properly. I'll let you know how I go.
EDIT: It doesn't seem to work either. I'll keep working on it, I'm sure there's a solution! Thanks again for your help.
EDIT: It doesn't seem to work either. I'll keep working on it, I'm sure there's a solution! Thanks again for your help.