![]() |
|
Sound recording (again) |
Eric Love
Member #846
December 2000
|
I've tried to use the Allegro sound recording routines and I've come to the conclusion that that the DirectX ones don't do what the documentation says they do. My original post was http://www.allegro.cc/forums/view_thread.php?_id=459212 Then I wasn't sure if I was doing it right, but now I think it's a bug. Recording is one of the few parts of Allegro without an example. Does anyone have an example program for recording which has worked for them? |
Elias
Member #358
May 2000
|
I can't test the code myself, but I just looked at the source in src/win/wdsinput.c. It seems to have some frequencies hardcoded, maybe try checking if the frequency is valid, or try with one of the frequencies in there.. [edit] -- |
spellcaster
Member #1,493
September 2001
![]() |
I just wrote a working example. It's not good enough to be an official example, but it should get the idea across. You should call read_sound_input only when needed. To do this, check the size of the input buffer and calculate how many milliseconds will be needed to fill it. While testing it, I got a buffer large enough to hold one second of data. I recommand that we change the documentation accordingly. Instead of: Quote: You must be sure to call this function at regular intervals during the recording (typically around 100 times a second), or some data will be lost.
The documentation should read:
-- |
Eric Love
Member #846
December 2000
|
Thanks spellcaster, your example worked. Something like it should be added to the Allegro examples. I still need to look into it more to see what the effective difference is with mine. In my program I was calling read_sound_input all the time, assuming it would only return non-zero at the appropriate time. It was returning non-zero more often than it was supposed to, giving me buffers which were similar to each other. |
A J
Member #3,025
December 2002
![]() |
i use PortAudio lib. ___________________________ |
spellcaster
Member #1,493
September 2001
![]() |
Quote: still need to look into it more to see what the effective difference is with mine. In my program I was calling read_sound_input all the time, assuming it would only return non-zero at the appropriate time. It was returning non-zero more often than it was supposed to, giving me buffers which were similar to each other.
I did that at first as well (since it was suggested in the docs), and the results are horrible. I guess read_sound_input does something that disturbs the recording slightly. The more often you call it the more problems you'll get. My example should not be added to allegro right now. The code is a mess because I tried lot's of stuff before it worked. The example should also be able to deal with several formats and confirm that these formats actually work, etc. -- |
|