我正在为iOS创建合成器.在玩完并试图学习核心音频之后,我遇到了一个我无法理解的问题.我的正弦波会定期发出咔哒声,我猜这与相位有关.我看过几本关于这个主题的指南和书籍,并且都表明我正确地做了.
如果有人愿意为我查看我的代码,我将不胜感激.
static OSStatus renderInput(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData)
{
// Get a reference to the object that was passed with the callback
// In this case, the AudioController passed itself so
// that you can access its data.
AudioController *THIS = (AudioController*)inRefCon;
// Get a pointer to the dataBuffer of the AudioBufferList
AudioSampleType *outA = (AudioSampleType *)ioData->mBuffers[0].mData;
float freq = THIS->Frequency;
float phase = THIS->sinPhase;
float envValue;
float sinSignal;
// The …Run Code Online (Sandbox Code Playgroud) 我已经设置了一个动画块,以便在用户执行搜索时启动.搜索完成后,将推送新视图.这工作正常,直到用户选择后退按钮并再次尝试搜索,现在动画无法启动.
[UIView animateWithDuration:0.25
delay:0.0
options:(UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveLinear)
animations:^{
_collectionImage.transform = CGAffineTransformMakeRotation(M_PI);
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
Run Code Online (Sandbox Code Playgroud)
在任何人询问之前,动画只是旋转的光盘,并且在推入视图加载时调用完成块.任何有关为什么它不会在多次搜索中制作动画的帮助将不胜感激.
谢谢.
ios ×2
animation ×1
audiounit ×1
core-audio ×1
iphone ×1
synthesis ×1
synthesizer ×1
uiimageview ×1