Re: Data Types for Extracting samples from Audio Buffer: Resolved
Re: Data Types for Extracting samples from Audio Buffer: Resolved
- Subject: Re: Data Types for Extracting samples from Audio Buffer: Resolved
- From: Graham Cox <email@hidden>
- Date: Tue, 7 Oct 2008 10:53:56 +1100
On 7 Oct 2008, at 1:46 am, Joseph Ayers wrote:
ipsamp = [NSNumber numberWithFloat:(float)ippointer[isamp]];
[ipbufaddObject:ipsamp];
idsamp = [NSNumber numberWithFloat:(float)idpointer[isamp]];
[idbufaddObject:idsamp];
Just a final comment. The cast to (float) here is not required.
ippointer is already declared as a float* so ippointer[index] returns
data of type float as it is. I mention it because while here it's
merely redundant and harmless, your first attempt as posted to me off-
list has this cast as [NSNumber numberWithFloat:(unsigned
long)ippointer[index]]; Where the cast is most definitely not harmless
and in fact prevents the code from working. Throwing in casts without
understanding why you're doing it is a good way to introduce bugs, so
don't do it unless you really have to.
Also, what Nick said about the memory leak.
cheers, Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden