Jump to content
Tuts 4 You

Bass.net BASS_ChannelGetLength


Accede

Recommended Posts

I make this function that i get the length of the fasttracker modules but i get no return.

My function looks like this :

        public string Getlength(string nm)
        {
            long len = Bass.BASS_ChannelGetLength(HMUSIC,BASSMode.BASS_POS_BYTES);//gets the length of the mod file as bytes
            double time = Bass.BASS_ChannelBytes2Seconds(HMUSIC, len);//convert mod bytes to seconds            return nm;        }

This is how i call it player.getlength(label2.text);

I hope some one can help my on this,is for are littel player on c#.

I solved it by my self.her is the code if some on has the same prop with bass.net

public string Getlength(string name2)        {            BASSActive status = Bass.BASS_ChannelIsActive(HMUSIC);             if (status == BASSActive.BASS_ACTIVE_PLAYING)            {             long pos = Bass.BASS_ChannelGetPosition(HMUSIC);             long len = Bass.BASS_ChannelGetLength(HMUSIC);             Double totaltime = Bass.BASS_ChannelBytes2Seconds(HMUSIC, len);             Double elapsedtime = Bass.BASS_ChannelBytes2Seconds(HMUSIC, pos);             Double remainingtime = totaltime - elapsedtime;             name2 = String.Format("Elapsed: {0:#0.00} - Total: {1:#0.00} - Remain: {2:#0.00}", Utils.FixTimespan(elapsedtime, "MMSS"), Utils.FixTimespan(totaltime, "MMSS"), Utils.FixTimespan(remainingtime, "MMSS"));            }          return name2.ToString();        }
Edited by accede
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...