added nice description method to EZAudioFile and updated play file examples to use notifications

This commit is contained in:
Syed Haris Ali
2015-06-30 12:36:24 -07:00
parent 199f63d7e2
commit a832f27a5a
3 changed files with 118 additions and 0 deletions
@@ -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
//------------------------------------------------------------------------------