I am going over a sample project from Apple called Mixer Host. In the callback function there are a few lines which use the “->” syntax to refer to mBuffers which is a struct. I thought this was C++ syntax but this file has a .m extension which I thought was C plus Objective-C extensions. Is this actually C++ syntax? Can I put C++ syntax into a .m file without renaming it as .mm with Xcode?
AudioUnitSampleType *outSamplesChannelLeft;
AudioUnitSampleType *outSamplesChannelRight;
outSamplesChannelLeft = (AudioUnitSampleType *) ioData->mBuffers[0].mData;
if (isStereo) outSamplesChannelRight = (AudioUnitSampleType *) ioData->mBuffers[1].mData;
No, that’s perfectly valid C. It’s how you refer to data members via a pointer in both C and C++.
In C++ you can also refer to member functions that way, but there’s no function call in sight.