Re: playing mono files
Re: playing mono files
- Subject: Re: playing mono files
- From: Marc Poirier <email@hidden>
- Date: Tue, 14 Oct 2003 09:56:13 -0500 (CDT)
Yeah, I was just building that example, too, and had the same problems.
The issue is with different variants of the C language (I think C99
scoping vs. C89, although I'm really not an expert on language details so
I might be wrong). Basically the project is configured to use the older
style where you can't declare additional variables within a given scope
after you have made any other statements. In other words, you need to
declare all of your variables for a scope first, before you move on to
doing anything else. There are 2 places where this doesn't happen in the
example code, and that's why you're getting those errors. It's about
which language interpreter/parser is being used. Which is kind of weird
that the project is configured in a way that it won't compile properly.
Actually, more generally, I kind of wonder if this project slipped past
the final QA pass or something. I don't mean to sound too complainy, the
content is great, it's a really useful example, but there are some more
surface things that are sort of rough, moreso than any other Apple example
code I've seen. For one thing, there's no style consistency (spaces
before parenthesis of functions vs. none, curly braces on their own line
or not, tabs or spaces or nothing after function argument). The indenting
is totally inconsistent, too (4-space tabs vs. 8-space tabs, using spaces
instead of tabs, etc.). And it's missing the usual Apple copyright info.
And then there's the variable scope declaration problems, plus this rather
deadly mistake in the checkStatus macro:
#define checkStatus( err) \
if (err){\
printf("Error: %s -> %s: line %d\n", err, __FILE__, __LINE__);\
fflush(stdout);\
return err; \
}
should be changed to:
#define checkStatus( err) \
if (err){\
printf("Error: %ld -> %s: line %d\n", err, __FILE__, __LINE__);\
fflush(stdout);\
return err; \
}
Anyway, I guess after saying all of this, I might as well just put my
fixed, modified, and cleaned up source for the project online for others
(and since there's no copyright/license stuff, who can stop me, heh heh):
http://destroyfx.org/PlayAudioFileLite/main.c
Marc
On Tue, 14 Oct 2003, Stanko Juzbasic wrote:
>
> Dear Holger,
>
>
>
> Nice to read from you. Your name does not sound unfamiliar to me. Do
>
> you happen to be the author of PlayAFLite?
>
>
>
> I have it in my sample code. I think it is a marvelous piece of
>
> educational code - I wish if only there were more meaningful sample
>
> apps like this one.
>
> Most of other samples that I ran across - I regret to say - are either
>
> clear but useless, or abuse CoreAudio for the sake of evangelizing
>
> Cocoa, Java, QuickTime, Objective C++ or whatsoever.
>
>
>
> Unfortunately, the API is seemingly being developed faster than it can
>
> be documented. So I ran into problems in building PAFLite. Prior to
>
> upgrading to Dec2002 DevTools, the part about MagicCookie (BTW, what
>
> on Earth is this ?), did not build, so I commented it out.
>
>
>
> Now that I upgraded DevTools and GCC, it produces even more errors,
>
> which makes me helpless. The more I read, the deeper it drags me into
>
> system specific stuff:
>
> ======================================
>
>
>
> main.c:74: parse error before `comp'
>
> main.c:75: `comp' undeclared (first use in this function)
>
> main.c:75: (Each undeclared identifier is reported only once
>
> main.c:75: for each function it appears in.)
>
> main.c:118: parse error before `result'
>
> main.c:124: `result' undeclared (first use in this function)
>
> main.c:135: warning: control reaches end of non-void function
>
> main.c:165: parse error before `magicCookieSize'
>
> main.c:168: `magicCookieSize' undeclared (first use in this function)
>
> =============================================
>
>
>
> If you have an idea what this could be all about, I'd be most grateful
>
> for your reply.
>
> Elsa, I'd have to buy another mac and install the former version of
>
> DevTools, so I can track changes in the API.
>
>
>
>
>
> Best regards,
>
>
>
> Stanko
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.