cocoaTouch/VoicesViewController.m
author mbait
Tue, 27 Apr 2010 12:51:29 +0000
changeset 3370 37f4f83fedb1
parent 3364 e5403e2bf02c
child 3490 016b3172b645
permissions -rw-r--r--
Teleport AI: * basic implementation of teleport using in order to take crates * filter option to get certain types of gears in FillBonuses
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
     1
//
3352
ac5d14a35482 complete previews on the team settings
koda
parents: 3340
diff changeset
     2
//  VoicesViewController.m
3339
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
3340
96dd168b080b fix all of what was committed before
koda
parents: 3339
diff changeset
     9
#import "VoicesViewController.h"
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    10
#import "CommodityFunctions.h"
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
    11
#import "openalbridge.h"
3339
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
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    14
@implementation VoicesViewController
3340
96dd168b080b fix all of what was committed before
koda
parents: 3339
diff changeset
    15
@synthesize teamDictionary, voiceArray, lastIndexPath;
3339
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
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    18
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    19
	return rotationManager(interfaceOrientation);
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
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    23
#pragma mark -
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    24
#pragma mark View lifecycle
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    25
- (void)viewDidLoad {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    26
    [super viewDidLoad];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    27
    srandom(time(NULL));
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    28
3364
e5403e2bf02c no more hardcoded teams, team selection is real \o/
koda
parents: 3361
diff changeset
    29
    openal_init(1);
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
    30
    voiceBeingPlayed = -1;
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    31
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    32
    // load all the voices names and store them into voiceArray
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    33
    NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:VOICES_DIRECTORY() error:NULL];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    34
    self.voiceArray = array;
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];
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
    52
    if(voiceBeingPlayed >= 0) {
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
    53
        openal_freesound(voiceBeingPlayed);
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
    54
        voiceBeingPlayed = -1;
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    55
    }
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
- (void)viewDidDisappear:(BOOL)animated {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    60
    [super viewDidDisappear:animated];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    61
}
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
#pragma mark -
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    66
#pragma mark Table view data source
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    67
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    68
    return 1;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    69
}
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
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    72
    return [self.voiceArray count];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    73
}
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
// Customize the appearance of table view cells.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    76
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    77
    
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    78
    static NSString *CellIdentifier = @"Cell";
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    79
    
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    80
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    81
    if (cell == nil) {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    82
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    83
    }
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
    NSString *voice = [[voiceArray objectAtIndex:[indexPath row]] stringByDeletingPathExtension];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    86
    cell.textLabel.text = voice;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    87
    
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    88
    if ([voice isEqualToString:[teamDictionary objectForKey:@"voicepack"]]) {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    89
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    90
        self.lastIndexPath = indexPath;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    91
    } else {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    92
        cell.accessoryType = UITableViewCellAccessoryNone;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    93
    }
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
    return cell;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
    96
}
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
// Override to support conditional editing of the table view.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   101
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   102
    // 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
   103
    return YES;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   104
}
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
// Override to support editing the table view.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   110
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   111
    
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   112
    if (editingStyle == UITableViewCellEditingStyleDelete) {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   113
        // Delete the row from the data source
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   114
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   115
    }   
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   116
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   117
        // 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
   118
    }   
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
// Override to support rearranging the table view.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   125
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   126
}
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
// Override to support conditional rearranging of the table view.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   132
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   133
    // 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
   134
    return YES;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   135
}
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
#pragma mark -
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   139
#pragma mark Table view delegate
3340
96dd168b080b fix all of what was committed before
koda
parents: 3339
diff changeset
   140
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   141
    int newRow = [indexPath row];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   142
    int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   143
    
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   144
    if (newRow != oldRow) {
3340
96dd168b080b fix all of what was committed before
koda
parents: 3339
diff changeset
   145
        [teamDictionary setObject:[voiceArray objectAtIndex:newRow] forKey:@"voicepack"];
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   146
        
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   147
        // tell our boss to write this new stuff on disk
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   148
        [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   149
        [self.tableView reloadData];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   150
        
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   151
        self.lastIndexPath = indexPath;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   152
        [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   153
    } 
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   154
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
3340
96dd168b080b fix all of what was committed before
koda
parents: 3339
diff changeset
   155
    
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
   156
    if (voiceBeingPlayed >= 0) {
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
   157
        openal_stopsound(voiceBeingPlayed);
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
   158
        openal_freesound(voiceBeingPlayed);
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
   159
        voiceBeingPlayed = -1;
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   160
    }
3340
96dd168b080b fix all of what was committed before
koda
parents: 3339
diff changeset
   161
    
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   162
    // the keyword static prevents re-initialization of the variable
3340
96dd168b080b fix all of what was committed before
koda
parents: 3339
diff changeset
   163
    NSString *voiceDir = [[NSString alloc] initWithFormat:@"%@/%@/",VOICES_DIRECTORY(),[voiceArray objectAtIndex:newRow]];
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   164
    NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:voiceDir error:NULL];
3340
96dd168b080b fix all of what was committed before
koda
parents: 3339
diff changeset
   165
    
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   166
    int index = random() % [array count];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   167
    
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
   168
    voiceBeingPlayed = openal_loadfile([[voiceDir stringByAppendingString:[array objectAtIndex:index]] UTF8String]);
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   169
    [voiceDir release];
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
   170
    openal_playsound(voiceBeingPlayed);    
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   171
}
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
#pragma mark -
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   175
#pragma mark Memory management
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   176
- (void)didReceiveMemoryWarning {
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
   177
    openal_stopsound(voiceBeingPlayed);
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
   178
    openal_freesound(voiceBeingPlayed);
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
   179
    voiceBeingPlayed = -1;
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   180
    // Releases the view if it doesn't have a superview.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   181
    [super didReceiveMemoryWarning];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   182
    // Relinquish ownership any cached data, images, etc that aren't in use.
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   183
}
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
- (void)viewDidUnload {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   186
    [super viewDidUnload];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   187
3353
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
   188
    openal_close();
a767dd3786b5 OpenAL makes a comeback! (might require some cleanup)
koda
parents: 3352
diff changeset
   189
    voiceBeingPlayed = -1;
3339
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   190
    self.lastIndexPath = nil;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   191
    self.teamDictionary = nil;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   192
    self.voiceArray = nil;
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   193
}
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
- (void)dealloc {
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   196
    [voiceArray release];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   197
    [teamDictionary release];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   198
    [lastIndexPath release];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   199
    [super dealloc];
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   200
}
d558bc5a73c5 lots of untested stuff for the ifrontend
koda
parents:
diff changeset
   201
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
@end
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