 |
 |
CD Playing
|
 |
|
 |
|
Mac Elite
Join Date: Jan 2001
Location: New York
Status:
Offline
|
|
I need a way to play CD's from Cocoa. I'm hoping I won't have to go as low level as core audio or the carbon sound manager. I've found source code for going that route from the OmniGroup.
Thanks,
David
[ 01-22-2002: Message edited by: davecom ]
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status:
Offline
|
|
ok, i just tried it with nssound, doesn't work because it doesn't support sounds in aifc, i get "NSSound error: found AIFC form type in AIFF sound; cannot play these yet" -- yet... lol!
but what i've just tried that works is the following:
add the quicktime framework by choosing "project > add framework". now, import quicktime by adding this line to the head of your .m file:
<font face = "courier">#import <QuickTime/Movies.h></font>
the rest is simple: initialize a movie this way:
<font face = "courier">NSMovie *someMovie = [[NSMovie alloc] initWithURL:[NSURL fileURLWithPath:<PATH>] byReference:YES];</font>
where PATH is the full path to the file on the cd.
then, you can play it this way:
<font face = "courier">StartMovie([someMovie QTMovie]);</font>
simple, isn't it? three lines of code... ;-)
edit: i wasn't very specific; yes, i'm talking about audio.
and thinking about it: "import" doesn't count -- that makes it two lines...
[ 01-21-2002: Message edited by: seb2 ]
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Jan 2001
Location: New York
Status:
Offline
|
|
Originally posted by seb2:
<STRONG>ok, i just tried it with nssound, doesn't work because it doesn't support sounds in aifc, i get "NSSound error: found AIFC form type in AIFF sound; cannot play these yet" -- yet... lol!
but what i've just tried that works is the following:
add the quicktime framework by choosing "project > add framework". now, import quicktime by adding this line to the head of your .m file:
<font face = "courier">#import <QuickTime/Movies.h></font>
the rest is simple: initialize a movie this way:
<font face = "courier">NSMovie *someMovie = [[NSMovie alloc] initWithURL:[NSURL fileURLWithPath:<PATH>] byReference:YES];</font>
where PATH is the full path to the file on the cd.
then, you can play it this way:
<font face = "courier">StartMovie([someMovie QTMovie]);</font>
simple, isn't it? three lines of code... ;-)
edit: i wasn't very specific; yes, i'm talking about audio.
and thinking about it: "import" doesn't count -- that makes it two lines...
[ 01-21-2002: Message edited by: seb2 ]</STRONG>
Thanks so much. I really appreciate it. Now how can I take control of this movie. Such as knowing the position in the file that the playing is at etc.
Thanks again,
David
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status:
Offline
|
|
Originally posted by davecom:
<STRONG>Thanks so much. I really appreciate it. Now how can I take control of this movie. Such as knowing the position in the file that the playing is at etc.
Thanks again,
David</STRONG>
i fear i don't know that much more about this. stopping, rewinding and finding out the duration is some simple stuff i can do, but quicktime is a lot of ugly pure c stuff. no idea how to find out where it is playing. sorry.
actually, the first time i had a look at movies.h was about a week ago.
whenever i have problems with carbon stuff and the like, i -- cough -- call my brother. ;-)
he's way brighter than i am.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Jan 2001
Location: New York
Status:
Offline
|
|
Originally posted by seb2:
<STRONG>
i fear i don't know that much more about this. stopping, rewinding and finding out the duration is some simple stuff i can do, but quicktime is a lot of ugly pure c stuff. no idea how to find out where it is playing. sorry.
actually, the first time i had a look at movies.h was about a week ago.
whenever i have problems with carbon stuff and the like, i -- cough -- call my brother. ;-)
he's way brighter than i am.</STRONG>
I found a lot of info at the Quicktime API pages online. It's a bit cryptic, but I think I'll manage. Thanks for all your help.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
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
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|