From 895bb0c760e8c9f7de37fbcf70bc719e49dc4a84 Mon Sep 17 00:00:00 2001 From: vspader Date: Tue, 18 Apr 2006 17:00:29 +0000 Subject: [PATCH] Endian fix? --- Changelog | 8 ++++++++ PlaybackController.m | 12 ++++++++++-- Sound/SoundFile/FlacFile.m | 4 ++++ Sound/SoundFile/MPEGFile.mm | 13 +++++++++---- Sound/SoundFile/MusepackFile.m | 4 ++++ 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Changelog b/Changelog index 14112d832..8f6e06c5d 100644 --- a/Changelog +++ b/Changelog @@ -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 ------------ Fixed dock menu connections, and menu connections for play, stop, next, and previous. diff --git a/PlaybackController.m b/PlaybackController.m index bd7b51515..66657ac61 100644 --- a/PlaybackController.m +++ b/PlaybackController.m @@ -129,7 +129,7 @@ // DBLog(@"SEEKING?"); double time; time = [positionSlider doubleValue]; - + if ([sender tracking] == NO) // check if user stopped sliding before playing audio [soundController seekToTime:time]; @@ -158,7 +158,15 @@ - (IBAction)changeVolume:(id)sender { 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]; } diff --git a/Sound/SoundFile/FlacFile.m b/Sound/SoundFile/FlacFile.m index fdb9a113a..c71d92223 100644 --- a/Sound/SoundFile/FlacFile.m +++ b/Sound/SoundFile/FlacFile.m @@ -86,7 +86,11 @@ void ErrorProc(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus FLAC__file_decoder_process_until_end_of_metadata(decoder); +#ifdef __BIG_ENDIAN__ isBigEndian = YES; +#else + isBigEndian = NO; +#endif return YES; } diff --git a/Sound/SoundFile/MPEGFile.mm b/Sound/SoundFile/MPEGFile.mm index 536c253c3..f3eef3e54 100644 --- a/Sound/SoundFile/MPEGFile.mm +++ b/Sound/SoundFile/MPEGFile.mm @@ -28,6 +28,7 @@ // DBLog(@"Woot: %i", n); DecMPA_OutputFormat outputFormat; err = DecMPA_GetOutputFormat(decoder, &outputFormat); + if (err != DECMPA_OK) return NO; @@ -35,7 +36,11 @@ channels = outputFormat.nChannels; bitsPerSample = 16; +#ifdef __BIG_ENDIAN__ isBigEndian = YES; +#else + isBigEndian = NO; +#endif long duration; DecMPA_GetDuration(decoder, &duration); @@ -83,13 +88,13 @@ DecMPA_Decode(decoder, &((char *)buf)[total], size - total, &numread); } - -/* int n; + /* + int n; for (n = 0; n < total/2; n++) { - ((UInt16 *)buf)[n] = CFSwapInt16LittleToHost(((UInt16 *)buf)[n]); + ((UInt16 *)buf)[n] = CFSwapInt16BigToHost(((UInt16 *)buf)[n]); } -*/ + */ currentPosition += total; return total; } diff --git a/Sound/SoundFile/MusepackFile.m b/Sound/SoundFile/MusepackFile.m index b05f8095c..d343c4b5e 100644 --- a/Sound/SoundFile/MusepackFile.m +++ b/Sound/SoundFile/MusepackFile.m @@ -66,7 +66,11 @@ BOOL CanSeekProc(void *data) } // DBLog(@"Ok to go..."); +#ifdef __BIG_ENDIAN__ isBigEndian = YES; +#else + isBigEndian = NO; +#endif return YES; }