New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Reading ID3 tags from an audio file.


Post Reply New Thread Subscribe

 
Thread Tools
fajhetti

 
Member Since: May 08, 2009
Posts: 6
fajhetti is on a distinguished road

fajhetti is offline
We allow customers in our application to select their own mp3 to put with an "order". When they do I need to be able to read the length of the song in seconds.

I have tried the AudioToolbox and QTKit unsuccessfully. I am not an extremely experienced objective-c, but can get around a little.

Thank you very much for your help.

Code:
-(IBAction)AddMusicFile:(id)sender
{
	int iResponse = NSRunAlertPanel(@"Add Song", 
					@"By clicking yes, you confirm that you have purchased the song(s) you are uploading and have the rights to use the music for the intended purpose.",
					@"Yes", @"No", /*ThirdButtonHere:*/nil
					/*, args for a printf-style msg go here */);
	switch(iResponse) {
		case NSAlertDefaultReturn:    /* user pressed OK */
			break;
		case NSAlertAlternateReturn:  /* user pressed Cancel */
			return;
			break;
		case NSAlertOtherReturn:      /* user pressed the third button */
			return;
			break;
		case NSAlertErrorReturn:      /* an error occurred */
			return;
			break;
	}
	
	Package *order = CurrentPackage;
	NSString * songName = [self AddMusicFileToOrder:order.PackageNumber];
	
	if (songName != nil)
	{
		SlideShowSong * showSong = [SlideShowSong new];
		showSong.MusicName = songName;
		showSong.CustomerUploaded = TRUE;
	
		NSInteger val = 0;
		for(SlideShowSong * song in [SelectedMusicInfoController content])
			if (song.Ordinal > val)
				val  = song.Ordinal;
		
		//RIGHT HERE I HAVE TO READ IN THE ID3 TAGS AND DETERMINE TOTAL LENGTH OF THE SONG IN SECONDS.
	
		showSong.Ordinal = val + 1;
		
		for(SlideShowSong * song in [SelectedMusicInfoController content])
		{
			if ([song.MusicName isEqualToString:showSong.MusicName])
				return;
		}
		
		[SelectedMusicInfoController addObject:showSong];
	}
	
}
QUOTE Thanks

Post Reply New Thread Subscribe


« applescript to bring ichat window to front after message received | Making a disk with a smaller block size »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
My PowerMac G5 is acting screwy! aedolch OS X - Operating System 5 08-01-2008 06:12 PM
Best App for creating an audio file straight from the built-in Mic rocksteadyvybes Music, Audio, and Podcasting 5 04-14-2008 03:23 AM

All times are GMT -4. The time now is 12:51 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?