added nice description method to EZAudioFile and updated play file examples to use notifications
This commit is contained in:
+49
@@ -42,12 +42,61 @@
|
||||
//
|
||||
self.rollingHistorySlider.value = (float)[self.audioPlot rollingHistoryLength];
|
||||
|
||||
//
|
||||
// Listen for EZAudioPlayer notifications
|
||||
//
|
||||
[self setupNotifications];
|
||||
|
||||
/*
|
||||
Try opening the sample file
|
||||
*/
|
||||
[self openFileWithFilePathURL:[NSURL fileURLWithPath:kAudioFileDefault]];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#pragma mark - Notifications
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
- (void)setupNotifications
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(audioPlayerDidChangeAudioFile:)
|
||||
name:EZAudioPlayerDidChangeAudioFileNotification
|
||||
object:self.player];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(audioPlayerDidChangeOutputDevice:)
|
||||
name:EZAudioPlayerDidChangeOutputDeviceNotification
|
||||
object:self.player];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(audioPlayerDidChangePlayState:)
|
||||
name:EZAudioPlayerDidChangePlayStateNotification
|
||||
object:self.player];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
- (void)audioPlayerDidChangeAudioFile:(NSNotification *)notification
|
||||
{
|
||||
EZAudioPlayer *player = [notification object];
|
||||
NSLog(@"Player changed audio file: %@", [player audioFile]);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
- (void)audioPlayerDidChangeOutputDevice:(NSNotification *)notification
|
||||
{
|
||||
EZAudioPlayer *player = [notification object];
|
||||
NSLog(@"Player changed output device: %@", [player device]);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
- (void)audioPlayerDidChangePlayState:(NSNotification *)notification
|
||||
{
|
||||
EZAudioPlayer *player = [notification object];
|
||||
NSLog(@"Player change play state, isPlaying: %i", [player isPlaying]);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#pragma mark - Actions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user