Bass Bytes2Seconds?
Blitz3D Forums/Blitz3D Userlibs/Bass Bytes2Seconds?
| ||
Hi. I need some help with the BASS wrapper. I am using BASSex at the moment. Basically, to get the playback seconds of a mp3, you need to put in the main loop the following: Position = BASS_ChannelGetPosition (Stream) Seconds = BASS_ChannelBytes2Seconds(Stream,Position) (where Stream is the Bass stream playing). Everything is correct if I just use the first line, to get Bytes played, but as soon as I add ChannelBytes2Seconds everything goes crazy and the app crashes. I've noticed that if I put the variable "Seconds" as float, the result I have is something like 2.82343e+011... What am I doing wrong???? Thanks |
| ||
Seconds *should* be a float. See the header files? float BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos); Also note that pos is a QWord ( QuadWord or in other words a 64 bit integer. ) I don't know if that is causing you problems or not, but it might. You might be feeding an incorrect position value because you're only passing a 32 bit int. If that's it, you'll need to fake a 64bit value. I expect someone has written something to do this. |
| ||
Hi Gabriel, Thanks a lot for the answer. I will have a look at that, as it might well be where the problem lies... |
| ||
mr.ninja Did you found the way to convert blitz integer into qword? I'm currently working on BASS decls for 2.3 version of BASS lib. Some functions need qwords: BASS_ChannelBytes2Seconds BASS_ChannelGetLength BASS_ChannelGetPosition BASS_ChannelSeconds2Bytes BASS_ChannelSetPosition BASS_ChannelSetSync |
| ||
mr.ninja I've found the way to solve this problem. If you need to pass QWORD value just change DECLS like this: BASS_ChannelSetPosition Handle%, Pos ;<--QWORD, so does not work, because blitz does not support 64bit inegers write like this: BASS_ChannelSetPosition Handle%, Pos, Pos2 And use this function like this: BASS_ChannelSetPosition MusicChannel, 12345, 0 You will pass lo value of 64bit qword, hi value will be set to 0. It will be enough for usual music tracks. Functions like BASS_ChannelGetLength or BASS_ChannelGetPosition will recieve lo 32 bit, but it is enough for usual needs too. |