M-.-n
Member
Ok.. I'm having a hell of a trouble trying to make the sound driver of LGPT working for LGPT. I'm currently using /dev/dsp to feed audio buffers but the output is chopped. After watching the sound wave, I discovered that one block out of two is endian reversed ! Trying to dig what it was, I ended with this strange behavior:
First situation. I fill my pool buffer with a test saw wave just before copying it to the main sound buffer.
If I do this, I get a chopped result, as below
Second. I copy the pool buffer but then overwrite the main buffer this time with a test triangle wave .
now, altough the result should be the same, my output is fine
Does anybody see any sense in this ? Codewise, I don't see ANY reason for the two bits of code to be different.
FYI, the full driver code is here
Any help/tips more than welcome !!!
First situation. I fill my pool buffer with a test saw wave just before copying it to the main sound buffer.
Code:
short *input=(short *)pool_[poolPlayPosition_];
for(int i=0;i<poolSize_[poolPlayPosition_]/4;i++) {
short v=100*(i%100);
input[i*2]=v;
input[i*2+1]=v;
}
memcpy(mainBuffer_+bufferSize_-bufferPos_, pool_[poolPlayPosition_],poolSize_[poolPlayPosition_]);
If I do this, I get a chopped result, as below
Second. I copy the pool buffer but then overwrite the main buffer this time with a test triangle wave .
Code:
memcpy(mainBuffer_+bufferSize_-bufferPos_, pool_[poolPlayPosition_],poolSize_[poolPlayPosition_]);
// Fill with fixed data
short *input=(short *)mainBuffer_+bufferSize_-bufferPos_;
for(int i=0;i<poolSize_[poolPlayPosition_]/4;i++) {
short v=100*(i%100);
input[i*2]=v;
input[i*2+1]=v;
}
now, altough the result should be the same, my output is fine
Does anybody see any sense in this ? Codewise, I don't see ANY reason for the two bits of code to be different.
FYI, the full driver code is here
Any help/tips more than welcome !!!