CampGirl
Lost but trying
Profile
Posts: 144
Reg: Jan 10, 2013
Here and Now
7,240
07/21/14 12:28 PM (10 years ago)

don't see audio file in code

Hi all, below is the section of code I think I should see the audio file name in, the file name I entered in the Home screen menu of the control panel, and that I put into the BT Audio folder in Xcode. I don't see the filename anywhere- do I need to manually enter in it? Where does it go? The name of the audio file is 03 - Thinking Time - 60 seconds. It's not a sound effect, but a background audio file that I entered in the cp to loop 5 times. (Additional question- why isn't it in there already?) Thanks in advance, Sarah //initAudioPlayer... -(void)initAudioPlayer{ [BT_debugger showIt:self message:[NSString stringWithFormat:@"initAudioPlayer%@", @""]]; //run in background thread... @autoreleasepool{ //get a reference to the appDelegate... IQuizmovies1_appDelegate *appDelegate = (IQuizmovies1_appDelegate *)[[UIApplication sharedApplication] delegate]; //create the player in the appDelegate... [appDelegate setAudioPlayer:[[BT_audioPlayer alloc] initWithScreenData:nil]]; [appDelegate.audioPlayer.view setTag:999]; }//autoreleasepool... } //initAudioPlayer... -(void)loadSoundEffects{ [BT_debugger showIt:self message:[NSString stringWithFormat:@"loadSoundEffects%@", @""]]; //run in background thread... @autoreleasepool{ //get a reference to the appDelegate... IQuizmovies1_appDelegate *appDelegate = (IQuizmovies1_appDelegate *)[[UIApplication sharedApplication] delegate]; //fill an array of sound effect file names... [appDelegate setSoundEffectNames:[[NSMutableArray alloc] init]]; [appDelegate.soundEffectNames addObject:@"bt_funk.mp3"]; [appDelegate.soundEffectNames addObject:@"bt_glass.mp3"]; //setup audio session for sound effects... [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryAmbient error: nil]; [[AVAudioSession sharedInstance] setActive: YES error: nil]; //fill an array of sound effect player objects to pre-load with each audio track... [appDelegate setSoundEffectPlayers:[[NSMutableArray alloc] init]]; for(int x = 0; x < [appDelegate.soundEffectNames count]; x++){ NSString *theFileName = [appDelegate.soundEffectNames objectAtIndex:x]; if([BT_fileManager doesFileExistInBundle:theFileName]){ NSURL *soundFileUrl = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], theFileName]]; NSError *error; AVAudioPlayer *tmpPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileUrl error:&error]; [tmpPlayer setNumberOfLoops:0]; [tmpPlayer setDelegate:appDelegate]; [appDelegate.soundEffectPlayers addObject:tmpPlayer];
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
07/21/14 02:35 PM (10 years ago)
Hi @CampGirl, The name of the file you specified in the BT Control Panel...and, in fact, anything you specify there...goes into your BT_Config.txt file in JSON format. That file is parsed by the code, and the appropriate variables are plugged in at runtime. That's the beauty of Buzztouch! Do a search in your config file, and you should find it there. Mark
 
CampGirl
Lost but trying
Profile
Posts: 144
Reg: Jan 10, 2013
Here and Now
7,240
like
07/21/14 05:40 PM (10 years ago)
Mark, I see!! Thank you! I was bothering quite a few BTers for a while because I had heard of an issue with the sound effects filenames and thought that might be the same with this audio file. I'm learning to "read" the code more and I appreciate your patient reply! Sarah
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.