如何在UWP 中将AudioFrame PCM缓冲区转换为AAC? 我正在使用AudioGraph的AudioFrameOutputNode在AudioFrames中捕获麦克风数据。
AudioFrameOutputNode frameOutputNode; private void CreateFrameOutputNode() { frameOutputNode = audioGraph.CreateFrameOutputNode(); audioGraph.QuantumStarted += AudioGraph_QuantumStarted; } private void AudioGraph_QuantumStarted(AudioGraph sender, object args) { AudioFrame frame = frameOutputNode.GetFrame(); ProcessFrameOutput(frame); } /* AudioFrame buffer will be in PCM format */ unsafe private void ProcessFrameOutput(AudioFrame frame) { using (AudioBuffer buffer = frame.LockBuffer(AudioBufferAccessMode.Write)) using (IMemoryBufferReference reference = buffer.CreateReference()) { byte* dataInBytes; uint capacityInBytes; float* dataInFloat; // Get the buffer from the AudioFrame ((IMemoryBufferByteAccess)reference).GetBuffer(out dataInBytes, out capacityInBytes); dataInFloat = (float*)dataInBytes; //TO DO //Convert PCM data to AAC data } }