Changing visibility based on point in song
#1
I'm working with the cdArt mod right now. I've made it so it retreats into the album when the song is paused, and fades away when the song is over, both very simple to do. Now what I am trying to do is make it so that 1 second before the song is over the CD will go back into the album, then emerge again 1 second into the next song, thus making it look like CDs were being exchanged This seemed fairly straight forward to me, but apparently not. Here's the code I'm using:

Code:
            <control type="image">
                <description>CD overlay</description>
                <animation effect="slide" start="-118" end="0" time="700" tween="cubic" easing="out" delay="1000">WindowOpen</animation>
                <animation effect="slide" start="-118" end="0" time="700" tween="cubic" easing="out">Visible</animation>
                <animation effect="slide" start="0" end="-118" time="700" tween="cubic" easing="in">Hidden</animation>
                <animation effect="fade" start="100" end="0" time="100" condition="!Player.HasAudio">Conditional</animation>

                <animation effect="rotate" end="-360" center="auto" time="2000" loop="true" reversible="false" condition="Control.IsVisible(10)">Conditional</animation>
                <width>240</width>
                <height>198</height>
                <posx>148</posx><!-- 112 -->
                <posy>245r</posy><!-- -143 -->
                <texture fallback="backdrops/artist_fanart/default/default.png">backdrops/artist_fanart/cd/$INFO[MusicPlayer.Artist]-$INFO[MusicPlayer.Album].png</texture>
                <aspectratio align="bottom">keep</aspectratio>
                <visible>!Player.Paused | IntegerGreaterThan(Player.Duration-Player.Time,2) | IntegerGreaterThan(2,Player.Time)</visible>
            </control>

What's wrong here?

Extreme bonus points: could someone explain how, once this is working, I could make it so that the CD will only change if the next song is from a different album?

Thanks for any help!
Reply
#2
MusicPlayer.TimeRemaining and MusicPlayer.Time
Reply
#3
Thanks, that worked perfectly! I think it may have just been a problem with confusing my |s and +s though, cause I had to change those too. Any idea about my second problem?
Reply
#4
check if MusicPlayer.Album equals MusicPlayer.offset(number).Album (in Your case number will be 1) using StringCompare
Reply
#5
I can't get this to work. So when the CD is visible, it will pop out. When it is hidden, it slides back in.

<visible>!Player.Paused + (StringCompare(MusicPlayer.Offset(1).Album,MusicPlayer.Album) | (!StringCompare(MusicPlayer.Offset(1).Album,MusicPlayer.Album) + IntegerGreaterThan(MusicPlayer.TimeRemaining,2) + IntegerGreaterThan(MusicPlayer.Time,1)))</visible>

With this, When the player is not paused and the next album is the same, the CD will always be out. When the player is not paused the next album is different, and if it's not near the begining or end of the song, the CD will be out. Why doesn't it work though?

Note: For some reason random spaces are added in between the "Pl" and "ayer". These are not actually there.
Reply
#6
Try -

StringCompare(MusicPlayer.Offset(1).Album,$INFO[MusicPlayer.Album])
Reply
#7
Which would make the line

<visible>!Player.Paused + [StringCompare(MusicPlayer.Offset(1).Album,$INFO[MusicPlayer.Album]) | [!StringCompare(MusicPlayer.Offset(1).Album,$INFO[MusicPlayer.Album]) + IntegerGreaterThan(MusicPlayer.TimeRemaining,2) + IntegerGreaterThan(MusicPlayer.Time,1)]]</visible>

correct? This still isn't working. But something must be wrong with it though - it diesn't even load like it does when there's an error.
Reply

Logout Mark Read Team Forum Stats Members Help
Changing visibility based on point in song0