 |
 |
Using Quicktime to play MP3s
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status:
Offline
|
|
Hello,
I am trying to alter a program I currently have that plays background music by looping an AIFF to loop an MP3 instead. I was wondering if anyone has any source of a way to effectively do this in cocoa in a very few number of steps? I am basically looking for something shorter than Apple's Quicktime MP3 player source or a way to create a FSSpec* from the cocoa API.
Thanks,
Jeff.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Jan 2001
Location: New York
Status:
Offline
|
|
Originally posted by Apocalypse:
<STRONG>Hello,
I am trying to alter a program I currently have that plays background music by looping an AIFF to loop an MP3 instead. I was wondering if anyone has any source of a way to effectively do this in cocoa in a very few number of steps? I am basically looking for something shorter than Apple's Quicktime MP3 player source or a way to create a FSSpec* from the cocoa API.
Thanks,
Jeff.</STRONG>
Sure, just use NSMovie. It accesses Quicktime. If you want to use the quicktime API, just call
[someNSMovie QTMovie]
You can also use NSMovieView to control it, or standard quicktime functions such as:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
someMovie = [[NSMovie alloc] initWithURL:[NSURL fileURLWithPath:<font color = orange>@"PATH GOES HERE"</font>] byReference:YES];
StartMovie([someMovie QTMovie]);
</font>[/code]
Remember to add the Quicktime Framework to your project and to import Movies.h (hence - #import <QuickTime/Movies.h> 
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status:
Offline
|
|
That worked perfectly!
However, I did end up using NSMovieView to access the Quicktime API since it is a lot easier and OO. Unfortunately, it wouldn't allow me to loop the sound until I actually created a real NSMovieView (instead of just [[NSMovieView alloc] init]). Do you know of any clean way to have an invisible movie view? I could will probably play around some more and figure it out but if anyone has a good suggestion, it would be useful for future applications of this.
Also, is there any easy way of getting the amplitude of different frequency ranges at a given time? I am would like to have some OpenGL surfaces respond to the beat (iTunes visual-ish) in the game I am using this in (it is to run background sound).
Thanks,
Jeff.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Jan 2001
Location: New York
Status:
Offline
|
|
Originally posted by Apocalypse:
<STRONG>That worked perfectly!
However, I did end up using NSMovieView to access the Quicktime API since it is a lot easier and OO. Unfortunately, it wouldn't allow me to loop the sound until I actually created a real NSMovieView (instead of just [[NSMovieView alloc] init]). Do you know of any clean way to have an invisible movie view? I could will probably play around some more and figure it out but if anyone has a good suggestion, it would be useful for future applications of this.
Also, is there any easy way of getting the amplitude of different frequency ranges at a given time? I am would like to have some OpenGL surfaces respond to the beat (iTunes visual-ish) in the game I am using this in (it is to run background sound).
Thanks,
Jeff.</STRONG>
I think you could just set the position of the NSMovieView off the screen. Something like -500,-500 . As for the amplitude, you could do something like that using the pure Quicktime APIs, as I described before. I think the function was something like getBaseLevels. I don't remember exactly though, so see the Quicktime API
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status:
Offline
|
|
I just made a window with (x,y,w,h) = (0,0,0,0). Works like a charm.
F-bacher
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status:
Offline
|
|
Yeah, I ended up just choosing a window that exists for the entire duration of the program and made a subview with all zero dimensions. It worked perfectly.
I will take a look at the API and post back if I can find/create a synopsis of how to do it or have some other difficulty. The biggest problem is not knowing what parts of the QuickTime API apply to OS X since some parts are so old and use radically different types than those used by Cocoa.
Thanks for the help,
Jeff.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Jan 2001
Location: New York
Status:
Offline
|
|
Originally posted by Apocalypse:
<STRONG>Yeah, I ended up just choosing a window that exists for the entire duration of the program and made a subview with all zero dimensions. It worked perfectly.
I will take a look at the API and post back if I can find/create a synopsis of how to do it or have some other difficulty. The biggest problem is not knowing what parts of the QuickTime API apply to OS X since some parts are so old and use radically different types than those used by Cocoa.
Thanks for the help,
Jeff.</STRONG>
Everything in Movies.h in the Quicktime framework is of course current to OS X, including the return types. You may want to check that out. Do you have any idea of how to apply Cocoa threading technologies to using Quicktime functions. Such as starting a movie and keeping it in a different thread.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|