Re: Extracting and Saving a 'SND ' Resource;;;
Re: Extracting and Saving a 'SND ' Resource;;;
- Subject: Re: Extracting and Saving a 'SND ' Resource;;;
- From: Matt Budd (Madentec) <email@hidden>
- Date: Wed, 2 Feb 2005 16:40:44 -0700
Hi Jason,
I thought the same initially, but tried code similar to yours. To make
sure I wasn't crazy, I copied your code, and tried it and had the same
result. When the file is saved using this method, it is not a valid
.snd file. I open it using "SoundHack" and that program reports that it
is a "headerless sound file" (which sort of makes sense as to why they
look different in a hex-editor).
Is there a way I can retrieve this .snd header from the 'snd ' resource
and prepend it to the output file from your code below? It seems that
without this, the file created by that code is not valid.
- Matt
P.S. - I've also CC'd the quicktime guys, on this since to generate
this header I might have to do some crazy QT stuff?
On Feb 2, 2005, at 3:20 PM, Jason Harris wrote:
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:
email@hidden
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