我收到崩溃日志,查找无法重现的错误。崩溃只发生在32位设备(iPad 4,3,iPad Mini)上,所以我认为这是问题的主要部分。
在计算过滤器的系数时,会在音频线程上发生崩溃。过滤器由C结构和相关函数组成......一旦我遇到需要为32位设备正确对齐结构的问题,但我不确定这是什么情况(我不知道我是怎么做的)会测试!)
除此之外,我很难过。这是它崩溃的函数的前几行。 cos函数是崩溃日志的倒数第二帧。
void _calculateWithoutUpdatingSetup(ONCBiquadFilter * filter) {
if (filter->res < 0.01) filter->res = 0.01;
filter->omega = 2 * M_PI * filter->freq / sampleRate;
filter->omegaS = sin(filter->omega);
filter->omegaC = cos(filter->omega);
filter->alpha = filter->omegaS / (2 * filter->res);
///... do a bunch of maths to calculate filter settings
}
这是崩溃日志:
18
Crashed: AURemoteIO::IOThread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000
Crashed: AURemoteIO::IOThread
0 myFramework 0x41077a _calculateWithoutUpdatingSetup + 2417
1 libsystem_m.dylib 0x20b229d8 cos + 584
2 myFramework 0x40fa2f ONCBiquadFilterCalculateCoefficients + 14
3 myFramework 0x40fd03 ONCBiquadFilterSetFrequencyAndResonance + 214
4 myFramework 0x414c7b ONCAterotVoiceSetFilterCutoffAndResonance + 206
5 myFramework 0x407677 ONCAterotPolyVoicePlay + 452
6 myFramework 0x3e0d61 ONCAterotLoopStructTick + 1092
7 myApp 0x21333 DSPRenderCallback (ONCAterotAudioController+AudioRenderCallbacks.m:367)
8 myApp 0x20b0f renderCallback (ONCAterotAudioController+AudioRenderCallbacks.m:73)
9 AudioToolbox 0x233224b3 AUInputElement::PullInput(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long) + 126
10 AudioToolbox 0x234379ab AUMatrixMixer::Render(unsigned long&, AudioTimeStamp const&, unsigned long) + 554
11 AudioToolbox 0x234385a5 AUMatrixMixer::RenderBus(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long) + 104
12 AudioToolbox 0x23227d01 AUBase::DoRenderBus(unsigned long&, AudioTimeStamp const&, unsigned long, AUOutputElement*, unsigned long, AudioBufferList&) + 148
13 AudioToolbox 0x23227b91 AUBase::DoRender(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long, AudioBufferList&) + 740
14 AudioToolbox 0x232278a3 AUMethodRender(void*, unsigned long*, AudioTimeStamp const*, unsigned long, unsigned long, AudioBufferList*) + 46
15 myApp 0x65d29 eqCallBack (ONCAterotAudioController+effectCallbacks.m:110)
16 AudioToolbox 0x233224b3 AUInputElement::PullInput(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long) + 126
17 AudioToolbox 0x233f21b1 AUDynamicsProcessor::Render(unsigned long&, AudioTimeStamp const&, unsigned long) + 308
18 AudioToolbox 0x23227d01 AUBase::DoRenderBus(unsigned long&, AudioTimeStamp const&, unsigned long, AUOutputElement*, unsigned long, AudioBufferList&) + 148
19 AudioToolbox 0x23227b91 AUBase::DoRender(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long, AudioBufferList&) + 740
20 AudioToolbox 0x232278a3 AUMethodRender(void*, unsigned long*, AudioTimeStamp const*, unsigned long, unsigned long, AudioBufferList*) + 46
21 AudioToolbox 0x23318d89 AUConverterBase::RenderBus(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long) + 396
22 AudioToolbox 0x23227d01 AUBase::DoRenderBus(unsigned long&, AudioTimeStamp const&, unsigned long, AUOutputElement*, unsigned long, AudioBufferList&) + 148
23 AudioToolbox 0x23227b91 AUBase::DoRender(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long, AudioBufferList&) + 740
24 AudioToolbox 0x2330864b AURemoteIO::PerformIO(unsigned long, unsigned int, unsigned int, AudioTimeStamp const&, AudioTimeStamp const&, AudioBufferList const*, AudioBufferList*, int&) + 506
25 AudioToolbox 0x23309851 AURIOCallbackReceiver_PerformIO + 596
26 AudioToolbox 0x232ff67b _XPerformIO + 166
27 AudioToolbox 0x23245d69 mshMIGPerform + 184
28 AudioToolbox 0x232d6533 MSHMIGDispatchMessage + 34
29 AudioToolbox 0x23308973 AURemoteIO::IOThread::Run() + 118
30 AudioToolbox 0x2330c331 AURemoteIO::IOThread::Entry(void*) + 8
31 AudioToolbox 0x232238db CAPThread::Entry(CAPThread*) + 186
32 libsystem_pthread.dylib 0x20bbcc7f _pthread_body + 138
33 libsystem_pthread.dylib 0x20bbcbf3 _pthread_start + 110
34 libsystem_pthread.dylib 0x20bbaa08 thread_start + 8
感谢您解决此问题的任何指导!
更新:我确实注意到了我的一些错误 - freq,res和sampleRate都是浮点数,而其余的值都是双倍的。我可以看到这可能是问题的一部分,虽然我有点怀疑它,因为他们应该被提升为双打。