#include "fbsound_dynamic.bi"
dim shared as integer IsPlaying
sub playmp3(f as STRING)
if IsPlaying then FBS_End_MP3Stream()
FBS_Create_MP3Stream(f)
FBS_Play_MP3Stream()
IsPlaying=true
sleep
End Sub
if FBS_Init()=false then
print "Failed to init fbsound"
else
playmp3("test.mp3")
playmp3("test2.mp3")
end if
sleep
but it crashes right away without playing anything... Aborting due to runtime error 12 ("segmentation violation" signal) in ~/fbsound_test.bas::PLAYMP3()
same thing works on windows 7 32bit... i assume its a bug on fbsound itself
#include "../inc/fbsound_dynamic.bi"
if FBS_Init()=false then
print "Failed to init fbsound"
beep:sleep:end 1
end if
dim as integer hWave1
if FBS_Load_MP3File("test.mp3",@hWave1)=false then
print "Failed to load 'test.mp3' !"
beep:sleep:end 1
end if
print "test.mp3 loaded"
dim as integer hWave2
if FBS_Load_MP3File("test2.mp3",@hWave2)=false then
print "Failed to load 'test2.mp3' !"
beep:sleep:end 1
end if
print "test2.mp3 loaded"
print "press [1] or [2] or [ESC]"
var key = inkey()
while key<>chr(27)
if key="1" then ? "1" : FBS_Play_Wave(hWave1)
if key="2" then ? "2" : FBS_Play_Wave(hWave2)
sleep 100
key = inkey()
wend
if you need two playing MP3 streams one after the other use this:
#include "../inc/fbsound_dynamic.bi"
sub playmp3(f as STRING)
while FBS_Get_PlayingStreams()>0
print ".";
FBS_End_MP3Stream()
sleep 100
wend
if FBS_Create_MP3Stream(f)=false then
print "error: can't ceate mp3 stream " & f & " !"
else
FBS_Play_MP3Stream()
while FBS_Get_PlayingStreams()=0
sleep 100
wend
end if
End Sub
if FBS_Init()=false then
print "Failed to init fbsound"
else
' play stream test.mp3 for one second !
playmp3("test.mp3")
sleep 1000
' play stream test2.mp3
playmp3("test2.mp3")
end if
sleep
D.J.Peters wrote:if you need two playing MP3 streams one after the other use this:
that didnt solved it on linux.... still crashes misteriously
(i even added extra checks to make sure it does not try to do something when creating the stream/play fails)
but no dice...