Endian fix?

CQTexperiment
vspader 2006-04-18 17:00:29 +00:00
parent 349a3b0ba2
commit 895bb0c760
5 changed files with 35 additions and 6 deletions

View File

@ -1,3 +1,11 @@
0.05 alpha 4
------------
Volume slider now gravitates to 100%, in the middle.
0.05 alpha 3
------------
Universal binary
0.05 alpha 2 0.05 alpha 2
------------ ------------
Fixed dock menu connections, and menu connections for play, stop, next, and previous. Fixed dock menu connections, and menu connections for play, stop, next, and previous.

View File

@ -129,7 +129,7 @@
// DBLog(@"SEEKING?"); // DBLog(@"SEEKING?");
double time; double time;
time = [positionSlider doubleValue]; time = [positionSlider doubleValue];
if ([sender tracking] == NO) // check if user stopped sliding before playing audio if ([sender tracking] == NO) // check if user stopped sliding before playing audio
[soundController seekToTime:time]; [soundController seekToTime:time];
@ -158,7 +158,15 @@
- (IBAction)changeVolume:(id)sender - (IBAction)changeVolume:(id)sender
{ {
currentVolume = (float)[sender doubleValue]; currentVolume = (float)[sender doubleValue];
//gravitates at the halfway mark
float v = ([sender frame].size.width/[sender maxValue])*(currentVolume-([sender maxValue]/2.0));
if (fabs(v) < 10.0)
{
currentVolume = [sender maxValue]/2.0;
[sender setDoubleValue:currentVolume];
}
[soundController setVolume:currentVolume]; [soundController setVolume:currentVolume];
} }

View File

@ -86,7 +86,11 @@ void ErrorProc(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus
FLAC__file_decoder_process_until_end_of_metadata(decoder); FLAC__file_decoder_process_until_end_of_metadata(decoder);
#ifdef __BIG_ENDIAN__
isBigEndian = YES; isBigEndian = YES;
#else
isBigEndian = NO;
#endif
return YES; return YES;
} }

View File

@ -28,6 +28,7 @@
// DBLog(@"Woot: %i", n); // DBLog(@"Woot: %i", n);
DecMPA_OutputFormat outputFormat; DecMPA_OutputFormat outputFormat;
err = DecMPA_GetOutputFormat(decoder, &outputFormat); err = DecMPA_GetOutputFormat(decoder, &outputFormat);
if (err != DECMPA_OK) if (err != DECMPA_OK)
return NO; return NO;
@ -35,7 +36,11 @@
channels = outputFormat.nChannels; channels = outputFormat.nChannels;
bitsPerSample = 16; bitsPerSample = 16;
#ifdef __BIG_ENDIAN__
isBigEndian = YES; isBigEndian = YES;
#else
isBigEndian = NO;
#endif
long duration; long duration;
DecMPA_GetDuration(decoder, &duration); DecMPA_GetDuration(decoder, &duration);
@ -83,13 +88,13 @@
DecMPA_Decode(decoder, &((char *)buf)[total], size - total, &numread); DecMPA_Decode(decoder, &((char *)buf)[total], size - total, &numread);
} }
/*
/* int n; int n;
for (n = 0; n < total/2; n++) for (n = 0; n < total/2; n++)
{ {
((UInt16 *)buf)[n] = CFSwapInt16LittleToHost(((UInt16 *)buf)[n]); ((UInt16 *)buf)[n] = CFSwapInt16BigToHost(((UInt16 *)buf)[n]);
} }
*/ */
currentPosition += total; currentPosition += total;
return total; return total;
} }

View File

@ -66,7 +66,11 @@ BOOL CanSeekProc(void *data)
} }
// DBLog(@"Ok to go..."); // DBLog(@"Ok to go...");
#ifdef __BIG_ENDIAN__
isBigEndian = YES; isBigEndian = YES;
#else
isBigEndian = NO;
#endif
return YES; return YES;
} }