[futurebasic] convert 'snd ' resource to AIFF

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2010 : Group Archive : Group : All Groups

From: Ken Shmidheiser <kshmidheiser@...>
Date: Thu, 24 Jun 2010 08:54:27 -0400
Brian asked:

>Does anyone have a utility or code to convert a 'snd ' resource ( in 
>a .rsrc resource file ) into an AIFF file


Brian,

You can get a Classic snd resource to a Movie file programatically 
with this mothership code:

     http://developer.apple.com/mac/library/qa/qtmcc/qtmcc16.html


Another free open source project with both a finished application and 
source code which will convert an snd resource to either an AIFF or 
WAVE is :

     http://systemsoundext.sourceforge.net/

with the source code here:

 
http://prdownloads.sourceforge.net/systemsoundext/SystemSound50src.zip?download

The interesting part of this source code is the Objective-C 
adaptation of the Apple code mentioned above and found in 
converterController.m:

-(QTMovie *)makeMovie:(NSString *)path
{
FSSpec	inFile = [self fsSpecForPath: path];
Handle	outHandle = NULL;
MovieImportComponen	theImporter =  0;
Handle	hDataRef = NULL;
OSErr	err;
Movie	theMovie;

// create a new movie
theMovie = NewMovie(newMovieActive);
// allocate the data handle and create a data reference for this handle
// the caller is responsible for disposing of the data handle once 
done with the sound
outHandle = NewHandle(0);
err = PtrToHand(&outHandle, &hDataRef, sizeof(Handle));
     if (noErr == err)
	{
	SetMovieDefaultDataRef(theMovie, hDataRef, HandleDataHandlerSubType);
	OpenADefaultComponent(MovieImportType, 
kQTFileTypeSystemSevenSound, &theImporter);
		if (theImporter)
		{
         Track    ignoreTrack;
         TimeValue   ignoreDuration;   
         long     ignoreFlags;
         err = MovieImportFile(theImporter, &inFile, theMovie, 0, 
&ignoreTrack, 0, &ignoreDuration, 0, &ignoreFlags);
         CloseComponent(theImporter);
		}
	}

	if (hDataRef)
	DisposeHandle(hDataRef);

return [QTMovie movieWithQuickTimeMovie:theMovie disposeWhenDone:YES 
error:nil];
}

@end

I have also found File Juicer to be helpful:

    http://echoone.com/filejuicer/

    http://echoone.com/filejuicer/formats/formats?f=sfil

Ken

p.s. Michele wrote:

>You could leave iTunes aside using the afconvert command tool from
>Terminal: type "afconvert -h" for the help.

I believe afconvert handles NEXT/Sun .snd files, but I think they are 
a different format than Classic snd resource files.