Qt 4.8
Public Functions | Properties | List of all members
QtMultimediaInternal::QAudioBufferList Class Reference

Public Functions

AudioBufferList * audioBufferList () const
 
qint64 bufferSize (int buffer=0) const
 
char * data (int buffer=0) const
 
int frameCount (int buffer=0) const
 
int packetCount (int buffer=0) const
 
int packetSize () const
 
 QAudioBufferList (AudioStreamBasicDescription const &streamFormat)
 
 QAudioBufferList (AudioStreamBasicDescription const &streamFormat, char *buffer, int bufferSize)
 
 QAudioBufferList (AudioStreamBasicDescription const &streamFormat, int framesToBuffer)
 
void reset ()
 
 ~QAudioBufferList ()
 

Properties

AudioBufferList * bfs
 
int dataSize
 
bool owner
 
AudioStreamBasicDescription sf
 

Detailed Description

Definition at line 71 of file qaudioinput_mac_p.cpp.

Constructors and Destructors

◆ QAudioBufferList() [1/3]

QtMultimediaInternal::QAudioBufferList::QAudioBufferList ( AudioStreamBasicDescription const &  streamFormat)
inline

Definition at line 74 of file qaudioinput_mac_p.cpp.

Referenced by QtMultimediaInternal::QAudioInputBuffer::QAudioInputBuffer().

74  :
75  owner(false),
76  sf(streamFormat)
77  {
78  const bool isInterleaved = (sf.mFormatFlags & kAudioFormatFlagIsNonInterleaved) == 0;
79  const int numberOfBuffers = isInterleaved ? 1 : sf.mChannelsPerFrame;
80 
81  dataSize = 0;
82 
83  bfs = reinterpret_cast<AudioBufferList*>(qMalloc(sizeof(AudioBufferList) +
84  (sizeof(AudioBuffer) * numberOfBuffers)));
85 
86  bfs->mNumberBuffers = numberOfBuffers;
87  for (int i = 0; i < numberOfBuffers; ++i) {
88  bfs->mBuffers[i].mNumberChannels = isInterleaved ? numberOfBuffers : 1;
89  bfs->mBuffers[i].mDataByteSize = 0;
90  bfs->mBuffers[i].mData = 0;
91  }
92  }
Q_CORE_EXPORT void * qMalloc(size_t size)
Definition: qmalloc.cpp:53

◆ QAudioBufferList() [2/3]

QtMultimediaInternal::QAudioBufferList::QAudioBufferList ( AudioStreamBasicDescription const &  streamFormat,
char *  buffer,
int  bufferSize 
)
inline

Definition at line 94 of file qaudioinput_mac_p.cpp.

94  :
95  owner(false),
96  sf(streamFormat),
97  bfs(0)
98  {
100 
101  bfs = reinterpret_cast<AudioBufferList*>(qMalloc(sizeof(AudioBufferList) + sizeof(AudioBuffer)));
102 
103  bfs->mNumberBuffers = 1;
104  bfs->mBuffers[0].mNumberChannels = 1;
105  bfs->mBuffers[0].mDataByteSize = dataSize;
106  bfs->mBuffers[0].mData = buffer;
107  }
Q_CORE_EXPORT void * qMalloc(size_t size)
Definition: qmalloc.cpp:53

◆ QAudioBufferList() [3/3]

QtMultimediaInternal::QAudioBufferList::QAudioBufferList ( AudioStreamBasicDescription const &  streamFormat,
int  framesToBuffer 
)
inline

Definition at line 109 of file qaudioinput_mac_p.cpp.

109  :
110  owner(true),
111  sf(streamFormat),
112  bfs(0)
113  {
114  const bool isInterleaved = (sf.mFormatFlags & kAudioFormatFlagIsNonInterleaved) == 0;
115  const int numberOfBuffers = isInterleaved ? 1 : sf.mChannelsPerFrame;
116 
117  dataSize = framesToBuffer * sf.mBytesPerFrame;
118 
119  bfs = reinterpret_cast<AudioBufferList*>(qMalloc(sizeof(AudioBufferList) +
120  (sizeof(AudioBuffer) * numberOfBuffers)));
121  bfs->mNumberBuffers = numberOfBuffers;
122  for (int i = 0; i < numberOfBuffers; ++i) {
123  bfs->mBuffers[i].mNumberChannels = isInterleaved ? numberOfBuffers : 1;
124  bfs->mBuffers[i].mDataByteSize = dataSize;
125  bfs->mBuffers[i].mData = qMalloc(dataSize);
126  }
127  }
Q_CORE_EXPORT void * qMalloc(size_t size)
Definition: qmalloc.cpp:53

◆ ~QAudioBufferList()

QtMultimediaInternal::QAudioBufferList::~QAudioBufferList ( )
inline

Definition at line 129 of file qaudioinput_mac_p.cpp.

130  {
131  if (owner) {
132  for (UInt32 i = 0; i < bfs->mNumberBuffers; ++i)
133  qFree(bfs->mBuffers[i].mData);
134  }
135 
136  qFree(bfs);
137  }
Q_CORE_EXPORT void qFree(void *ptr)
Definition: qmalloc.cpp:58

Functions

◆ audioBufferList()

AudioBufferList* QtMultimediaInternal::QAudioBufferList::audioBufferList ( ) const
inline

◆ bufferSize()

qint64 QtMultimediaInternal::QAudioBufferList::bufferSize ( int  buffer = 0) const
inline

Definition at line 149 of file qaudioinput_mac_p.cpp.

Referenced by QAudioBufferList().

150  {
151  return bfs->mBuffers[buffer].mDataByteSize;
152  }

◆ data()

char* QtMultimediaInternal::QAudioBufferList::data ( int  buffer = 0) const
inline

Definition at line 144 of file qaudioinput_mac_p.cpp.

145  {
146  return static_cast<char*>(bfs->mBuffers[buffer].mData);
147  }

◆ frameCount()

int QtMultimediaInternal::QAudioBufferList::frameCount ( int  buffer = 0) const
inline

Definition at line 154 of file qaudioinput_mac_p.cpp.

155  {
156  return bfs->mBuffers[buffer].mDataByteSize / sf.mBytesPerFrame;
157  }

◆ packetCount()

int QtMultimediaInternal::QAudioBufferList::packetCount ( int  buffer = 0) const
inline

Definition at line 159 of file qaudioinput_mac_p.cpp.

Referenced by QtMultimediaInternal::QAudioPacketFeeder::feed().

160  {
161  return bfs->mBuffers[buffer].mDataByteSize / sf.mBytesPerPacket;
162  }

◆ packetSize()

int QtMultimediaInternal::QAudioBufferList::packetSize ( ) const
inline

Definition at line 164 of file qaudioinput_mac_p.cpp.

Referenced by QtMultimediaInternal::QAudioInputBuffer::renderFromDevice().

165  {
166  return sf.mBytesPerPacket;
167  }

◆ reset()

void QtMultimediaInternal::QAudioBufferList::reset ( )
inline

Definition at line 169 of file qaudioinput_mac_p.cpp.

170  {
171  for (UInt32 i = 0; i < bfs->mNumberBuffers; ++i) {
172  bfs->mBuffers[i].mDataByteSize = dataSize;
173  bfs->mBuffers[i].mData = 0;
174  }
175  }

Properties

◆ bfs

AudioBufferList* QtMultimediaInternal::QAudioBufferList::bfs
private

◆ dataSize

int QtMultimediaInternal::QAudioBufferList::dataSize
private

Definition at line 179 of file qaudioinput_mac_p.cpp.

Referenced by QAudioBufferList(), and reset().

◆ owner

bool QtMultimediaInternal::QAudioBufferList::owner
private

Definition at line 178 of file qaudioinput_mac_p.cpp.

Referenced by ~QAudioBufferList().

◆ sf

AudioStreamBasicDescription QtMultimediaInternal::QAudioBufferList::sf
private

Definition at line 180 of file qaudioinput_mac_p.cpp.

Referenced by frameCount(), packetCount(), packetSize(), and QAudioBufferList().


The documentation for this class was generated from the following file: