Discussion Forums  >  Audio, Video, Playing, Recording

Replies: 5    Views: 124

kyle
Apple Fan
Profile
Posts: 6
Reg: Aug 23, 2012
location unknow...
2,210
09/15/12 06:12 PM (13 years ago)

Image Gallery with Audio

Hi there! I've implemented the image gallery plugin, and I would like to have a different sound for every image, so that the sound is played whenever an image is taped. The swipe movement would still change between images, but the tap movement would play the correspondent sound. What do you think is the best approach to do this? I've already spent some hours trying to create custom buttons that would then launch the AV player, read through the forum trying to find out, but I'm a newbie on this and I got lost in the code :) Thanks in advance!
 
lsills81
Apple Fan
Profile
Posts: 469
Reg: Mar 19, 2012
location unknow...
14,090
like
09/15/12 07:35 PM (13 years ago)
Here is a vid about how to set up constant audio in a BuzzTouch audio...I understand that this is NOT what you are asking for but it will give you....maybe....a better understanding of the background audio? Let us know how this plays out. Thanks Setup BG audio/embedded audio in a BTv1.5 app to act like Pandora http://goo.gl/SVyT5
 
Braden
Lost but trying
Profile
Posts: 14
Reg: Sep 15, 2012
Colorado Spring...
1,590
like
09/15/12 07:56 PM (13 years ago)
hh
 
MacApple
Apple Fan
Profile
Posts: 4675
Reg: Oct 25, 2010
USA
61,150
like
09/15/12 09:00 PM (13 years ago)
Hi Kyle and welcome to Buzztouch.  Hope you are making progress and having some fun to boot! Sounds like you are since you are already tinkering with code. Good way to spend a weekend, happy days indeed.  Are you talking about the BT Server gallery or 1.5. For the server plugin it might be a good addition for next update. Are you adding the images to the project or are you pulling from a URL? Few options depending on method. If this is 1.5 you'll have to do a good few things and not all ones that I can answer right now but I'm going to make  stab at it or least throw a few ideas out that you could possibly explore and maybe some of it will make sense. Not long home and will shout back tomorrow. Few screens you should take a peek at. Sounds get stored and referenced, ready for use. You'll be going to the 'appDelegate.m' file and navigating to the part of the code where it says:  //load sound effects  You can add your mp3 in there.  Second file you are going to be looking at is 'BT_screen_images.m  More later, clock hit midnight.
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
09/16/12 08:29 AM (13 years ago)
I used this control in a app for a customer to do something similar to this. http://codecanyon.net/item/turnthephotos/2449177 It's not one song per photo, but it's cool bkg audio while going thru the album. That won't work with a stock BT image gallery, you'd be importing his code into your project and making your own plug-in screen. it's tricky but any controls can be used in BT projects, and looking at some other controls/samples might help.
 
kyle
Apple Fan
Profile
Posts: 6
Reg: Aug 23, 2012
location unknow...
2,210
like
09/17/12 04:58 AM (13 years ago)
Hi there and tks for the quick replies :) @lsills81 - tks for the video, but i'm working on BT 2.0 @ATRAIN53 - tks for the link. I see that is not a solution for one song per photo for the BT image gallery, but nevertheless it's a pretty cool app, i'll keep it in mind for future needs :) @MacApple - In fact, I did'nt write a lot of details on my envorinment :) I'm working on my self hosted BT 2.0 installation. I've successfully integrated the BT Image Gallery and put it to work, and I tried some of what you referred: 1 - I added the songs in my app_delegate.m file (and into the BT_Sounds folder) and left commented the one's I didn't want: //fill an array of sound effect file names self.soundEffectNames = [[NSMutableArray alloc] init]; /* [self.soundEffectNames addObject:@"basso.mp3"]; [self.soundEffectNames addObject:@"blow.mp3"]; [self.soundEffectNames addObject:@"bottle.mp3"]; [self.soundEffectNames addObject:@"frog.mp3"]; [self.soundEffectNames addObject:@"funk.mp3"]; [self.soundEffectNames addObject:@"glass.mp3"]; [self.soundEffectNames addObject:@"hero.mp3"]; [self.soundEffectNames addObject:@"morse.mp3"]; [self.soundEffectNames addObject:@"ping.mp3"]; [self.soundEffectNames addObject:@"pop.mp3"]; [self.soundEffectNames addObject:@"purr.mp3"]; [self.soundEffectNames addObject:@"right.mp3"]; [self.soundEffectNames addObject:@"sosumi.mp3"]; [self.soundEffectNames addObject:@"submarine.mp3"]; [self.soundEffectNames addObject:@"tink.mp3"];*/ [self.soundEffectNames addObject:@"blind_willie.mp3"]; [self.soundEffectNames addObject:@"4936.mp3"]; 2 - In the BT_screen_images.m I created a new button: UIFont *buttonFont2 = [UIFont fontWithName:@"Noteworthy-Bold" size:17.0]; UIColor *buttonColorDefault2 = [UIColor colorWithRed:90.0f/255.0f green:90.0f/255.0f blue:90.0f/255.0f alpha:1.0]; UIColor *buttonColorHighlight2 = [UIColor colorWithRed:255.0f/255.0f green:255.0f/255.0f blue:255.0f/255.0f alpha:1.0]; UIImage *btn2 = [UIImage imageNamed:@"ABCD-08.png"]; UIImage *btnh2 = [UIImage imageNamed:@"ABCD-08.png"]; // building the buttons UIButton *aboutBtn2 = [UIButton buttonWithType:UIButtonTypeCustom]; [aboutBtn2 addTarget:self action:@selector(XXXXXX) forControlEvents:UIControlEventTouchUpInside]; [aboutBtn2 setTitle:@"" forState:UIControlStateNormal]; [aboutBtn2 setFrame:CGRectMake(100, 100, 90.0, 90.0)]; [aboutBtn2 setBackgroundImage:btn2 forState:UIControlStateNormal]; [aboutBtn2 setBackgroundImage:btnh2 forState:UIControlStateHighlighted]; [aboutBtn2.titleLabel setFont:buttonFont2]; [aboutBtn2 setTitleColor:buttonColorDefault2 forState:UIControlStateNormal]; [aboutBtn2 setTitleColor:buttonColorHighlight2 forState:UIControlStateHighlighted]; // place the button into the view [self.view addSubview:aboutBtn2]; 3 - and right after, also in BT_screen_images.m, I created the XXXXXX function in order to load the audio: -(void)XXXXXX{ //appDelegate ABCD_appDelegate *appDelegate = (ABCD_appDelegate *)[[UIApplication sharedApplication] delegate]; if([[BT_strings getJsonPropertyValue:self.jsonVars:@"soundEffectFileName":@""] length] > 3){ [appDelegate playSoundEffect:[BT_strings file:@"soundEffectFileName":@""]]; } } But I can not build the code, I get an error saying "request for member 'jsonVars' in something not a structure or union". I tried commenting the If statement and invoking the playSoundEffect directly with the file name "4396.mp3", it compiles, but when I press the button the music doesn't play. What should I do to solve this? Now that I'm looking at this, I also realized that with this solution I will have to create a new button for every image I have and associate a different sound, not very good programming because I have 50 pictures.. What do you think would be a good alternative? Thanks in advance for your help! Cheers
 

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.