• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Ptr and NSData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Ptr and NSData


  • Subject: Ptr and NSData
  • From: Craig Bakalian <email@hidden>
  • Date: Mon, 23 Feb 2004 10:21:22 -0500

Hi,
I have been using Daisy as an example of how to capture data. I know
how to save the Ptr captureStorage to an aiff file. However, I am
attempting to amalgamate MIDI data and audio data into an archived
Cocoa NSDocument object. My interface is working well. I can record
both types of data and save to file. However, restoring the audio data
is an issue of which I have no answer. This is how I am archiving my
AudioTrackView object ->

-(void)encodeWithCoder: (NSCoder *)coder
{
[coder encodeObject: [self trackName]];
NSData *audio = [NSData dataWithBytes: captureStorage length:
captureTotalBytesCaptured];
[coder encodeObject: audio];
[coder encodeValueOfObjCType: @encode(BOOL) at: &recordEnabled];
[coder encodeValueOfObjCType: @encode(BOOL) at: &muteEnabled];
}

-(id)initWithCoder: (NSCoder *)coder
{
self = [super init];
[self setTrackName: [coder decodeObject]];
NSData *audio = [coder decodeObject];
captureStorage = malloc( kSizeOfCaptureBuffer);
captureStorage = (Ptr)[audio bytes];
captureTotalBytesCaptured = [audio length];
[coder decodeValueOfObjCType: @encode(BOOL) at: &recordEnabled];
[coder decodeValueOfObjCType: @encode(BOOL) at: &muteEnabled];
return self;
}

I can see captureStorage in the debug window and it gives me a -27,
which doesn't seem good for a memory location. However, when I run the
[audio description], I get a long pile of memory addresses, which seems
good. I know I am on the edge of Cocoa here, by trying to transform a
Pascal Ptr and put it back together, yet what is with the -27?

Or, if anyone know how or if you can stuff an AudioBufferList into a
NSMutableData, please email me. Someone did a while back,
unfortunately I trashed it, feeling it would be too slow for the
callback.


Craig Bakalian
www.eThinkingCap.com
_______________________________________________
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.

  • Prev by Date: Re: Misc: Live Window resizing
  • Next by Date: Re: Quicktime media type creation and registration
  • Previous by thread: Re: Is there any clock drift compensation mechanism in the HAL?
  • Next by thread: Re: HALOutputUnit (Pt 2)
  • Index(es):
    • Date
    • Thread