gpt4 book ai didi

iphone - Objective C 中的 ~ 前缀

转载 作者:行者123 更新时间:2023-11-28 18:14:38 25 4
gpt4 key购买 nike

我一直在学习 iPhone 上的核心音频,在查看 Apple 的示例代码时,我发现了这一点:

#include <AudioToolbox/AudioToolbox.h>

#include "CAStreamBasicDescription.h"
#include "CAXException.h"

#define kNumberBuffers 3

class AQPlayer
{
public:
AQPlayer();
~AQPlayer();

OSStatus StartQueue(BOOL inResume);
OSStatus StopQueue();
OSStatus PauseQueue();

AudioQueueRef Queue() { return mQueue;}
CAStreamBasicDescription DataFormat() const { return mDataFormat; }
Boolean IsRunning() const { return (mIsRunning) ? true : false; }
Boolean IsInitialized() const { return mIsInitialized; }
CFStringRef GetFilePath() const { return (mFilePath) ? mFilePath : CFSTR(""); }
Boolean IsLooping() const { return mIsLooping; }

void SetLooping(Boolean inIsLooping) { mIsLooping = inIsLooping; }
void CreateQueueForFile(CFStringRef inFilePath);
void DisposeQueue(Boolean inDisposeFile);

private:
UInt32 GetNumPacketsToRead() { return mNumPacketsToRead; }
SInt64 GetCurrentPacket() { return mCurrentPacket; }
AudioFileID GetAudioFileID() { return mAudioFile; }
void SetCurrentPacket(SInt64 inPacket) { mCurrentPacket = inPacket; }

void SetupNewQueue();

AudioQueueRef mQueue;
AudioQueueBufferRef mBuffers[kNumberBuffers];
AudioFileID mAudioFile;
CFStringRef mFilePath;
CAStreamBasicDescription mDataFormat;
Boolean mIsInitialized;
UInt32 mNumPacketsToRead;
SInt64 mCurrentPacket;
UInt32 mIsRunning;
Boolean mIsDone;
Boolean mIsLooping;

static void isRunningProc( void * inUserData,
AudioQueueRef inAQ,
AudioQueuePropertyID inID);

static void AQBufferCallback( void * inUserData,
AudioQueueRef inAQ,
AudioQueueBufferRef inCompleteAQBuffer);

void CalculateBytesForTime( CAStreamBasicDescription & inDesc,
UInt32 inMaxPacketSize,
Float64 inSeconds,
UInt32 *outBufferSize,
UInt32 *outNumPackets);
};

有谁知道这一行的作用:~AQPlayer();没见过~这个符号用过。

最佳答案

这与 c 无关。它看起来像 c++,在这种情况下,~ 是该类的 desctructor。您可能想阅读 C++ FAQ 中的析构函数。

关于iphone - Objective C 中的 ~ 前缀,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5136300/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com