Re: Audio Stream Access Difficulties - Please Read
Re: Audio Stream Access Difficulties - Please Read
- Subject: Re: Audio Stream Access Difficulties - Please Read
- From: email@hidden
- Date: Tue, 20 Apr 2004 04:02:16 -0400
Hiya,
Its 4:00 in the morning and I haven't a lot of time, but I have recently used
the "ReverseOfflineUnit" from SampleEffectUnit
(/Developer/Examples/CoreAudio/AudioUnits/SampleAUs) with auprocess.cpp
(/Developer/Examples/CoreAudio/Services/AudioFileTools) with great success. It
would do everything you want and to manipulate the audio stream you would
basically just drop in your DSP into the render.
If you have trouble using them email me.
Kind Regards,
Robert Ferguson
Quoting Asher Vander Heiden <email@hidden>:
>
Hey,
>
>
I've been trying to use the AudioToolbox to access an Audio stream from an
>
audio file.
>
I want to open a file, manipulate the stream and then save this as a new
>
file.
>
I've managed everything but manipulate the stream.
>
>
In the sample below I have saved the stream gEntireFileBuffer and cannot
>
view what is inside it!!!
>
(I realise that there are other things to consider when looking at the
>
stream, like the offset and sample size etc, but first I just want to be
>
able to get to the file info).
>
>
I'm not too sure whether I'm on the right track here. Is it possible that I
>
need to use AUDIO CODEC or an AUDIO UNIT to access the stream ?
>
>
>
void *gEntireFileBuffer;
>
AudioFileID *gSourceAudioFileID;
>
UInt64 gTotalPacketCount=0;
>
UInt64 gFileByteCount =0;
>
// my global vars
>
FSRef inParentRef;
>
FSRef inNewFileRef;
>
Boolean isDirectory;
>
CFStringRef inFileName;
>
FSRef outNewFileRef;
>
AudioFileID outAudioFile2;
>
UInt64 gSample;
>
>
int main (int argc, const char * argv[])
>
{
>
OSStatus err = noErr;
>
UInt32 size;
>
AudioStreamBasicDescription fileASBD;
>
AudioFileID musicFileID;
>
FSRef fileRef;
>
char *fileName ="/System/Library/Sounds/Blow.aiff";
>
UInt32 bytesReturned = 0;
>
UInt32 packets =gTotalPacketCount;
>
>
//Obtain filesystem reference to the file using the file path
>
FSPathMakeRef ((const UInt8 *)fileName, fileRef, 0);
>
//Open an AudioFile and obtain AudioFileID using the file system ref
>
err = AudioFileOpen(fileRef, fsRdPerm,0,gSourceAudioFileID );
>
//Get AudioFilePropertyDataFormat
>
size = sizeof(AudioStreamBasicDescription);
>
memset(fileASBD, 0, size);
>
err = AudioFileGetProperty(*gSourceAudioFileID,
>
kAudioFilePropertyDataFormat,
>
&size,
>
fileASBD);
>
checkStatus(err);
>
// Creating outfile
>
FSPathMakeRef ("/Developer/", &inParentRef, &isDirectory);
>
inFileName = CFSTR("NewAudioFile.aiff");
>
err = AudioFileCreate(&inParentRef,
>
inFileName,
>
'AIFF',
>
fileASBD,
>
0,
>
&outNewFileRef,
>
&outAudioFile2);
>
checkStatus(err);
>
>
//alloc a buffer of memory to hold the data read from disk.
>
gEntireFileBuffer = malloc(gFileByteCount);
>
memset(gEntireFileBuffer, 0, gFileByteCount);
>
//Read in the ENTIRE file into a memory buffer
>
err = AudioFileReadPackets (*gSourceAudioFileID,
>
false,
>
&bytesReturned,
>
NULL,
>
0,
>
&packets,
>
gEntireFileBuffer);
>
>
for(x=0;x<bytesReturned;x++)
>
{
>
********** THIS IS WHERE I WANT TO ACCESS THE BUFFER gEntireFileBuffer
>
********
>
********** TO DO MY MANIPULATION ..... HOW ??????????????
>
*******************
>
}
>
err = AudioFileWritePackets(outAudioFile2,
>
false,
>
bytesReturned,
>
NULL,
>
0,
>
&packets,
>
gEntireFileBuffer);
>
checkStatus(err);
>
//Cleaning anything allocated.
>
AudioFileClose(*gSourceAudioFileID); //Closes the audio files
>
AudioFileClose(outAudioFile2);
>
if(gEntireFileBuffer !=NULL){
>
free(gEntireFileBuffer);
>
gEntireFileBuffer = NULL;
>
}
>
return 0;
>
}
>
>
>
>
Thank you so much for you time,
>
>
Asher
>
>
_________________________________________________________________
>
Get Extra Storage in 10MB, 25MB, 50MB and 100MB options now! Go to
>
http://join.msn.com/?pgmarket=en-au&page=hotmail/es2
>
_______________________________________________
>
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.
>
>
-------------------------------------------------
_______________________________________________
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.