Skip to content
Snippets Groups Projects
Commit 13b8e81e authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

audio: input format

Change-Id: I4f886e8d03da3cef6ae9746f7dc56a2b77816db1
parent 5d8d6252
Branches
Tags
No related merge requests found
......@@ -146,18 +146,18 @@ CoreLayer::initAudioLayerIO()
&info,
&size));
// Set format on output *SCOPE* in input *BUS*.
checkErr(AudioUnitGetProperty(ioUnit_,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
inputBus,
&info,
&size));
info.mSampleRate = audioFormat_.sample_rate;
audioInputFormat_ = {static_cast<unsigned int>(info.mSampleRate),
static_cast<unsigned int>(info.mChannelsPerFrame)};
hardwareInputFormatAvailable(audioInputFormat_);
// Set format on output *SCOPE* in input *BUS*.
checkErr(AudioUnitGetProperty(ioUnit_,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
inputBus,
&info,
&size));
// Keep everything else and change only sample rate (or else SPLOSION!!!)
info.mSampleRate = audioInputFormat_.sample_rate;
......@@ -336,8 +336,8 @@ CoreLayer::read(AudioUnitRenderActionFlags* ioActionFlags,
captureBuff_));
auto format = audioInputFormat_;
audioInputFormat_.sampleFormat = AV_SAMPLE_FMT_FLTP;
auto inBuff = std::make_unique<AudioFrame>(audioInputFormat_, inNumberFrames);
format.sampleFormat = AV_SAMPLE_FMT_FLTP;
auto inBuff = std::make_unique<AudioFrame>(format, inNumberFrames);
auto& in = *inBuff->pointer();
for (unsigned i = 0; i < inChannelsPerFrame_; ++i)
std::copy_n((Float32*)captureBuff_->mBuffers[i].mData, inNumberFrames, (Float32*)in.extended_data[i]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment