Bitrate for some coreaudiofile files

CQTexperiment
vspader 2006-05-13 16:50:52 +00:00
parent 42ff4e5ef1
commit 5877c0b9fa
3 changed files with 20 additions and 6 deletions

View File

@ -188,6 +188,8 @@
else
{
int sec = (int)(([positionSlider maxValue] - pos)/1000.0);
if (sec < 0)
sec = 0;
text = [NSString stringWithFormat:NSLocalizedString(@"TimeRemaining", @""), sec/60, sec%60];
}
[timeField setStringValue:text];

View File

@ -250,10 +250,7 @@
PlaylistEntry* pe;
while (pe = [enumerator nextObject]) {
NSLog(@"Updating :%i", pe);
NSLog(@"Updating :%@", pe);
tt += [pe length];
NSLog(@"UpdateD");
}
int sec = (int)(tt/1000.0);

View File

@ -106,7 +106,7 @@ OSStatus writeFunc(void * inRefCon, SInt64 inPosition, ByteCount requestCount, c
{
OSStatus err;
#ifdef _USE_WRAPPER_
#ifdef _USE_WRAPPER_
// Open the input file
_inFd = fopen(filename, "r");
if (!_inFd)
@ -177,7 +177,23 @@ OSStatus writeFunc(void * inRefCon, SInt64 inPosition, ByteCount requestCount, c
err = ExtAudioFileDispose(_in);
return NO;
}
#ifdef _USE_WRAPPER_
SInt64 totalBytes;
size = sizeof(totalBytes);
err = AudioFileGetProperty(_audioID, kAudioFilePropertyAudioDataByteCount, &size, &totalBytes);
if(err != noErr) {
[self close];
return NO;
}
bitRate = ((totalBytes*8)/((totalFrames)/asbd.mSampleRate))/1000.0;
#else
//Is there a way to get bitrate with extAudioFile?
bitRate = 0;
#endif
// Set our properties
bitsPerSample = asbd.mBitsPerChannel;
channels = asbd.mChannelsPerFrame;
@ -189,7 +205,6 @@ OSStatus writeFunc(void * inRefCon, SInt64 inPosition, ByteCount requestCount, c
}
totalSize = totalFrames * channels * (bitsPerSample / 8);
bitRate = 0;
// Set output format
AudioStreamBasicDescription result;