Audio stream using the toolbox
Audio stream using the toolbox
- Subject: Audio stream using the toolbox
- From: Hotmail <email@hidden>
- Date: Thu, 08 Apr 2004 07:45:03 +1000
Hey,
I've progressed on my work on the audio stream using the toolbox.
It appears that I am accessing the stream.
However, I am also attempting to create a new audio file. Then copy part of
this stream into the new file. I'm doing my best with very little help from
the help documents.
I am wonder why a new audio file is not showing up on the desktop when I run
the following code:
AudioFileID outAudioFile;
SInt8 inPermissions;
inPermissions = 0x00;
AudioFileOpen (
&destFSRef,//const FSRef *inFileRef,
inPermissions,
0,//UInt32 inFlags,
&outAudioFile);
float outBuffer[300];
UInt32 ioNumBytes = 300 * sizeof(float);
AudioFileReadBytes(
outAudioFile,//AudioFileID inAudioFile,
true,//Boolean inUseCache,
0,//SInt64 inStartingByte,
&ioNumBytes,
&outBuffer
);
UInt32 outDataSize;
UInt32 isWritable;
AudioFileGetPropertyInfo(
outAudioFile,//AudioFileID inAudioFile,
'fmti',//AudioFilePropertyID inPropertyID,
&outDataSize, //UInt32 *outDataSize,
&isWritable //UInt32 *isWritable
);
AudioStreamBasicDescription ASBScurrentfile;
AudioFileGetProperty(
outAudioFile,//AudioFileID inAudioFile,
'fmti',//AudioFilePropertyID inPropertyID,
&outDataSize, //UInt32 *ioDataSize,
&ASBScurrentfile//void *outPropertyData
);
FSRef inParentRef;
Boolean isDirectory;
FSPathMakeRef (
"/Users/lachlanbarratt/Desktop/",// const UInt8 * path,
&inParentRef, //FSRef * ref,
&isDirectory //Boolean * isDirectory
);
CFStringRef inFileName;
FSRef outNewFileRef;
AudioFileID outAudioFile2;
inFileName = CFSTR("NewAudioFile");
AudioFileCreate(
&inParentRef, //const FSRef *inParentRef,
inFileName,//CFStringRef inFileName,
'AIFF',//UInt32 inFileType,
&ASBScurrentfile, //const AudioStreamBasicDescription *inFormat,
0, //UInt32 inFlags,
&outNewFileRef, //FSRef *outNewFileRef,
&outAudioFile2 //AudioFileID *outAudioFile
);
AudioFileWriteBytes(
outAudioFile2,//AudioFileID inAudioFile,
true, //Boolean inUseCache,
0, //SInt64 inStartingByte,
&ioNumBytes, //UInt32 *ioNumBytes,
&outBuffer //void *inBuffer
);
AudioFileClose(outAudioFile);
AudioFileClose(outAudioFile2);
Thank you for your time.
_______________________________________________
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.