Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumblekit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikkel Krautz <mikkel@krautz.dk>2013-06-13 01:06:49 +0400
committerMikkel Krautz <mikkel@krautz.dk>2013-06-13 01:06:49 +0400
commite0df6e1529b0db4ddf43935f74583c22a42279d1 (patch)
tree2ac08b2ab04823499d96d09e518e877ca3272f42
parente3282ad5ea7cd58f57cfc1afc5a0f8a45d4027ac (diff)
MKAudioInput: limit sidetone processing to 48KHz mic sampling rates.
-rw-r--r--src/MKAudioInput.m18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/MKAudioInput.m b/src/MKAudioInput.m
index 3a24237..bfcf6ce 100644
--- a/src/MKAudioInput.m
+++ b/src/MKAudioInput.m
@@ -264,10 +264,20 @@
}
- (void) processSidetone {
- BOOL resampled = _micResampler != NULL;
- NSData *data = [[NSData alloc] initWithBytes:(resampled ? psOut : psMic) length:frameSize*sizeof(short)];
- [[[MKAudio sharedAudio] sidetoneOutput] addFrame:data];
- [data release];
+ // Limit sidetone processing to when we have a 48KHz mic sampling rate.
+ // For newer iOS versions, we're always given 48KHz, but for OS X, we can't
+ // be certain. So this most certainly mutes the sidetone on OS X for many audio
+ // devices.
+ //
+ // When resampling from the internal 48KHz sampling rate to 32KHz for Speex UWB, this
+ // sidetone code path will be adding non-preprocessed frames to the sidetone output.
+ // This is a deliberate choice for now, because it allows us to avoid resampling a
+ // perhaps already resampled signal.
+ if (micFrequency == 48000) {
+ NSData *data = [[NSData alloc] initWithBytes:psMic length:micLength*sizeof(short)];
+ [[[MKAudio sharedAudio] sidetoneOutput] addFrame:data];
+ [data release];
+ }
}
- (void) resetPreprocessor {