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

github.com/mumble-voip/mumble-iphoneos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorMikkel Krautz <mikkel@krautz.dk>2013-11-23 18:23:34 +0400
committerMikkel Krautz <mikkel@krautz.dk>2013-11-23 18:23:34 +0400
commit196e97a249e7e94cdfb547b4532da6a848975fb5 (patch)
tree12b453b2079c77d8cef781cba1fa73afe3fa6b76 /Source
parentdac337c7bd2505a79e8273850f877ceb748925bc (diff)
MUAudioMixerDebugViewController: add view controller for viewing mixer debug info.
Diffstat (limited to 'Source')
-rw-r--r--Source/Classes/MUApplicationDelegate.m7
-rw-r--r--Source/Classes/MUAudioMixerDebugViewController.h6
-rw-r--r--Source/Classes/MUAudioMixerDebugViewController.m115
-rw-r--r--Source/Classes/MUServerRootViewController.m14
4 files changed, 141 insertions, 1 deletions
diff --git a/Source/Classes/MUApplicationDelegate.m b/Source/Classes/MUApplicationDelegate.m
index fc363c0..1922a7c 100644
--- a/Source/Classes/MUApplicationDelegate.m
+++ b/Source/Classes/MUApplicationDelegate.m
@@ -149,7 +149,11 @@
// Network
[NSNumber numberWithBool:NO], @"NetworkForceTCP",
@"MumbleUser", @"DefaultUserName",
- nil]];
+ nil]];
+#if MUMBLE_APP_STORE != 1
+ // Enable mixer debugging for all builds that aren't explicitly for App Store distribution.
+ [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:YES] forKey:@"AudioMixerDebug"];
+#endif
[self reloadPreferences];
[MUDatabase initializeDatabase];
@@ -308,6 +312,7 @@
}
settings.opusForceCELTMode = [defaults boolForKey:@"AudioOpusCodecForceCELTMode"];
+ settings.audioMixerDebug = [defaults boolForKey:@"AudioMixerDebug"];
MKAudio *audio = [MKAudio sharedAudio];
[audio updateAudioSettings:&settings];
diff --git a/Source/Classes/MUAudioMixerDebugViewController.h b/Source/Classes/MUAudioMixerDebugViewController.h
new file mode 100644
index 0000000..81a3497
--- /dev/null
+++ b/Source/Classes/MUAudioMixerDebugViewController.h
@@ -0,0 +1,6 @@
+// Copyright 2013 The 'Mumble for iOS' Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+@interface MUAudioMixerDebugViewController : UITableViewController
+@end
diff --git a/Source/Classes/MUAudioMixerDebugViewController.m b/Source/Classes/MUAudioMixerDebugViewController.m
new file mode 100644
index 0000000..e3b479d
--- /dev/null
+++ b/Source/Classes/MUAudioMixerDebugViewController.m
@@ -0,0 +1,115 @@
+// Copyright 2013 The 'Mumble for iOS' Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#import "MUAudioMixerDebugViewController.h"
+#import <MumbleKit/MKAudio.h>
+
+@interface MUAudioMixerDebugViewController () {
+ NSDictionary *_mixerInfo;
+ NSTimer *_timer;
+}
+@end
+
+@implementation MUAudioMixerDebugViewController
+
+- (id) init {
+ if ((self = [super initWithStyle:UITableViewStylePlain])) {
+ // ...
+ }
+ return self;
+}
+
+- (void) dealloc {
+ [_mixerInfo release];
+ [super dealloc];
+}
+
+- (void) viewWillAppear:(BOOL)animated {
+ [[self navigationItem] setTitle:@"Mixer Debug"];
+
+ UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneDebugging:)];
+ [[self navigationItem] setRightBarButtonItem:doneButton];
+ [doneButton release];
+
+ _timer = [[NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(updateMixerInfo:) userInfo:nil repeats:YES] retain];
+ [self updateMixerInfo:self];
+}
+
+- (void) viewWillDisappear:(BOOL)animated {
+ [_timer invalidate];
+ [_timer release];
+}
+
+- (void) updateMixerInfo:(id)sender {
+ [_mixerInfo release];
+ _mixerInfo = [[MKAudio sharedAudio] copyAudioOutputMixerDebugInfo];
+ [[self tableView] reloadData];
+}
+
+#pragma mark - Table view data source
+
+- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+ return 3;
+}
+
+- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ if (section == 0) { // Metadata
+ return 1;
+ } else if (section == 1) { // Sources
+ return [[_mixerInfo objectForKey:@"sources"] count];
+ } else if (section == 1) { // Removed
+ return [[_mixerInfo objectForKey:@"removed"] count];
+ }
+
+ return 0;
+}
+
+- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ static NSString *CellIdentifier = @"AudioMixerDebugCell";
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+ if (cell == nil) {
+ cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
+ }
+
+ if (indexPath.section == 0) { // Meta
+ if (indexPath.row == 0) { // Last Update
+ NSDateFormatter *fmt = [[NSDateFormatter alloc] init];
+ [fmt setDateFormat:@"HH:mm:ss:SSS"];
+ NSDate *date = [_mixerInfo objectForKey:@"last-update"];
+ cell.textLabel.text = @"Last Updated";
+ cell.detailTextLabel.text = [fmt stringFromDate:date];
+ [fmt release];
+ }
+ }
+
+ if (indexPath.section == 1) {
+ NSDictionary *info = [[_mixerInfo objectForKey:@"sources"] objectAtIndex:indexPath.row];
+ cell.textLabel.text = [info objectForKey:@"kind"];
+ cell.detailTextLabel.text = [info objectForKey:@"identifier"];
+ } else if (indexPath.section == 2) {
+ NSDictionary *info = [[_mixerInfo objectForKey:@"removed"] objectAtIndex:indexPath.row];
+ cell.textLabel.text = [info objectForKey:@"kind"];
+ cell.detailTextLabel.text = [info objectForKey:@"identifier"]; }
+
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
+
+ return cell;
+}
+- (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
+ if (section == 0) {
+ return @"Metadata";
+ } else if (section == 1) {
+ return @"Sources";
+ } else if (section == 2) {
+ return @"Removed";
+ }
+
+ return @"Unknown";
+}
+
+- (void) doneDebugging:(id)sender {
+ [self dismissModalViewControllerAnimated:YES];
+}
+
+@end
diff --git a/Source/Classes/MUServerRootViewController.m b/Source/Classes/MUServerRootViewController.m
index 0eafcc4..dc70f2b 100644
--- a/Source/Classes/MUServerRootViewController.m
+++ b/Source/Classes/MUServerRootViewController.m
@@ -11,6 +11,7 @@
#import "MUConnectionController.h"
#import "MUMessagesViewController.h"
#import "MUDatabase.h"
+#import "MUAudioMixerDebugViewController.h"
#import <MumbleKit/MKConnection.h>
#import <MumbleKit/MKServerModel.h>
@@ -36,6 +37,7 @@
NSInteger _unreadMessages;
NSInteger _disconnectIndex;
+ NSInteger _mixerDebugIndex;
NSInteger _accessTokensIndex;
NSInteger _certificatesIndex;
NSInteger _selfRegisterIndex;
@@ -315,6 +317,12 @@
_disconnectIndex = [actionSheet addButtonWithTitle:NSLocalizedString(@"Disconnect", nil)];
[actionSheet setDestructiveButtonIndex:0];
+ if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"AudioMixerDebug"] boolValue]) {
+ _mixerDebugIndex = [actionSheet addButtonWithTitle:NSLocalizedString(@"Mixer Debug", nil)];
+ } else {
+ _mixerDebugIndex = -1;
+ }
+
_accessTokensIndex = [actionSheet addButtonWithTitle:NSLocalizedString(@"Access Tokens", nil)];
if (!inMessagesView)
@@ -385,6 +393,12 @@
if (buttonIndex == _disconnectIndex) { // Disconnect
[[MUConnectionController sharedController] disconnectFromServer];
+ } else if (buttonIndex == _mixerDebugIndex) {
+ MUAudioMixerDebugViewController *audioMixerDebugViewController = [[MUAudioMixerDebugViewController alloc] init];
+ UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:audioMixerDebugViewController];
+ [self presentModalViewController:navCtrl animated:YES];
+ [audioMixerDebugViewController release];
+ [navCtrl release];
} else if (buttonIndex == _accessTokensIndex) {
MUAccessTokenViewController *tokenViewController = [[MUAccessTokenViewController alloc] initWithServerModel:_model];
UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:tokenViewController];