freebasic.net Forum Index
FreeBASIC's Official Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log inLog in

FBSound?
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    freebasic.net Forum Index -> General
View previous topic :: View next topic  
Author Message
Galeon

PostPosted: May 30, 2009 8:11    Post subject: FBSound? Reply with quote

I'm creating a FbEdit Addin (Mu6 MP3 Player) that needs a sound library. i currently use fmod. i have v0.03g in my hd.
1. is there a new version of fbsound? any downloads?
2. any tutorials? (i want a tutorial with examples, not examples and don't like the api reference)
3. is it still developed?
4. how to play, pause, stop etc. in this library? (i'm creating an mp3 player)
5. how is it better than fmod? (except cost)
 
Back to top
View user's profile Visit poster's website Yahoo Messenger
KristopherWindsor
Hero
PostPosted: May 30, 2009 8:48    Post subject: Reply with quote

I'm not sure about the current version; you can search the forums.

It was made by a member of the community, while FMOD is a commercial library developed by a team and used in some popular games. So, FMOD should be better. Not that FBSound is bad. ;)
 
Back to top
View user's profile Send e-mail Visit poster's website
Galeon

PostPosted: May 30, 2009 11:16    Post subject: Reply with quote

D.J.Peters made it, am i right?
there is no included example that is like playmp3 in the fbc sound libraries example, that's why i can't study how to use it
 
Back to top
View user's profile Visit poster's website Yahoo Messenger
Sisophon2001
Master
PostPosted: May 30, 2009 15:35    Post subject: Reply with quote

Galeon wrote:
D.J.Peters made it, am i right?
there is no included example that is like playmp3 in the fbc sound libraries example, that's why i can't study how to use it


Fbsound plays mp3 sound files. Look at the documentation. or at test12.bas for an example.

Garvan
 
Back to top
View user's profile Send e-mail Visit poster's website
D.J.Peters
Guru
PostPosted: May 30, 2009 15:37    Post subject: Reply with quote

The last stable version are V0.03h
Download: fbsound0.03h.zip

Learn from the examples (all Sound comands works with MP3 too).
Read the API "fbsound/doc/english.html" doc about all commands.
Scroll down in the doc file to: "The FBSound API in more details:"

Code:
Dim As Integer hWave,hSound
fbs_Int()
fbs_Load_MP3file("file.mp3",@hWave)
fbs_Create_Sound(@hSound,@hWave)
fbs_Play_Sound(hSound)
Sleep


It's open source you can help ;-) write the first FBSound tutorial.

FBSound is primary for Games and Demos.
for an multimedia player i would use another open source lib

Joshy
 
Back to top
View user's profile Visit poster's website
Galeon

PostPosted: May 30, 2009 16:54    Post subject: Reply with quote

i just don't want to read it, it's very long!
and the tutorials are named by number, doesn't have specific names on what they do...
and i also want to help you, but not in creating the lib itself, but in the packaging (tutorials, documentations, examples...) or whatever it is called, but that's after i already know how to use the library (and that's why i'm here), your sound library is the only fb sound lib with a download, others (if any...) are under development or hundred posts below the projects forum
 
Back to top
View user's profile Visit poster's website Yahoo Messenger
Galeon

PostPosted: May 30, 2009 17:05    Post subject: Reply with quote

you're not recommending fbsound for an mp3 player? may i ask why?
what i've seen what it does not have is the stop functionality, new sound without fbs_init, and no callback functions
 
Back to top
View user's profile Visit poster's website Yahoo Messenger
KristopherWindsor
Hero
PostPosted: May 30, 2009 19:18    Post subject: Reply with quote

FMod and FBSound both have the ability to load an MP3 to memory, then play from there. But for an MP3 player, you want to start playing the track before it is loaded to memory (and without ever loading the whole thing to memory). FMod has some additional commands to stream audio like this, but I'd guess FBSound doesn't.

I suggest running all the FBSound tests (demos); they will show you most of FBSound's functionality.
 
Back to top
View user's profile Send e-mail Visit poster's website
Galeon

PostPosted: May 31, 2009 2:15    Post subject: Reply with quote

yes, i'm having problems about callback functions that i have in fmod... as i've seen in the demos, they start the same (call init, set buffer, load mp3, play it), but not when the song ends, the fbs_stop command is used to call init again, not close the file
 
Back to top
View user's profile Visit poster's website Yahoo Messenger
D.J.Peters
Guru
PostPosted: May 31, 2009 3:16    Post subject: Reply with quote

you need only fbs_init()
the commands fbs_stop() fbs_exit() are called from the lib it self.
You can use it manualy for advanced situations.
For example if a player will setup a new samplingrate
or the player will use a second sound card etc.
fbs_Stop() will stop all running threads
fbs_Exit() will free all reserved memory

again normaly you don't need it the destructor will do it for you

you can stop any playing sound
fbs_Set_SoundPause(hSound,True)

now you can set 'optional' a new start or end or play position
fbs_Set_SoundPointers(hSound,[lpStart],[lpPlay],[lpEnd])

after you seeking enable playback
fbs_Set_SoundPause(hSound,False)

if you will remove a sound or wave object from memory use
fbs_Destroy_Wave(@hWave)
fbs_Destroy_Sound(@hWave)

let me now if you run in to trouble

Joshy
 
Back to top
View user's profile Visit poster's website
Galeon

PostPosted: May 31, 2009 4:04    Post subject: Reply with quote

another problem that i have is how to use a callback function if the mp3 stops playing without using timers or checking it every now and then inside the windows procedure, just like fmod has
i like your library because its a static library
 
Back to top
View user's profile Visit poster's website Yahoo Messenger
D.J.Peters
Guru
PostPosted: May 31, 2009 5:56    Post subject: Reply with quote

you are right the Callbacks are only to get samples or the curent position/time for playing sounds not to signal the end of the sound.

in games or demos you have not to wait for the end of sound
most time you must start new sounds for gunshot, explosions, doors ...

but wait you can create your own EndOfSoundCallback
renember the callbacks in fbsound are threads

inside your fbsound callback test of the end of sound
if (lpEnd-lpPlay)<=buffersize then
...
end if
signal your GUI or Main loop or what ever the end of sound.

for example:
if the user clicks on your play button
disable the play button enable the stop/pause buttons
and start the sound playback

now in the fbsound callback if lpPlay comes in the near of lpEnd
disable the stop/pause buttons and enable the play button

you know what i mean?

Joshy
 
Back to top
View user's profile Visit poster's website
creek23

PostPosted: May 31, 2009 12:44    Post subject: Reply with quote

Can I use FBSound to play OGG? Is there a working demo to do it?
 
Back to top
View user's profile Visit poster's website
D.J.Peters
Guru
PostPosted: May 31, 2009 15:17    Post subject: Reply with quote

creek23 wrote:
Can I use FBSound to play OGG? Is there a working demo to do it?
No but you can use more free libs for many sound formats.
You can use Vorbis (Vorbis SDK) to decode OGG files.
pseudo code:
Code:
ov_open() ' read oggFile struc
ov_info() ' get info (samplerate number of channels...)
allocate pReadBuffer
allocate pSoundBuffer
Do
  nBytes=ov_read(pReadBuffer)
  resize pSoundBuffer,nBytes
  add_pReadBuffer_to_pSoundBuffer
Loop While nBytes>0
deallocate pReadBuffer
ov_clear() ' free oggFile struc
'
fbs_Create_Wave(@hWave,pSoundBuffer...)
deallocate pSoundbuffer

fbs_CreateSound(@hSound,hWave)
fbs_Play_Sound(hSound)
Sleep
take a look for vorbis.bi in the include folder
if you have no bi file you can create your own
you have only to declare 4 C functions
ov_open(), ov_info(), ov_read(), ov_clear()

if you have problems with the C part
i'm sure some forum members can help you

happy coding ;-)

Joshy
(again sorry about my bad english)
 
Back to top
View user's profile Visit poster's website
D.J.Peters
Guru
PostPosted: May 31, 2009 20:29    Post subject: Reply with quote

ok i will add fbs_Load_OGGFile() in fbsound

but now i make a garden party (for 2 days)

Joshy
 
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    freebasic.net Forum Index -> General All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



sf.net phatcode