Ignore:
Timestamp:
08/29/13 10:34:36 (7 years ago)
Author:
Steve Castellotti <sc@…>
Branches:
master, Servo, Tab_Interface, pyramid
Children:
e37a889
Parents:
c4c7004
Message:

Orbit:

  • reverted to WAV output
File:
1 edited

Legend:

Unmodified
Added
Removed
  • iOS/Orbit/Orbit/SignalConverter.m

    r89934ea rad40faa  
    4040        [[TGAccessoryManager sharedTGAccessoryManager] setupManagerWithInterval:0.05]; 
    4141        [[TGAccessoryManager sharedTGAccessoryManager] setDelegate:self]; 
    42         audioPlayer = [[AudioGenerator alloc] init]; 
     42        // Generate Signal 
     43        //        audioPlayer = [[AudioGenerator alloc] init]; 
    4344         
    4445        // defaults 
     
    108109    if (value != nil) { 
    109110         
    110 //        NSLog(@"value: %i", [value intValue]); 
     111        //        NSLog(@"value: %i", [value intValue]); 
    111112         
    112113        if ([value intValue] == 0) { 
     
    122123        } 
    123124         
    124 //        NSLog(@"signalStrength: %i", signalStrength); 
     125        //        NSLog(@"signalStrength: %i", signalStrength); 
    125126         
    126127    } 
     
    227228- (void) playTestSound 
    228229{ 
     230     
     231    NSLog(@"playTestSound()"); 
     232    [self prepareAudio]; 
     233     
     234//    [self playAudio]; 
     235     
    229236    if (!running && !testing) { 
    230237        testing = YES; 
    231         [audioPlayer playWithThrottle:throttle yaw:yaw pitch:pitch]; 
     238        // Generate Sound 
     239        //        [audioPlayer playWithThrottle:throttle yaw:yaw pitch:pitch]; 
     240        [self playAudio]; 
    232241    } 
    233242} 
     
    273282} 
    274283 
     284//- (void) playAudio 
     285//{ 
     286//    if ([self currentPowerLevel] > 0) { 
     287//        // Generate Signal 
     288//        [audioPlayer playWithThrottle:throttle yaw:yaw pitch:pitch]; 
     289//    } else { 
     290//        [audioPlayer stop]; 
     291//         
     292//    } 
     293//} 
     294 
     295 
    275296- (void) playAudio 
    276297{ 
     298     
     299    [audioPlayer play]; 
     300     
     301    return; 
     302     
     303    //   audioPlayer.volume = [self currentPowerLevel]; 
    277304    if ([self currentPowerLevel] > 0) { 
    278         [audioPlayer playWithThrottle:throttle yaw:yaw pitch:pitch]; 
     305        audioPlayer.volume = 1.0; 
     306        [audioPlayer play]; 
    279307    } else { 
    280308        [audioPlayer stop]; 
     309        [self prepareAudio]; 
    281310         
    282311    } 
     
    312341} 
    313342 
     343- (void) prepareAudio 
     344{ 
     345    NSURL *audioFilePath = [[NSBundle mainBundle] URLForResource:AUDIO_FILE_NAME withExtension:nil]; 
     346     
     347    NSError *error; 
     348    audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:audioFilePath error:&error]; 
     349    if (!audioPlayer) { 
     350        //        [self logMessage:[NSString stringWithFormat:@"Failed to initialize audio player: %@", [error debugDescription]]]; 
     351        NSLog(@"Failed to initialize audio player: %@", [error debugDescription]); 
     352    } else { 
     353        [audioPlayer prepareToPlay]; 
     354    } 
     355} 
     356 
    314357@end 
Note: See TracChangeset for help on using the changeset viewer.