Re: App hangs after getting DefaultAudioDevices
Re: App hangs after getting DefaultAudioDevices
- Subject: Re: App hangs after getting DefaultAudioDevices
- From: Rolley <email@hidden>
- Date: Thu, 24 Jan 2002 23:00:02 -0500
Hi,
ok well after some testing I've figured that the application actually isn'
t frozen, only the interface !
I put some printlns in the code and the system keeps on calling my queue's
enqueue() and dequeue() methods while the interface is un-responsive.
Bill Stewart wrote
<<Because an AudioBufferList is generally built for you by the HAL, and
its the AudioBuffer objects that are the real meat of the problem... None
of the higher APIs deal with these lists at the moment.
I can always add this constructor for you - but it would help for me to
know
why you want to build these yourself.>>
I'll give you a glimpse of how I wrote this and maybe it'll "pop up" to
you what might wrong. hopefully...
Here is my code to start up the input and output devices :
/*** those two lines freeze the interface, but the rest of the code is
still executed
***/
inputDevice = AudioHardware.getDefaultInputDevice();
outputDevice = AudioHardware.getDefaultOutputDevice();
/*** this is my own Queue where I store AudioBuffers
the reason why I wanted to create an AudioBufferList is because I
wanted to store AudioBufferLists into my queue. As some docs say, I have
to make a copy of it the data. But since I can't create an AudiobufferList
though, what I store in my queue now is an array of AudioBuffers.
***/
bufferQueue = new LogicAmp_Queue(null);
/*** LogicAmp_InputDeviceIOProc is my class that extends AudioDeviceIOProc
in it is the execute(...) method that is called when there is some
input data to be stored in the bufferQueue or sent to output.
***/
inputIOProc = new LogicAmp_InputDeviceIOProc(bufferQueue);
outputIOProc = new LogicAmp_OutputDeviceIOProc(bufferQueue);
inputDevice.addIOProc((AudioDeviceIOProc)inputIOProc);
outputDevice.addIOProc((AudioDeviceIOProc)outputIOProc);
inputDevice.start(inputIOProc);
outputDevice.start(outputIOProc);
I did pretty much what I saw done in Obj-C.
One last question, to copy an AudioBuffer, is
copyFromTo((CAMemoryObject)inBuffer,0,(CAMemoryObject)outBuffer,0,sizeInBytes)
;
correct ? It's what I use either to store the AudioBufferList's buffers
(so when my LogicAmp_InputDeviceIOProc's execute(..) is called) or to
release them (in my LogicAmp_OutputDeviceIOProc's execute(...,
AudioBufferList outOutputData, ...) where I put a copy of my queue's
AudioBuffers to each outOutputData's AudioBuffers).
But I guess the copyFromTo is not the way to go. Maybe I should take care
of the number of channels or ..., because even though AudioBuffers are
enqueued and dequeued no sound is played.
Thanks again,
keep me informed of the Java Update you'll release,
Rolley
On Thursday, January 24, 2002, at 08:17 PM, Bill Stewart wrote:
>
There will shortly be a release of a Java Update that will contain several
>
things of interest:
>
(1) Fixes in Java that mean that CAJava will work correctly in all Cocoa
>
Java situations
>
(2) Some substantially performance fixes in CAJava, particularly related
>
to
>
audio and MIDI callbacks (as used by the HAL and MIDI-In calls, AU Render
>
callbacks) and some overall improvements to resource usage.
>
>
I think the problem you're seeing maybe related to the busted interactions
>
between Java and Cocoa that we believe is fixed with the update. A good
>
way
>
to verify this is to take that code and run it in a java.awt app.. Several
>
examples in CoreAudio/Examples/Java get the default device and it works
>
fine
>
>
Bill
>
>
on 23/1/02 9:37 PM, Rolley wrote:
>
> Arrrgh,
>
>
>
> I am stuck on this ?&* bug : after any call that give either the
>
> DefaultInputDevice or DefaultOutputDevice or getAudioDevices, my
>
> application freezes. What I get with getAudioDevices() is that the only
>
> AudioDevice I have is the built-in-controller. Is that ok ?
>
>
>
> Hum, this is quite strange cos the same code in Obj-C works ! Argh, my
>
> joy
>
> of mixing Cocoa and Java has gotten quite low. But then I don't have the
>
> time to learn Obj-C right now... but if you know of a good online
>
> reference (or tutorial) for Obj-C let me know.
>
>
>
> Oh and by the way if you have the solution to my problem...
>
>
>
> thx
>
> Rolley
>
> _______________________________________________
>
> coreaudio-api mailing list | email@hidden
>
> Help/Unsubscribe/Archives:
>
> http://www.lists.apple.com/mailman/listinfo/coreaudio-api
>
> Do not post admin requests to the list. They will be ignored.
>
>
>
mailto:email@hidden
>
tel: +1 408 974 4056
>
__________________________________________________________________________
>
"We'll talk about it later...."
>
"When?"
>
"In a future life when we're both cats"
>
__________________________________________________________________________