Re: Crash playing through DLSMusicDevice with large sound fonts
Re: Crash playing through DLSMusicDevice with large sound fonts
- Subject: Re: Crash playing through DLSMusicDevice with large sound fonts
- From: Chris Reed <email@hidden>
- Date: Wed, 25 Jun 2003 14:43:06 -0500
On Wednesday, Jun 25, 2003, at 09:36 US/Central, Robert Grant wrote:
Hi Yasir,
I'm guessing here but I don't think you should be submitting
MIDIEvents in the RenderCallback. The RenderNotification is happening
on the realtime thread and my guess is that the MIDIEvents are taking
too long... Why not submit the events from a non-render thread and
thus let the MusicDevice process them when it's ready?
That's correct. You shouldn't send MIDIEvents to the AU during the
RenderCallback. The best thing to do is install a pre-render
notification callback and submit all MIDI events pertaining to the next
buffer in the pre-render callback.
-chris
Robert.
On Wednesday, June 25, 2003, at 04:58AM, Yasir Assam
<email@hidden> wrote:
Hi,
My code crashes when playing DLSMusicDevice using a particular large
sound
font (the .sft2 in question is approximately 84MB). The same MIDI file
played through other OS X apps that use DLSMusicDevice don't crash
when
played through this sound font, so I don't think the sound font is at
fault.
Oddly, when I set the CPU load (using kAudioUnitProperty_CPULoad) to
values
<= 0.7 the crash goes away, so it seems connected to how much CPU
time the
DLSMusicDevice uses.
Rendering is pretty simple. After initialization I call:
AudioUnitSetRenderNotification(dev, RenderCallback, 0);
and then the render notification callback is:
OSStatus RenderCallback( void* ref,
AudioUnitRenderActionFlags flags,
const AudioTimeStamp*,
UInt32 bus,
UInt32 numFrames,
AudioBufferList* bufList)
{
if (ref && (flags & kAudioUnitRenderAction_PreRender)) {
// Loop through all events that need to be played now
while (moreEvents) {
MusicDeviceMIDIEvent(dev, status, byte1, byte2, 0);
//...code left out
}
}
return noErr;
}
(the code has been edited for clarity)
The crash happens somewhere inside the MusicDeviceMIDIEvent call,
about 11
calls deep.
Is there a known issue with DLSMusicDevice and large sound fonts
crashing
when the system is under strain? The crash could be due to a problem
elsewhere in my code of course, but I wanted to check to see if
there's a
known issue.
Another problem is that the sound font does sound pretty bad (loads of
crackles. glitches etc.) I presume this is due to lack of CPU cycles
and
there's not much I can do other than optimize my app generally. Is
this is
the case?
Thanks,
Yasir Assam
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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.