Skip to content

Commit

Permalink
Updated Sound Manager to version 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Jul 1, 2011
1 parent ae8f520 commit d3d7589
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion LICENCE.md
@@ -1,6 +1,6 @@
SoundManager

Version 1.1.1, June 29th, 2011
Version 1.1.2, June 29th, 2011

Copyright (C) 2011 Charcoal Design

Expand Down
6 changes: 6 additions & 0 deletions RELEASE NOTES.md
@@ -1,3 +1,9 @@
Version 1.1.2

- Fixed occasional crash due to accessing sound after it is released
- Sound manager will now log a warning to the console when passed a non-existent sound file instead of crashing
- Sound names can now include directory separators. This means that sounds in subfolders of the resource folder can be played using the standard play functions.

Version 1.1.1

- Fixed bugs with music fading
Expand Down
2 changes: 1 addition & 1 deletion SoundManager/SoundManager.h
@@ -1,7 +1,7 @@
//
// SoundManager.h
//
// Version 1.1.1
// Version 1.1.2
//
// Created by Nick Lockwood on 29/01/2011.
// Copyright 2010 Charcoal Design. All rights reserved.
Expand Down
22 changes: 18 additions & 4 deletions SoundManager/SoundManager.m
@@ -1,7 +1,7 @@
//
// SoundManager.m
//
// Version 1.1.1
// Version 1.1.2
//
// Created by Nick Lockwood on 29/01/2011.
// Copyright 2010 Charcoal Design. All rights reserved.
Expand Down Expand Up @@ -88,8 +88,19 @@ - (Sound *)initWithName:(NSString *)_name;
{
_name = [_name stringByAppendingPathExtension:FILE_EXTENSION];
}
NSString *path = [[NSBundle mainBundle] pathForResource:_name ofType:nil];
return [self initWithURL:[NSURL fileURLWithPath:path]];

NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:_name];

#ifdef DEBUG

if (![[NSFileManager defaultManager] fileExistsAtPath:path])
{
NSLog(@"Sound file '%@' does not exist", _name);
}

#endif

return [self initWithURL:[NSURL fileURLWithPath:path]];
}

- (Sound *)initWithURL:(NSURL *)_url;
Expand Down Expand Up @@ -204,7 +215,9 @@ - (void)stop
[(NSSound *)sound stop];
#endif

self.selfReference = nil;
//autorelease so sound is not released immediately
[selfReference autorelease];
selfReference = nil;
}

#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
Expand All @@ -214,6 +227,7 @@ - (void)sound:(NSSound *)_sound didFinishPlaying:(BOOL)finishedPlaying
#endif
{
[self stop];

[[NSNotificationCenter defaultCenter] postNotificationName:SoundFinishedPlayingNotification object:self];
}

Expand Down

0 comments on commit d3d7589

Please sign in to comment.