Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Reading ID3 tags from an audio file.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="fajhetti" data-source="post: 994396" data-attributes="member: 100285"><p>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.</p><p></p><p>I have tried the AudioToolbox and QTKit unsuccessfully. I am not an extremely experienced objective-c, but can get around a little. </p><p></p><p>Thank you very much for your help.</p><p></p><p>[CODE]-(IBAction)AddMusicFile:(id)sender</p><p>{</p><p> int iResponse = NSRunAlertPanel(@"Add Song", </p><p> @"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.",</p><p> @"Yes", @"No", /*ThirdButtonHere:*/nil</p><p> /*, args for a printf-style msg go here */);</p><p> switch(iResponse) {</p><p> case NSAlertDefaultReturn: /* user pressed OK */</p><p> break;</p><p> case NSAlertAlternateReturn: /* user pressed Cancel */</p><p> return;</p><p> break;</p><p> case NSAlertOtherReturn: /* user pressed the third button */</p><p> return;</p><p> break;</p><p> case NSAlertErrorReturn: /* an error occurred */</p><p> return;</p><p> break;</p><p> }</p><p> </p><p> Package *order = CurrentPackage;</p><p> NSString * songName = [self AddMusicFileToOrder:order.PackageNumber];</p><p> </p><p> if (songName != nil)</p><p> {</p><p> SlideShowSong * showSong = [SlideShowSong new];</p><p> showSong.MusicName = songName;</p><p> showSong.CustomerUploaded = TRUE;</p><p> </p><p> NSInteger val = 0;</p><p> for(SlideShowSong * song in [SelectedMusicInfoController content])</p><p> if (song.Ordinal > val)</p><p> val = song.Ordinal;</p><p> </p><p> //RIGHT HERE I HAVE TO READ IN THE ID3 TAGS AND DETERMINE TOTAL LENGTH OF THE SONG IN SECONDS.</p><p> </p><p> showSong.Ordinal = val + 1;</p><p> </p><p> for(SlideShowSong * song in [SelectedMusicInfoController content])</p><p> {</p><p> if ([song.MusicName isEqualToString:showSong.MusicName])</p><p> return;</p><p> }</p><p> </p><p> [SelectedMusicInfoController addObject:showSong];</p><p> }</p><p> </p><p>}[/CODE]</p></blockquote><p></p>
[QUOTE="fajhetti, post: 994396, member: 100285"] 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]; } }[/CODE] [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Reading ID3 tags from an audio file.
Top