Hello,
I'm trying to write a program which records sound into a raw, binary compressed file. I have no problem with reading that file but when writing to it I have one little problem. Let me explain:
1. I'm creating SoundCapture and starting writing into 'File recfile;' in Init():
Code:
if(!SoundCapture.create(null, 16, 1, 44100))Exit("Failed to capture sound");
if(!recfile.writeTry("Recorded sound")) Exit("Cannot write to recfile!");
recfile.write("Recorded sound");
2. In Update() after checking if the record's buffer is full I'm trying to write that buffer's data into 'recfile' with:
Code:
/* (samples = SoundCapture.size()/SIZE(short)) */
if((SoundCapture.pos()/SIZE(short))>=samples) // HERE
if(!recfile.put(SoundCapture.data(), SoundCapture.size()))
Exit("Cannot put into recfile!");
and HERE is the problem, I don't know when the record's buffer is full (that 'here' condition is never true) so I could 'Put()' that buffer's data into 'recfile'.
Have you got any ideas how can I solve this problem?
Thanks in advance.
Eri
ourgames.eu
P.S. What does the SoundCaptureClass::Update() function? The comment doesn't explain this to me clearly enough.