BASS.DLL -- looping a sound?

Blitz3D Forums/Blitz3D Programming/BASS.DLL -- looping a sound?

Roland(Posted 2008) [#1]
Hey all,

I've been trying (and getting very frustrated) trying to integrate Bass.dll into my project so that I can use the extra features. Unfortunately, I can't seem to accomplish much!

I need to play back several mp3's and loop them, as well as have them sync up so they start at the same time. Would anyone have any code lying around to help me do this?

I've tried using the "BASS_ChannelSetFlags" function, but it doesn't seem to work, or maybe i'm missing something!

thanks!
roland


Abrexxes(Posted 2008) [#2]
Hi,

if you willto work on more channels the best way is to work with "channelgroups". That mean that if you start one, every channel in this goup will start, pause, stop the same time. (see bass.chm)

I dont now why the channelflag "loop" want to work in your case. What you can do is with with "BASS_ChannelGetPosition" or "BASS_ChannelIsActive".But all of them are not realy cool. So..sorry i will look at this in the next (24)houres! (I came from work now..so ...)

A) You must work casesensitive
B) You must at least work with BBS 1.3.5
C) post a little code if it is possible (*thanks*)


Dont forget that the flags are "CASESENSITIVE". But in every case, your problem i (a 1A problem that i) must solve in the next houres if it is one, so wait out.

bye


Roland(Posted 2008) [#3]
Hey Abrexxes! Thanks for the reply. I'll try to post some code later on today.

What i've found is that there isn't a function in the bass.bb file the BASS_Channel_SetFlags()... So I don't even know if the wrapper supports this yet??? It is in the Decls, though. I guess i'm a little out of my depth here.

The concept of channel groups sounds perfect for what I am doing -- i think that this would be really helpful. If you could help me with some demo code that groups 3 channels of mp3s together and loops them that would be a HUGE help to me!

Thanks for all your hard work on this -- I know it's really time-consuming and i appreciate it very much.

best,
roland


Abrexxes(Posted 2008) [#4]
Ups...what you search is "BASS_ChannelSetLink" and "BASS_ChannelRemoveLink"


Linked channels are started/stopped/paused/resumed together. Links are one-way, for example, channel chan will be started by channel handle, but not vice versa unless another link has been set in that direction.



I will see this weekend for the loop problem. For the moment you can maybee work with BASS_ChannelIsActive to restart after ending.

bye


Roland(Posted 2008) [#5]
Hey Abrexxes,

I just was able to get the sounds to loop by setting the flag when I started the stream. Before I'd tried to use the "BASS_ChannelSetFlags()", which is in the decls, but doesn't seem to be wrapped.

Here's how i am now able to loop a sound:
music = BASS_StreamCreateFile(0,"media\loop6.mp3",0,0,BASS_SAMPLE_LOOP)


this seems to work great! But when i tried the "BASS_ChannelSetLink", that gives me the same error as the setflags, "Userlib not found". I think that these commands would need to be wrapped as well.

thanks again for your help! Let me know if you can get the linking working!

cheers,
roland


Abrexxes(Posted 2008) [#6]
It seems that you have and OLD bass.dll in your windows/system32 folder. Search it and delete it. The bass.dll has nothing to do in the OS system.

This errors are still because windows search first in his system folder for dlls, after this in the mainfolders of the applications. So...you "recent" bass.dll version is ignored and you use an older one, installed by a programm done by a lamer (copy bass.dll in system32)

use the "BASS_GetVersion()" command to see the bass.dll used, there you must have 02030003 (version 2.3.0.x ) ;

version = BASS_GetVersion()
Text 0,20,"Bass version : " +Hex$(version)


EDIT: Ohh. i see a bug there XD. I will take a look


Abrexxes(Posted 2008) [#7]
Ok sorry, i was really an idiot -.- reload bbs (1.6.1) or just make this changes in your bass.decls.

Still hope all this works now.


----- v.1.6.1
* Changed file bass.decls
- Fixed BASS_ChannelSetLink Error
- Fixes BASS_ChannelSetFlags Error
(You dont need to reload if you have still 1.6.0, just edit this line in your bass.decls)
-->BASS_ChannelSetLink%(Handle, chan%) : "BOOL BASS_ChannelSetLink"
to : BASS_ChannelSetLink%(Handle, chan%) : "BASS_ChannelSetLink"
-->BASS_ChannelSetFlags%(Handle,flags%) : "BOOL BASS_ChannelSetFlags"
to : BASS_ChannelSetFlags%(Handle,flags%) : "BASS_ChannelSetFlags"
(WTH i have made there -.-, sorry for this guys and thanks to Roland to report this!)



Sorry Roland, for the moment i can only work the weekend on my "big" machine. For the rest i use a good old Pentium I (one). :) If there is still a problem with this commands i can only fix that this weekend (as i can make tests). But ..you was right, what i have made there CAN NOT WORK! -.- So, feel free to report every problem about this (and other thinks) Thanks a lot!

bye


Roland(Posted 2008) [#8]
Hey, that works now! Awesome!

Don't worry about the bug Abrexxes -- I'm so thankful to you for putting this lib together... Now I can try to integrate it into my program :)

I'll let you know if I find anything else!

best,
roland