Re: Extracting and Saving a 'SND ' Resource;
Re: Extracting and Saving a 'SND ' Resource;
- Subject: Re: Extracting and Saving a 'SND ' Resource;
- From: Jason Harris <email@hidden>
- Date: Wed, 2 Feb 2005 15:20:28 -0700
As far as I can tell from the docs, the 'SND ' resource should be
complete. You can get your handle into an NSData and then save it off
to disk doing the following:
Handle mySoundHandle;
// get the sound from the resource
SInt8 state = HGetState( mySoundHandle );
HLock( mySoundHandle );
NSData *data = [NSData dataWithBytes: *mySoundHandle length:
GetHandleSize(mySoundHandle)];
HSetState( mySoundHandle, state );
[data writeToFile: fileSystemPath atomically: NO];
Jason
On Feb 2, 2005, at 12:00 PM, Matt Budd (Madentec) wrote:
I'm trying to extract and save a 'SND ' resource from an old OS 9
program that I have. I use ResEdit in Classic-mode and I know the ID
of the SND resource (it's 1024). I have the file open, and can use the
GetResource('snd ', 1024) API call which returns to me a non-NULL
"Handle" data type.
Basically I want to (in code) read from this Handle to a SND resource,
and save a .snd or .aiff file on the hard drive. I was thinking of
just writing the contents of the Handle to a file, but that didn't
seem like it was going to work (if I hex-edit the contents of an
existing .snd file, it seems to have a header chunk that the SND
resource doesn't). I was also looking a bit on the net and it seems
like I can load a QuickTime movie with the 'SND ' resource, and then
save that move's soundtrack to disk.
The quicktime solution seems feasible, but also seems like a lot of
overhead to just write to disk that which I already have in memory. Do
you guys have any guidance or direction for me?
- Matt
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden