Page 1 of 1

TStockAudioRecorder

PostPosted: January 23rd, 2006, 5:58 am
by softtouch
I am getting more and more MMSYSERR_ERROR with tstockaudiorecorder, I mean, the onerror event is triggered.

if mmioWrite(mmIO, PChar(Buffer), BufferSize) <> Integer(BufferSize) then
Success(MMSYSERR_ERROR); // Raises an OnError event

This happen more and more on different systems with different soundcards.

I call:
recorder.RecordToFile(extractfiledir(application.exename)+'\recording.wav');

Reason is that the amount of written bytes differs fro mthe amount of buffersize. But in msdn is written that it is only an errir IF the return result is -1.

PostPosted: January 23rd, 2006, 2:55 pm
by Kambiz
Could you please specify how you set the properties of the component?

PostPosted: January 23rd, 2006, 4:10 pm
by softtouch
Async: true
Buffercount: 2
Bufferlength: 1000
PCMFormat: Stereo16bit22050hz

It works fine on one computer, but not on another. I tested so far all in all around 20 computersystems, on 1/3 of them, it gives that error.

PostPosted: January 29th, 2006, 4:12 am
by softtouch
I have figured out that if I exit my test program, start it again, it will record one time again. So it has something to do with the initialization of the component. Is there a way to re-initialize the component at runtime?

PostPosted: January 29th, 2006, 4:44 am
by Kambiz
It would be nice if we could have a look over your test program's code.

PostPosted: January 29th, 2006, 5:17 am
by softtouch
Kambiz wrote:It would be nice if we could have a look over your test program's code.


There is not much to see, I just create a form, drop the component (tstockaudiorecorder and tstockaudioplayer) on the form, set the sampling rate to 16bit, stereo, 22050hz and call on a buttonclick:

recorder.active:=false;
recorder.RecordToFile(extractfiledir(application.exename)+'\recording.wav');
waiting loop for 5 seconds and then:
recorder.stop;
recorder.active:=false;

Next, I play the file with:
player.PlayFile(extractfiledir(application.exename)+'\recording.wav');
player.WaitForStop;

but no playback, quiet. If I play it via mediaplayer etc., if plays fine, for 5 seconds, but the playfile / waitforstop returns immediately with no playback at all.

I tried ALL sampling rates/bit rates, mono, stereo etc. and can record ONCE with 16 bit stereo, 22050hz. No other sampling rates at all. If I quit the program and start it again, so that the component is initialized, I can again play ONCE.

This is not happen on every computer, just on a couple of them. I tested now all in all above 20 computer, on 4 of them, it did not play. On other, if worked ALWAYS, with any sampling rate, without restarting. I believe it has something to do with the target computer, the installed audio driver etc., but WHY does it record again after I restart the program? What is the component doing at initialization what I could do at runtime?

PostPosted: January 29th, 2006, 8:27 pm
by Kambiz
Could you please check out my code on your machines?

PostPosted: January 30th, 2006, 1:05 am
by softtouch
Your code is 99% the same than my. Also, it plays on exact the same computer than my does. On my computer (6), all with asus board, integrated audio (soundmax), it plays always, with any sampling rate. On some other computers of some friends in the US, which are using microphones connected to usb and radio shack lavalier mikes, there is just NO playback. It works there just once, after starting the program and recording, it plays the wave, only with 16 bit, stereo, 22050hz. If they want to record/playback again, they have to restart the program, so it will work again ONCE.

I changed the test program so that it creates the tstockaudiorecorder and player at runtime and will wait for their results, which take a while because of the timezone difference, I am 13 hours ahead here.

Guenter

PostPosted: February 3rd, 2006, 8:45 am
by softtouch
Latest news:
If I create the tstockaudiorecorder and player manually everytime they want to record, it works fine. If I just drop the components on the form, it works only once.

So the components are doing something which need to be done everytime they want to record/playback on some computer. What could that be?

PostPosted: February 3rd, 2006, 12:00 pm
by Kambiz
To figure out which class causes this problem, could you please answer the following questions?

  1. Does the problem occure in both TStockAudioRecorder and TStockAudioPlayer?
  2. What about TAudioRecorder and TAudioPlayer components?
  3. Does it depend to the wave format?
  4. What about if Async property set to False (or vice versa)?

Thanks in advance for your help.

PostPosted: February 3rd, 2006, 12:25 pm
by softtouch
Kambiz wrote:To figure out which class causes this problem, could you please answer the following questions?

  1. Does the problem occure in both TStockAudioRecorder and TStockAudioPlayer?
  2. What about TAudioRecorder and TAudioPlayer components?
  3. Does it depend to the wave format?
  4. What about if Async property set to False (or vice versa)?
Thanks in advance for your help.


I have to create a new test application which uses all components (tstock... and taudio...) to be able to tell you more. Will do this tonight and will post results soon I get a response from US.

All I know at this time is that if I drop the tstockaudiorecoder on the form, the onerror event is triggers soon I start recording. This is not the case if I just create an instance of the tstockaudiorecorder via .create

If I create the instances of both, recorder and player, it works (only one setting, 16 bit stereo, 22050hz).

But I will as mentioned report asap, once I have the test app done and got a response.

PostPosted: February 3rd, 2006, 1:57 pm
by Kambiz
Thank you very much for your great help.

By the way, are you sure there is no version confilict between Wave Audio package files you have installed on Delphi and the package files on the unit/library search path?

PostPosted: February 3rd, 2006, 2:01 pm
by softtouch
Kambiz wrote:Thank you very much for your great help.

By the way, are you sure there is no version confilict between Wave Audio package files you have installed on Delphi and the package files on the unit/library search path?


No, no version conflict. I checked it already.

PostPosted: February 5th, 2006, 10:00 am
by Tommyjunge
I seemto have the same problem with LiveAudioRecorder. When async is set true I could not restart a recording.
This was the case on a machine with VIA Chipset and built in VIA AC97 Sound.
Tested same machine with soundblaster 24bit soound card:
Problem is gone. Same on my old 400MHz Pentium with Aztech sound.

So it depends on the soundcard!

How do I use LiveAudioRecorder manually instead of dropping it onto the form in order to solve the problem?

Regards, Thomas