[lua]
hook.Add("Think", "AutoPlayNext", function( p )
if channel:getplaying() != nil then
//if channel:getposition() > 1 and channel:getposition() >= channel:getlength() then
if channel:getlength() <= channel:getposition() then
print("NEXT: " .. channel:getposition() .. " " .. channel:getlength())
if table.Count(Queue) >= 1 then
local key = table.KeyFromValue(Queue, song .. ":" .. url)
if table.HasValue(Queue, song .. ":" .. url) then
table.remove(Queue, key)
local newsong = table.GetFirstValue(Queue)
newsong = string.Explode(":", newsong)
print(newsong[1], newsong[2])
PlaySong( newsong[1], newsong[2])
end
end
end
end
end)
[/lua]
This should only auto play the next song when the current one is "over" but a second after it start it auto plays the next.
It's possible that channel:getlength is returning zero while the song is loading, or something along those lines. I would debug it by doing
[lua]print(channel:getlength(),channel:getposition())[/lua]
And see what values you're getting when the player messes up.
Is their any documentation for the Bass Module? I've been searching before but couldn't find one :(
[QUOTE=Ideal-Hosting;32124392]Is their any documentation for the Bass Module? I've been searching before but couldn't find one :([/QUOTE]
There's none. The source is available though so it's pretty straightforwards to see what does what.
[QUOTE=Ideal-Hosting;32124392]Is their any documentation for the Bass Module? I've been searching before but couldn't find one :([/QUOTE]
You could also just print the BASS and the meta table to see which functions you have.
[lua]
List of functions:
* BASS.StreamFile( string path ) --Returns BASS channel on success, false on fail
* BASS.StreamFileURL( string path, int, function callback ) --Can't remember what it returns
* BASS.SetPosition( vec Pos, vec Vel, vec Front, vec Up ) --Sets 3D position in world
* BASS.p_PendingChannels --No idea what this is
List of metafunctions for BASS channels:
* play()
* pause()
* stop()
* getlength()
* getposition()
* gettag( string Format ) --Returns formated tags
* getplaying()
* getlevel()
* setposition( number noIdeaWhat )
* setvolume( float volume )
* fft2048() --No idea
* set3dposition( vec Pos, vec Orientation, vec Velocity)
* getrawtag( int )
[/lua]
[QUOTE=Entoros;32122537]It's possible that channel:getlength is returning zero while the song is loading, or something along those lines. I would debug it by doing
[lua]print(channel:getlength(),channel:getposition())[/lua]
And see what values you're getting when the player messes up.[/QUOTE]
I did this before I can here. They are both valid values. I posted here because for some reason ( 0 > songlength ).
[editline]5th September 2011[/editline]
[media]http://www.youtube.com/watch?v=KMJgx2-KUvE[/media]
Ignore the obvious spelling error.
[b]FOUND MY PROBLEM[/b]
Sorry, you need to Log In to post a reply to this thread.