hello dafhi,
first of all why you don't use the default device settings ?
how ever if you need a total different setup you must check the curent setting after fbs_init()
i added this in your code:
Code: Select all
print "before fbs_init():"
print "SampleRate:" & rate
print "nChanels :" & nChannels
print "nBuffers :" & buffers
print "nFrames :" & nFrames
fbs_Init(rate,nChannels,Buffers,nFrames,Device)
print "after fbs_init():"
print "SampleRate:" & fbs_Get_PlugRate()
print "nChanels :" & fbs_Get_PlugChannels()
print "nBuffers :" & fbs_Get_PlugBuffers()
print "nFrames :" & fbs_Get_PlugFrames()
The curent values on your box will not be the same as on other boxes.
By the way you will setup only one buffer (why ?)
There isn't any playback device with only one buffer !
One buffer is playing
ever while the others are curently mixed or filled with samples from your code.
The code you posted does exactly what i would accept from.
If you will get in sync you should use a callback may be a SoundCallback.
You are waiting in the main loop 40 milli seconds
looks like you will never pefect in sync with the playback device.
Is this the primary problem ?
Don't foreget your gfx code needs time too !
Again if you try to create a synthy with FBSound
use the default settings and a SoundCallback.
Don't use any own hardcoded values.
For example if your sound device can playback 3 buffers with 800 samples per buffer
how should work your synth on a device with 1024 samples per buffers ?
You know ?
How do you will create the notes for the softsynth via MIDI or the PC keyboard or from a file with notes ?
What are the fastes speed i mean how many beets per minute and ... ?
I can post an simple example as starting point if you need it.
Yes you are right i'm busy but from time to time i read the forum here.
Joshy