私が構築しているiPhoneアプリケーション用のObjective-Cのシンセサイザーであるこのプロジェクトを使用しようとしています。MHAudioBufferPlayer
でも、授業で悩んでいます。
MHAudioBufferPlayer.m
クラスで、、、およびに対して大量のUse of undeclared identifier
エラーが発生しています。これらの識別子は前にアンダースコアを付けて宣言されることはないため、これは理にかなっています。ただし、アンダースコアなしでクラスで宣言されています。_gain
_playing
_audioFormat
MHAudioBufferPlayer.h
私はObjective-Cが初めてなので、これにはちょっと混乱しています。下線は特別なアクションを意味しますか? self.gain
、などに翻訳されることになっていself.playing
ますか? どうすればこれを修正できますか? それとも、このコードはただのバグですか?
- (id)initWithSampleRate:(Float64)sampleRate channels:(UInt32)channels bitsPerChannel:(UInt32)bitsPerChannel packetsPerBuffer:(UInt32)packetsPerBuffer
{
if ((self = [super init]))
{
_playing = NO;
_playQueue = NULL;
_gain = 1.0;
_audioFormat.mFormatID = kAudioFormatLinearPCM;
_audioFormat.mSampleRate = sampleRate;
_audioFormat.mChannelsPerFrame = channels;
_audioFormat.mBitsPerChannel = bitsPerChannel;
_audioFormat.mFramesPerPacket = 1; // uncompressed audio
_audioFormat.mBytesPerFrame = _audioFormat.mChannelsPerFrame * _audioFormat.mBitsPerChannel/8;
_audioFormat.mBytesPerPacket = _audioFormat.mBytesPerFrame * _audioFormat.mFramesPerPacket;
_audioFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
_packetsPerBuffer = packetsPerBuffer;
_bytesPerBuffer = _packetsPerBuffer * _audioFormat.mBytesPerPacket;
[self setUpAudio];
}
return self;
}