cocoaTouch/VoicesViewController.m
author koda
Tue, 13 Apr 2010 14:39:05 +0000
changeset 3339 d558bc5a73c5
child 3340 96dd168b080b
permissions -rw-r--r--
lots of untested stuff for the ifrontend
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
     1
//
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
     2
//  HogHatViewController.m
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
     3
//  HedgewarsMobile
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
     4
//
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
     5
//  Created by Vittorio on 02/04/10.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
     6
//  Copyright 2010 __MyCompanyName__. All rights reserved.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
     7
//
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
     8
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
     9
#import "HogHatViewController.h"
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    10
#import "CommodityFunctions.h"
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    11
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    12
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    13
@implementation VoicesViewController
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    14
@synthesize teamDictionary, voiceArray, lastIndexPath, musicBeingPlayed;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    15
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    16
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    17
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    18
	return rotationManager(interfaceOrientation);
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    19
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    20
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    21
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    22
#pragma mark -
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    23
#pragma mark View lifecycle
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    24
- (void)viewDidLoad {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    25
    [super viewDidLoad];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    26
    srandom(time(NULL));
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    27
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    28
    Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 1024);
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    29
    musicBeingPlayed = NULL;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    30
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    31
    // load all the voices names and store them into voiceArray
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    32
    NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:VOICES_DIRECTORY() error:NULL];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    33
    self.voiceArray = array;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    34
    [array release];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    35
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    36
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    37
- (void)viewWillAppear:(BOOL)animated {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    38
    [super viewWillAppear:animated];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    39
    
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    40
    // this moves the tableview to the top
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    41
    [self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    42
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    43
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    44
/*
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    45
- (void)viewDidAppear:(BOOL)animated {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    46
    [super viewDidAppear:animated];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    47
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    48
*/
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    49
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    50
- (void)viewWillDisappear:(BOOL)animated {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    51
    [super viewWillDisappear:animated];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    52
    if(musicBeingPlayed != NULL) {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    53
	Mix_HaltMusic();
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    54
	Mix_FreeMusic(musicBeingPlayed);
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    55
	musicBeingPlayed = NULL;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    56
    }
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    57
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    58
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    59
/*
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    60
- (void)viewDidDisappear:(BOOL)animated {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    61
    [super viewDidDisappear:animated];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    62
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    63
*/
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    64
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    65
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    66
#pragma mark -
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    67
#pragma mark Table view data source
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    68
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    69
    return 1;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    70
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    71
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    72
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    73
    return [self.voiceArray count];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    74
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    75
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    76
// Customize the appearance of table view cells.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    77
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    78
    
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    79
    static NSString *CellIdentifier = @"Cell";
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    80
    
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    81
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    82
    if (cell == nil) {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    83
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    84
    }
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    85
    
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    86
    NSString *voice = [[voiceArray objectAtIndex:[indexPath row]] stringByDeletingPathExtension];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    87
    cell.textLabel.text = voice;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    88
    
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    89
    if ([voice isEqualToString:[teamDictionary objectForKey:@"voicepack"]]) {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    90
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    91
        self.lastIndexPath = indexPath;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    92
    } else {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    93
        cell.accessoryType = UITableViewCellAccessoryNone;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    94
    }
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    95
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    96
    return cell;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    97
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    98
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    99
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   100
/*
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   101
// Override to support conditional editing of the table view.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   102
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   103
    // Return NO if you do not want the specified item to be editable.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   104
    return YES;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   105
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   106
*/
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   107
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   108
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   109
/*
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   110
// Override to support editing the table view.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   111
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   112
    
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   113
    if (editingStyle == UITableViewCellEditingStyleDelete) {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   114
        // Delete the row from the data source
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   115
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   116
    }   
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   117
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   118
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   119
    }   
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   120
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   121
*/
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   122
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   123
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   124
/*
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   125
// Override to support rearranging the table view.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   126
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   127
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   128
*/
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   129
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   130
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   131
/*
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   132
// Override to support conditional rearranging of the table view.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   133
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   134
    // Return NO if you do not want the item to be re-orderable.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   135
    return YES;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   136
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   137
*/
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   138
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   139
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   140
#pragma mark -
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   141
#pragma mark Table view delegate
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   142
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   143
    int newRow = [indexPath row];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   144
    int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   145
    
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   146
    if (newRow != oldRow) {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   147
	[teamDictionary setObject:[voiceArray objectAtIndex:newRow] forKey:@"voicepack"];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   148
        
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   149
        // tell our boss to write this new stuff on disk
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   150
        [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   151
        [self.tableView reloadData];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   152
        
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   153
        self.lastIndexPath = indexPath;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   154
        [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   155
    } 
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   156
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   157
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   158
    if(musicBeingPlayed != NULL) {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   159
	Mix_HaltMusic();
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   160
	Mix_FreeMusic(musicBeingPlayed);
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   161
	musicBeingPlayed = NULL;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   162
    }
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   163
    // the keyword static prevents re-initialization of the variable
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   164
    NSString *voiceDir = [[NSString alloc] initWithFormat:@"%@/%@/",VOICES_DIRECTORY(),[voiceArray objectAtIndex:newRow];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   165
    NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:voiceDir error:NULL];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   166
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   167
    int index = random() % [array count];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   168
    
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   169
    music = Mix_LoadMUS([[voiceDir stringByAppendingString:[array objectAtIndex:index]] UTF8String]);
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   170
    [array release];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   171
    [voiceDir release];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   172
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   173
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   174
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   175
#pragma mark -
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   176
#pragma mark Memory management
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   177
- (void)didReceiveMemoryWarning {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   178
    Mix_HaltMusic();
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   179
    Mix_FreeMusic(musicBeingPlayed);
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   180
    musicBeingPlayed = NULL;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   181
    // Releases the view if it doesn't have a superview.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   182
    [super didReceiveMemoryWarning];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   183
    // Relinquish ownership any cached data, images, etc that aren't in use.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   184
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   185
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   186
- (void)viewDidUnload {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   187
    [super viewDidUnload];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   188
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   189
    Mix_CloseAudio();
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   190
    self.musicBeingPlayed = NULL;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   191
    self.lastIndexPath = nil;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   192
    self.teamDictionary = nil;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   193
    self.voiceArray = nil;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   194
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   195
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   196
- (void)dealloc {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   197
    [musicBeingPlayed release];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   198
    [voiceArray release];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   199
    [teamDictionary release];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   200
    [lastIndexPath release];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   201
    [super dealloc];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   202
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   203
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   204
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   205
@end
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   206
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   207