Reduced volume with flanger demo

Re: Reduced volume with flanger demo

Postby mcanulty » Mon Aug 15, 2011 8:56 pm

I'm not sure what the performance penalty is for implementing these macro-wrapping functions, but it might be worth it to avoid confusing the average C programmer like me, who has to look up the difference between a function and a macro in a book before he knows what's going on.

On the other hand, maybe just some comments in the code alerting people to the presence of macros might be enough.


Yeah, to get the arduino to handle audio, getting the best performance possible out of the micro is essential. So the macros and such are designed to help keep the code efficient partly by the way they unravel into explicit commands rather than creating a jump in the code.

If you're like me, you'll find that getting into this kind of coding is a huge eye opener in understanding the way C works in a really fundamental way, and even though that sounds really scary, I've found it kind of fun really. Good suggestion on making the language a bit clearer, and maybe we can post further comments on macros in a new thread for future readers who are scratching their heads.
mcanulty
Site Admin
 
Posts: 63
Joined: Thu May 20, 2010 10:46 pm

Re: Reduced volume with flanger demo

Postby rascalmicro » Tue Aug 16, 2011 5:23 am

if you dont use the macros
it takes 4 times as long to do a multiply


Wait, it's 4 times longer if you wrap the macros in function calls, or 4 times longer if you forget the macros entirely and just do integer multiplication in C?

I'd be surprised if just the function wrapper takes 4 times as long, but it sounds like you've actually tested this, while I'm just guessing.

Brandon
Brandon Stafford
Rascal Micro: small computers for art and science
rascalmicro
 
Posts: 8
Joined: Sat Aug 13, 2011 4:19 pm
Location: Somerville, MA, USA

Re: Reduced volume with flanger demo

Postby guest » Tue Aug 16, 2011 1:11 pm

good catch
its 4x doing a normal mutiply
a function wrapper shouldnt incur too much loss
as long is its still an inline function
guest
Site Admin
 
Posts: 449
Joined: Thu May 20, 2010 11:58 pm

Re: Reduced volume with flanger demo

Postby mcanulty » Thu Aug 18, 2011 9:13 pm

Ah yeah, that was me overgeneralizing I think!
mcanulty
Site Admin
 
Posts: 63
Joined: Thu May 20, 2010 10:46 pm

Previous

Return to Audio Codec Shield

Who is online

Users browsing this forum: No registered users and 1 guest


cron