[Audio Converter] Minor change for format changes

This should also seal up any potential hole for problems if there's an
audio format change and no audio buffered.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
main
Christopher Snowhill 2022-07-10 16:36:31 -07:00
parent f8a8a57cf0
commit 8d8b508d09
1 changed files with 13 additions and 9 deletions

View File

@ -710,18 +710,22 @@ tryagain:
ioNumberPackets -= ioNumberPackets % dmFloatFormat.mBytesPerPacket; ioNumberPackets -= ioNumberPackets % dmFloatFormat.mBytesPerPacket;
AudioChunk *chunk = [[AudioChunk alloc] init]; if(ioNumberPackets) {
[chunk setFormat:nodeFormat]; AudioChunk *chunk = [[AudioChunk alloc] init];
if(nodeChannelConfig) { [chunk setFormat:nodeFormat];
[chunk setChannelConfig:nodeChannelConfig]; if(nodeChannelConfig) {
} [chunk setChannelConfig:nodeChannelConfig];
[chunk assignSamples:floatBuffer frameCount:ioNumberPackets / dmFloatFormat.mBytesPerPacket]; }
[chunk assignSamples:floatBuffer frameCount:ioNumberPackets / dmFloatFormat.mBytesPerPacket];
floatOffset += ioNumberPackets; floatOffset += ioNumberPackets;
amountRead += ioNumberPackets; amountRead += ioNumberPackets;
convertEntered = NO;
return chunk;
}
convertEntered = NO; convertEntered = NO;
return chunk; return nil;
} }
- (void)observeValueForKeyPath:(NSString *)keyPath - (void)observeValueForKeyPath:(NSString *)keyPath