Equalizer: Fix applying equalizer presets on automatic track change
parent
31e5cd9337
commit
f2feb3bcd7
|
@ -760,7 +760,8 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe)
|
|||
|
||||
[playlistController setCurrentEntry:pe];
|
||||
|
||||
equalizerApplyGenre([pe genre]);
|
||||
if (_eq)
|
||||
equalizerApplyGenre(_eq, [pe genre]);
|
||||
|
||||
lastPosition = -10;
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
extern void scale_by_volume(float * buffer, size_t count, float volume);
|
||||
|
||||
static NSString *CogPlaybackDidBeginNotficiation = @"CogPlaybackDidBeginNotficiation";
|
||||
|
||||
@implementation OutputCoreAudio
|
||||
|
||||
static void fillBuffers(AudioBufferList *ioData, float * inbuffer, size_t count, size_t offset)
|
||||
|
@ -158,7 +160,6 @@ static OSStatus renderCallback( void *inRefCon, AudioUnitRenderActionFlags *ioAc
|
|||
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.outputDevice" options:0 context:NULL];
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.GraphicEQenable" options:0 context:NULL];
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.GraphicEQpreset" options:0 context:NULL];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -184,10 +185,6 @@ default_device_changed(AudioObjectID inObjectID, UInt32 inNumberAddresses, const
|
|||
|
||||
[self setEqualizerEnabled:enabled];
|
||||
}
|
||||
else if ([keyPath isEqualToString:@"values.GraphicEQpreset"]) {
|
||||
if (_eq)
|
||||
[outputController refreshEqualizer:_eq];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)signalEndOfStream
|
||||
|
@ -755,7 +752,6 @@ default_device_changed(AudioObjectID inObjectID, UInt32 inNumberAddresses, const
|
|||
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeyPath:@"values.outputDevice"];
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeyPath:@"values.GraphicEQenable"];
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeyPath:@"values.GraphicEQpreset"];
|
||||
}
|
||||
|
||||
- (void)pause
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#import <AudioUnit/AudioUnit.h>
|
||||
#import <AudioToolbox/AudioToolbox.h>
|
||||
|
||||
void equalizerApplyGenre(NSString *genre);
|
||||
void equalizerApplyGenre(AudioUnit au, NSString *genre);
|
||||
void equalizerLoadPreset(AudioUnit au);
|
||||
void equalizerApplyPreset(AudioUnit au, NSDictionary * preset);
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ static void loadPresets()
|
|||
CFRelease(appUrlRef);
|
||||
}
|
||||
|
||||
void equalizerApplyGenre(NSString *genre) {
|
||||
void equalizerApplyGenre(AudioUnit au, NSString *genre) {
|
||||
equalizerGenre = genre;
|
||||
if ([[[NSUserDefaultsController sharedUserDefaultsController] defaults] boolForKey:@"GraphicEQtrackgenre"]) {
|
||||
loadPresets();
|
||||
|
@ -264,6 +264,8 @@ void equalizerApplyGenre(NSString *genre) {
|
|||
if (preset) {
|
||||
NSInteger index = [equalizer_presets_processed indexOfObject:preset];
|
||||
[[[NSUserDefaultsController sharedUserDefaultsController] defaults] setInteger:index forKey:@"GraphicEQpreset"];
|
||||
|
||||
equalizerApplyPreset(au, preset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -683,7 +685,7 @@ void equalizerApplyPreset(AudioUnit au, NSDictionary * preset) {
|
|||
|
||||
[[[NSUserDefaultsController sharedUserDefaultsController] defaults] setBool:enabled forKey:@"GraphicEQtrackgenre"];
|
||||
|
||||
equalizerApplyGenre(equalizerGenre);
|
||||
equalizerApplyGenre(au, equalizerGenre);
|
||||
|
||||
[self changePreset:presetButton];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue