├── .gitignore ├── Classes ├── MCSoundBoard.h └── MCSoundBoard.m ├── LICENSE.md ├── MCSoundBoard.xcodeproj └── project.pbxproj ├── MCSoundBoard ├── AppDelegate.h ├── AppDelegate.m ├── MCSoundBoard-Info.plist ├── MCSoundBoard-Prefix.pch ├── ViewController.h ├── ViewController.m ├── en.lproj │ ├── InfoPlist.strings │ └── ViewController.xib └── main.m ├── README.md └── Sounds ├── ding.wav ├── loop.mp3 └── play.mp3 /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | MCSoundBoard.xcodeproj/project.xcworkspace/contents.xcworkspacedata 3 | 4 | MCSoundBoard.xcodeproj/project.xcworkspace/xcuserdata/baglan.xcuserdatad/UserInterfaceState.xcuserstate 5 | 6 | MCSoundBoard.xcodeproj/xcuserdata/baglan.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist 7 | 8 | MCSoundBoard.xcodeproj/xcuserdata/baglan.xcuserdatad/xcschemes/MCSoundBoard.xcscheme 9 | 10 | MCSoundBoard.xcodeproj/xcuserdata/baglan.xcuserdatad/xcschemes/xcschememanagement.plist 11 | -------------------------------------------------------------------------------- /Classes/MCSoundBoard.h: -------------------------------------------------------------------------------- 1 | // 2 | // MCSoundBoard.h 3 | // MCSoundBoard 4 | // 5 | // Created by Baglan Dosmagambetov on 7/14/12. 6 | // Copyright (c) 2012 MobileCreators. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #define MCSOUNDBOARD_SOUND_PLAYED_NOTIFICATION @"MCSOUNDBOARD_SOUND_PLAYED_NOTIFICATION" 13 | #define MCSOUNDBOARD_AUDIO_STARTED_NOTIFICATION @"MCSOUNDBOARD_AUDIO_STARTED_NOTIFICATION" 14 | #define MCSOUNDBOARD_AUDIO_PAUSED_NOTIFICATION @"MCSOUNDBOARD_AUDIO_PAUSED_NOTIFICATION" 15 | #define MCSOUNDBOARD_AUDIO_STOPPED_NOTIFICATION @"MCSOUNDBOARD_AUDIO_STOPPED_NOTIFICATION" 16 | 17 | @interface MCSoundBoard : NSObject 18 | 19 | + (void)addSoundAtPath:(NSString *)filePath forKey:(id)key; 20 | + (void)playSoundForKey:(id)key; 21 | 22 | + (void)addAudioAtPath:(NSString *)filePath forKey:(id)key; 23 | 24 | + (void)playAudioForKey:(id)key fadeInInterval:(NSTimeInterval)fadeInInterval; 25 | + (void)playAudioForKey:(id)key; 26 | 27 | + (void)stopAudioForKey:(id)key fadeOutInterval:(NSTimeInterval)fadeOutInterval; 28 | + (void)stopAudioForKey:(id)key; 29 | 30 | + (void)pauseAudioForKey:(id)key fadeOutInterval:(NSTimeInterval)fadeOutInterval; 31 | + (void)pauseAudioForKey:(id)key; 32 | 33 | + (AVAudioPlayer *)audioPlayerForKey:(id)key; 34 | 35 | + (void)loopAudioForKey:(id)key numberOfLoops:(NSInteger)loops; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Classes/MCSoundBoard.m: -------------------------------------------------------------------------------- 1 | // 2 | // MCSoundBoard.m 3 | // MCSoundBoard 4 | // 5 | // Created by Baglan Dosmagambetov on 7/14/12. 6 | // Copyright (c) 2012 MobileCreators. All rights reserved. 7 | // 8 | 9 | #import "MCSoundBoard.h" 10 | #import 11 | 12 | #define MCSOUNDBOARD_AUDIO_FADE_STEPS 30 13 | 14 | @implementation MCSoundBoard { 15 | NSMutableDictionary *_sounds; 16 | NSMutableDictionary *_audio; 17 | } 18 | 19 | // Sound board singleton 20 | // Taken from http://lukeredpath.co.uk/blog/a-note-on-objective-c-singletons.html 21 | + (MCSoundBoard *)sharedInstance 22 | { 23 | __strong static id _sharedObject = nil; 24 | static dispatch_once_t onceToken; 25 | dispatch_once(&onceToken, ^{ 26 | _sharedObject = [[self alloc] init]; 27 | }); 28 | return _sharedObject; 29 | } 30 | 31 | - (id)init 32 | { 33 | self = [super init]; 34 | if (self != nil) { 35 | _sounds = [NSMutableDictionary dictionary]; 36 | _audio = [NSMutableDictionary dictionary]; 37 | } 38 | return self; 39 | } 40 | 41 | - (void)addSoundAtPath:(NSString *)filePath forKey:(id)key 42 | { 43 | NSURL* fileURL = [NSURL fileURLWithPath:filePath]; 44 | SystemSoundID soundId; 45 | AudioServicesCreateSystemSoundID((__bridge CFURLRef)fileURL, &soundId); 46 | 47 | [_sounds setObject:[NSNumber numberWithInt:soundId] forKey:key]; 48 | } 49 | 50 | + (void)addSoundAtPath:(NSString *)filePath forKey:(id)key 51 | { 52 | [[self sharedInstance] addSoundAtPath:filePath forKey:key]; 53 | } 54 | 55 | - (void)playSoundForKey:(id)key 56 | { 57 | SystemSoundID soundId = [(NSNumber *)[_sounds objectForKey:key] intValue]; 58 | AudioServicesPlaySystemSound(soundId); 59 | [[NSNotificationCenter defaultCenter] postNotificationName:MCSOUNDBOARD_SOUND_PLAYED_NOTIFICATION object:key]; 60 | } 61 | 62 | + (void)playSoundForKey:(id)key 63 | { 64 | [[self sharedInstance] playSoundForKey:key]; 65 | } 66 | 67 | - (void)addAudioAtPath:(NSString *)filePath forKey:(id)key 68 | { 69 | NSURL* fileURL = [NSURL fileURLWithPath:filePath]; 70 | AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:NULL]; 71 | [_audio setObject:player forKey:key]; 72 | } 73 | 74 | + (void)addAudioAtPath:(NSString *)filePath forKey:(id)key 75 | { 76 | [[self sharedInstance] addAudioAtPath:filePath forKey:key]; 77 | } 78 | 79 | - (void)fadeIn:(NSTimer *)timer 80 | { 81 | AVAudioPlayer *player = timer.userInfo; 82 | float volume = player.volume; 83 | volume = volume + 1.0 / MCSOUNDBOARD_AUDIO_FADE_STEPS; 84 | volume = volume > 1.0 ? 1.0 : volume; 85 | player.volume = volume; 86 | 87 | if (volume == 1.0) { 88 | [timer invalidate]; 89 | } 90 | } 91 | 92 | - (void)playAudioForKey:(id)key fadeInInterval:(NSTimeInterval)fadeInInterval 93 | { 94 | AVAudioPlayer *player = [_audio objectForKey:key]; 95 | 96 | // If fade in inteval interval is not 0, schedule fade in 97 | if (fadeInInterval > 0.0) { 98 | player.volume = 0.0; 99 | NSTimeInterval interval = fadeInInterval / MCSOUNDBOARD_AUDIO_FADE_STEPS; 100 | [NSTimer scheduledTimerWithTimeInterval:interval 101 | target:self 102 | selector:@selector(fadeIn:) 103 | userInfo:player 104 | repeats:YES]; 105 | } 106 | 107 | [player play]; 108 | 109 | [[NSNotificationCenter defaultCenter] postNotificationName:MCSOUNDBOARD_AUDIO_STARTED_NOTIFICATION object:key]; 110 | } 111 | 112 | + (void)playAudioForKey:(id)key fadeInInterval:(NSTimeInterval)fadeInInterval 113 | { 114 | [[self sharedInstance] playAudioForKey:key fadeInInterval:fadeInInterval]; 115 | } 116 | 117 | + (void)playAudioForKey:(id)key 118 | { 119 | [[self sharedInstance] playAudioForKey:key fadeInInterval:0.0]; 120 | } 121 | 122 | 123 | - (void)fadeOutAndStop:(NSTimer *)timer 124 | { 125 | AVAudioPlayer *player = timer.userInfo; 126 | float volume = player.volume; 127 | volume = volume - 1.0 / MCSOUNDBOARD_AUDIO_FADE_STEPS; 128 | volume = volume < 0.0 ? 0.0 : volume; 129 | player.volume = volume; 130 | 131 | if (volume == 0.0) { 132 | [timer invalidate]; 133 | [player stop]; 134 | } 135 | } 136 | 137 | - (void)stopAudioForKey:(id)key fadeOutInterval:(NSTimeInterval)fadeOutInterval 138 | { 139 | AVAudioPlayer *player = [_audio objectForKey:key]; 140 | 141 | // If fade in inteval interval is not 0, schedule fade in 142 | if (fadeOutInterval > 0) { 143 | NSTimeInterval interval = fadeOutInterval / MCSOUNDBOARD_AUDIO_FADE_STEPS; 144 | [NSTimer scheduledTimerWithTimeInterval:interval 145 | target:self 146 | selector:@selector(fadeOutAndStop:) 147 | userInfo:player 148 | repeats:YES]; 149 | } else { 150 | [player stop]; 151 | } 152 | 153 | [[NSNotificationCenter defaultCenter] postNotificationName:MCSOUNDBOARD_AUDIO_STOPPED_NOTIFICATION object:key]; 154 | } 155 | 156 | + (void)stopAudioForKey:(id)key fadeOutInterval:(NSTimeInterval)fadeOutInterval 157 | { 158 | [[self sharedInstance] stopAudioForKey:key fadeOutInterval:fadeOutInterval]; 159 | } 160 | 161 | + (void)stopAudioForKey:(id)key 162 | { 163 | [[self sharedInstance] stopAudioForKey:key fadeOutInterval:0.0]; 164 | } 165 | 166 | 167 | - (void)fadeOutAndPause:(NSTimer *)timer 168 | { 169 | AVAudioPlayer *player = timer.userInfo; 170 | float volume = player.volume; 171 | volume = volume - 1.0 / MCSOUNDBOARD_AUDIO_FADE_STEPS; 172 | volume = volume < 0.0 ? 0.0 : volume; 173 | player.volume = volume; 174 | 175 | if (volume == 0.0) { 176 | [timer invalidate]; 177 | [player pause]; 178 | } 179 | } 180 | 181 | - (void)pauseAudioForKey:(id)key fadeOutInterval:(NSTimeInterval)fadeOutInterval 182 | { 183 | AVAudioPlayer *player = [_audio objectForKey:key]; 184 | 185 | // If fade in inteval interval is not 0, schedule fade in 186 | if (fadeOutInterval > 0) { 187 | NSTimeInterval interval = fadeOutInterval / MCSOUNDBOARD_AUDIO_FADE_STEPS; 188 | [NSTimer scheduledTimerWithTimeInterval:interval 189 | target:self 190 | selector:@selector(fadeOutAndPause:) 191 | userInfo:player 192 | repeats:YES]; 193 | } else { 194 | [player pause]; 195 | } 196 | 197 | [[NSNotificationCenter defaultCenter] postNotificationName:MCSOUNDBOARD_AUDIO_PAUSED_NOTIFICATION object:key]; 198 | } 199 | 200 | 201 | + (void)pauseAudioForKey:(id)key fadeOutInterval:(NSTimeInterval)fadeOutInterval 202 | { 203 | [[self sharedInstance] pauseAudioForKey:key fadeOutInterval:fadeOutInterval]; 204 | } 205 | 206 | + (void)pauseAudioForKey:(id)key 207 | { 208 | [[self sharedInstance] pauseAudioForKey:key fadeOutInterval:0.0]; 209 | } 210 | 211 | 212 | - (AVAudioPlayer *)audioPlayerForKey:(id)key 213 | { 214 | return [_audio objectForKey:key]; 215 | } 216 | 217 | + (AVAudioPlayer *)audioPlayerForKey:(id)key 218 | { 219 | return [[self sharedInstance] audioPlayerForKey:key]; 220 | } 221 | 222 | + (void)loopAudioForKey:(id)key numberOfLoops:(NSInteger)loops 223 | { 224 | AVAudioPlayer * player = [self audioPlayerForKey:key]; 225 | player.numberOfLoops = loops; 226 | } 227 | 228 | @end 229 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | Copyright (c) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /MCSoundBoard.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 863B726E15B2A35900C12159 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 863B726D15B2A35900C12159 /* AudioToolbox.framework */; }; 11 | 863B727515B2AEDE00C12159 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 863B727415B2AEDE00C12159 /* AVFoundation.framework */; }; 12 | 863B727715B2BC6E00C12159 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 863B727615B2BC6E00C12159 /* README.md */; }; 13 | 863B728015B2C82E00C12159 /* ding.wav in Resources */ = {isa = PBXBuildFile; fileRef = 863B727D15B2C82E00C12159 /* ding.wav */; }; 14 | 863B728115B2C82E00C12159 /* loop.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 863B727E15B2C82E00C12159 /* loop.mp3 */; }; 15 | 863B728215B2C82E00C12159 /* play.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 863B727F15B2C82E00C12159 /* play.mp3 */; }; 16 | 863B728415B2D6E400C12159 /* LICENSE.md in Resources */ = {isa = PBXBuildFile; fileRef = 863B728315B2D6E400C12159 /* LICENSE.md */; }; 17 | 86C3E40F15B1D06200316991 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86C3E40E15B1D06200316991 /* UIKit.framework */; }; 18 | 86C3E41115B1D06200316991 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86C3E41015B1D06200316991 /* Foundation.framework */; }; 19 | 86C3E41315B1D06200316991 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86C3E41215B1D06200316991 /* CoreGraphics.framework */; }; 20 | 86C3E41915B1D06200316991 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 86C3E41715B1D06200316991 /* InfoPlist.strings */; }; 21 | 86C3E41B15B1D06200316991 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 86C3E41A15B1D06200316991 /* main.m */; }; 22 | 86C3E41F15B1D06200316991 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 86C3E41E15B1D06200316991 /* AppDelegate.m */; }; 23 | 86C3E42215B1D06200316991 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 86C3E42115B1D06200316991 /* ViewController.m */; }; 24 | 86C3E42515B1D06200316991 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 86C3E42315B1D06200316991 /* ViewController.xib */; }; 25 | 86C3E42E15B1D0D300316991 /* MCSoundBoard.m in Sources */ = {isa = PBXBuildFile; fileRef = 86C3E42D15B1D0D300316991 /* MCSoundBoard.m */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | 863B726D15B2A35900C12159 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 30 | 863B727415B2AEDE00C12159 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 31 | 863B727615B2BC6E00C12159 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = ""; }; 32 | 863B727D15B2C82E00C12159 /* ding.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = ding.wav; path = Sounds/ding.wav; sourceTree = ""; }; 33 | 863B727E15B2C82E00C12159 /* loop.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = loop.mp3; path = Sounds/loop.mp3; sourceTree = ""; }; 34 | 863B727F15B2C82E00C12159 /* play.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = play.mp3; path = Sounds/play.mp3; sourceTree = ""; }; 35 | 863B728315B2D6E400C12159 /* LICENSE.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE.md; sourceTree = ""; }; 36 | 86C3E40A15B1D06200316991 /* MCSoundBoard.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MCSoundBoard.app; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 86C3E40E15B1D06200316991 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 38 | 86C3E41015B1D06200316991 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 39 | 86C3E41215B1D06200316991 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 40 | 86C3E41615B1D06200316991 /* MCSoundBoard-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "MCSoundBoard-Info.plist"; sourceTree = ""; }; 41 | 86C3E41815B1D06200316991 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 42 | 86C3E41A15B1D06200316991 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 43 | 86C3E41C15B1D06200316991 /* MCSoundBoard-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MCSoundBoard-Prefix.pch"; sourceTree = ""; }; 44 | 86C3E41D15B1D06200316991 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 45 | 86C3E41E15B1D06200316991 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 46 | 86C3E42015B1D06200316991 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 47 | 86C3E42115B1D06200316991 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 48 | 86C3E42415B1D06200316991 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController.xib; sourceTree = ""; }; 49 | 86C3E42C15B1D0D300316991 /* MCSoundBoard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MCSoundBoard.h; path = Classes/MCSoundBoard.h; sourceTree = ""; }; 50 | 86C3E42D15B1D0D300316991 /* MCSoundBoard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MCSoundBoard.m; path = Classes/MCSoundBoard.m; sourceTree = ""; }; 51 | /* End PBXFileReference section */ 52 | 53 | /* Begin PBXFrameworksBuildPhase section */ 54 | 86C3E40715B1D06200316991 /* Frameworks */ = { 55 | isa = PBXFrameworksBuildPhase; 56 | buildActionMask = 2147483647; 57 | files = ( 58 | 863B727515B2AEDE00C12159 /* AVFoundation.framework in Frameworks */, 59 | 863B726E15B2A35900C12159 /* AudioToolbox.framework in Frameworks */, 60 | 86C3E40F15B1D06200316991 /* UIKit.framework in Frameworks */, 61 | 86C3E41115B1D06200316991 /* Foundation.framework in Frameworks */, 62 | 86C3E41315B1D06200316991 /* CoreGraphics.framework in Frameworks */, 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXFrameworksBuildPhase section */ 67 | 68 | /* Begin PBXGroup section */ 69 | 863B727815B2BF7800C12159 /* Sounds */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 863B727D15B2C82E00C12159 /* ding.wav */, 73 | 863B727E15B2C82E00C12159 /* loop.mp3 */, 74 | 863B727F15B2C82E00C12159 /* play.mp3 */, 75 | ); 76 | name = Sounds; 77 | sourceTree = ""; 78 | }; 79 | 86C3E3FF15B1D06100316991 = { 80 | isa = PBXGroup; 81 | children = ( 82 | 863B728315B2D6E400C12159 /* LICENSE.md */, 83 | 863B727615B2BC6E00C12159 /* README.md */, 84 | 863B727815B2BF7800C12159 /* Sounds */, 85 | 86C3E42B15B1D0AF00316991 /* Classes */, 86 | 86C3E41415B1D06200316991 /* MCSoundBoard */, 87 | 86C3E40D15B1D06200316991 /* Frameworks */, 88 | 86C3E40B15B1D06200316991 /* Products */, 89 | ); 90 | sourceTree = ""; 91 | }; 92 | 86C3E40B15B1D06200316991 /* Products */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 86C3E40A15B1D06200316991 /* MCSoundBoard.app */, 96 | ); 97 | name = Products; 98 | sourceTree = ""; 99 | }; 100 | 86C3E40D15B1D06200316991 /* Frameworks */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 863B727415B2AEDE00C12159 /* AVFoundation.framework */, 104 | 863B726D15B2A35900C12159 /* AudioToolbox.framework */, 105 | 86C3E40E15B1D06200316991 /* UIKit.framework */, 106 | 86C3E41015B1D06200316991 /* Foundation.framework */, 107 | 86C3E41215B1D06200316991 /* CoreGraphics.framework */, 108 | ); 109 | name = Frameworks; 110 | sourceTree = ""; 111 | }; 112 | 86C3E41415B1D06200316991 /* MCSoundBoard */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 86C3E41D15B1D06200316991 /* AppDelegate.h */, 116 | 86C3E41E15B1D06200316991 /* AppDelegate.m */, 117 | 86C3E42015B1D06200316991 /* ViewController.h */, 118 | 86C3E42115B1D06200316991 /* ViewController.m */, 119 | 86C3E42315B1D06200316991 /* ViewController.xib */, 120 | 86C3E41515B1D06200316991 /* Supporting Files */, 121 | ); 122 | path = MCSoundBoard; 123 | sourceTree = ""; 124 | }; 125 | 86C3E41515B1D06200316991 /* Supporting Files */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 86C3E41615B1D06200316991 /* MCSoundBoard-Info.plist */, 129 | 86C3E41715B1D06200316991 /* InfoPlist.strings */, 130 | 86C3E41A15B1D06200316991 /* main.m */, 131 | 86C3E41C15B1D06200316991 /* MCSoundBoard-Prefix.pch */, 132 | ); 133 | name = "Supporting Files"; 134 | sourceTree = ""; 135 | }; 136 | 86C3E42B15B1D0AF00316991 /* Classes */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 86C3E42C15B1D0D300316991 /* MCSoundBoard.h */, 140 | 86C3E42D15B1D0D300316991 /* MCSoundBoard.m */, 141 | ); 142 | name = Classes; 143 | sourceTree = ""; 144 | }; 145 | /* End PBXGroup section */ 146 | 147 | /* Begin PBXNativeTarget section */ 148 | 86C3E40915B1D06200316991 /* MCSoundBoard */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = 86C3E42815B1D06200316991 /* Build configuration list for PBXNativeTarget "MCSoundBoard" */; 151 | buildPhases = ( 152 | 86C3E40615B1D06200316991 /* Sources */, 153 | 86C3E40715B1D06200316991 /* Frameworks */, 154 | 86C3E40815B1D06200316991 /* Resources */, 155 | ); 156 | buildRules = ( 157 | ); 158 | dependencies = ( 159 | ); 160 | name = MCSoundBoard; 161 | productName = MCSoundBoard; 162 | productReference = 86C3E40A15B1D06200316991 /* MCSoundBoard.app */; 163 | productType = "com.apple.product-type.application"; 164 | }; 165 | /* End PBXNativeTarget section */ 166 | 167 | /* Begin PBXProject section */ 168 | 86C3E40115B1D06100316991 /* Project object */ = { 169 | isa = PBXProject; 170 | attributes = { 171 | LastUpgradeCheck = 0430; 172 | ORGANIZATIONNAME = MobileCreators; 173 | }; 174 | buildConfigurationList = 86C3E40415B1D06100316991 /* Build configuration list for PBXProject "MCSoundBoard" */; 175 | compatibilityVersion = "Xcode 3.2"; 176 | developmentRegion = English; 177 | hasScannedForEncodings = 0; 178 | knownRegions = ( 179 | en, 180 | ); 181 | mainGroup = 86C3E3FF15B1D06100316991; 182 | productRefGroup = 86C3E40B15B1D06200316991 /* Products */; 183 | projectDirPath = ""; 184 | projectRoot = ""; 185 | targets = ( 186 | 86C3E40915B1D06200316991 /* MCSoundBoard */, 187 | ); 188 | }; 189 | /* End PBXProject section */ 190 | 191 | /* Begin PBXResourcesBuildPhase section */ 192 | 86C3E40815B1D06200316991 /* Resources */ = { 193 | isa = PBXResourcesBuildPhase; 194 | buildActionMask = 2147483647; 195 | files = ( 196 | 86C3E41915B1D06200316991 /* InfoPlist.strings in Resources */, 197 | 86C3E42515B1D06200316991 /* ViewController.xib in Resources */, 198 | 863B727715B2BC6E00C12159 /* README.md in Resources */, 199 | 863B728015B2C82E00C12159 /* ding.wav in Resources */, 200 | 863B728115B2C82E00C12159 /* loop.mp3 in Resources */, 201 | 863B728215B2C82E00C12159 /* play.mp3 in Resources */, 202 | 863B728415B2D6E400C12159 /* LICENSE.md in Resources */, 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | }; 206 | /* End PBXResourcesBuildPhase section */ 207 | 208 | /* Begin PBXSourcesBuildPhase section */ 209 | 86C3E40615B1D06200316991 /* Sources */ = { 210 | isa = PBXSourcesBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | 86C3E41B15B1D06200316991 /* main.m in Sources */, 214 | 86C3E41F15B1D06200316991 /* AppDelegate.m in Sources */, 215 | 86C3E42215B1D06200316991 /* ViewController.m in Sources */, 216 | 86C3E42E15B1D0D300316991 /* MCSoundBoard.m in Sources */, 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | /* End PBXSourcesBuildPhase section */ 221 | 222 | /* Begin PBXVariantGroup section */ 223 | 86C3E41715B1D06200316991 /* InfoPlist.strings */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 86C3E41815B1D06200316991 /* en */, 227 | ); 228 | name = InfoPlist.strings; 229 | sourceTree = ""; 230 | }; 231 | 86C3E42315B1D06200316991 /* ViewController.xib */ = { 232 | isa = PBXVariantGroup; 233 | children = ( 234 | 86C3E42415B1D06200316991 /* en */, 235 | ); 236 | name = ViewController.xib; 237 | sourceTree = ""; 238 | }; 239 | /* End PBXVariantGroup section */ 240 | 241 | /* Begin XCBuildConfiguration section */ 242 | 86C3E42615B1D06200316991 /* Debug */ = { 243 | isa = XCBuildConfiguration; 244 | buildSettings = { 245 | ALWAYS_SEARCH_USER_PATHS = NO; 246 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 247 | CLANG_ENABLE_OBJC_ARC = YES; 248 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 249 | COPY_PHASE_STRIP = NO; 250 | GCC_C_LANGUAGE_STANDARD = gnu99; 251 | GCC_DYNAMIC_NO_PIC = NO; 252 | GCC_OPTIMIZATION_LEVEL = 0; 253 | GCC_PREPROCESSOR_DEFINITIONS = ( 254 | "DEBUG=1", 255 | "$(inherited)", 256 | ); 257 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 258 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 259 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 260 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 261 | GCC_WARN_UNUSED_VARIABLE = YES; 262 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 263 | SDKROOT = iphoneos; 264 | }; 265 | name = Debug; 266 | }; 267 | 86C3E42715B1D06200316991 /* Release */ = { 268 | isa = XCBuildConfiguration; 269 | buildSettings = { 270 | ALWAYS_SEARCH_USER_PATHS = NO; 271 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 272 | CLANG_ENABLE_OBJC_ARC = YES; 273 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 274 | COPY_PHASE_STRIP = YES; 275 | GCC_C_LANGUAGE_STANDARD = gnu99; 276 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 277 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 278 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 279 | GCC_WARN_UNUSED_VARIABLE = YES; 280 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 281 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 282 | SDKROOT = iphoneos; 283 | VALIDATE_PRODUCT = YES; 284 | }; 285 | name = Release; 286 | }; 287 | 86C3E42915B1D06200316991 /* Debug */ = { 288 | isa = XCBuildConfiguration; 289 | buildSettings = { 290 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 291 | GCC_PREFIX_HEADER = "MCSoundBoard/MCSoundBoard-Prefix.pch"; 292 | INFOPLIST_FILE = "MCSoundBoard/MCSoundBoard-Info.plist"; 293 | PRODUCT_NAME = "$(TARGET_NAME)"; 294 | WRAPPER_EXTENSION = app; 295 | }; 296 | name = Debug; 297 | }; 298 | 86C3E42A15B1D06200316991 /* Release */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 302 | GCC_PREFIX_HEADER = "MCSoundBoard/MCSoundBoard-Prefix.pch"; 303 | INFOPLIST_FILE = "MCSoundBoard/MCSoundBoard-Info.plist"; 304 | PRODUCT_NAME = "$(TARGET_NAME)"; 305 | WRAPPER_EXTENSION = app; 306 | }; 307 | name = Release; 308 | }; 309 | /* End XCBuildConfiguration section */ 310 | 311 | /* Begin XCConfigurationList section */ 312 | 86C3E40415B1D06100316991 /* Build configuration list for PBXProject "MCSoundBoard" */ = { 313 | isa = XCConfigurationList; 314 | buildConfigurations = ( 315 | 86C3E42615B1D06200316991 /* Debug */, 316 | 86C3E42715B1D06200316991 /* Release */, 317 | ); 318 | defaultConfigurationIsVisible = 0; 319 | defaultConfigurationName = Release; 320 | }; 321 | 86C3E42815B1D06200316991 /* Build configuration list for PBXNativeTarget "MCSoundBoard" */ = { 322 | isa = XCConfigurationList; 323 | buildConfigurations = ( 324 | 86C3E42915B1D06200316991 /* Debug */, 325 | 86C3E42A15B1D06200316991 /* Release */, 326 | ); 327 | defaultConfigurationIsVisible = 0; 328 | defaultConfigurationName = Release; 329 | }; 330 | /* End XCConfigurationList section */ 331 | }; 332 | rootObject = 86C3E40115B1D06100316991 /* Project object */; 333 | } 334 | -------------------------------------------------------------------------------- /MCSoundBoard/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // MCSoundBoard 4 | // 5 | // Created by Baglan Dosmagambetov on 7/14/12. 6 | // Copyright (c) 2012 MobileCreators. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class ViewController; 12 | 13 | @interface AppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) ViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /MCSoundBoard/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // MCSoundBoard 4 | // 5 | // Created by Baglan Dosmagambetov on 7/14/12. 6 | // Copyright (c) 2012 MobileCreators. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "ViewController.h" 12 | 13 | @implementation AppDelegate 14 | 15 | @synthesize window = _window; 16 | @synthesize viewController = _viewController; 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 19 | { 20 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 21 | // Override point for customization after application launch. 22 | self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; 23 | self.window.rootViewController = self.viewController; 24 | [self.window makeKeyAndVisible]; 25 | return YES; 26 | } 27 | 28 | - (void)applicationWillResignActive:(UIApplication *)application 29 | { 30 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 31 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 32 | } 33 | 34 | - (void)applicationDidEnterBackground:(UIApplication *)application 35 | { 36 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 37 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 38 | } 39 | 40 | - (void)applicationWillEnterForeground:(UIApplication *)application 41 | { 42 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 43 | } 44 | 45 | - (void)applicationDidBecomeActive:(UIApplication *)application 46 | { 47 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 48 | } 49 | 50 | - (void)applicationWillTerminate:(UIApplication *)application 51 | { 52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /MCSoundBoard/MCSoundBoard-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.mobicreators.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /MCSoundBoard/MCSoundBoard-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'MCSoundBoard' target in the 'MCSoundBoard' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /MCSoundBoard/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // MCSoundBoard 4 | // 5 | // Created by Baglan Dosmagambetov on 7/14/12. 6 | // Copyright (c) 2012 MobileCreators. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | - (IBAction)playSound:(id)sender; 14 | - (IBAction)playAudio:(id)sender; 15 | - (IBAction)loopAudio:(id)sender; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /MCSoundBoard/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // MCSoundBoard 4 | // 5 | // Created by Baglan Dosmagambetov on 7/14/12. 6 | // Copyright (c) 2012 MobileCreators. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "MCSoundBoard.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad 19 | { 20 | [super viewDidLoad]; 21 | 22 | [MCSoundBoard addSoundAtPath:[[NSBundle mainBundle] pathForResource:@"ding.wav" ofType:nil] forKey:@"ding"]; 23 | 24 | [MCSoundBoard addAudioAtPath:[[NSBundle mainBundle] pathForResource:@"play.mp3" ofType:nil] forKey:@"play"]; 25 | 26 | [MCSoundBoard addAudioAtPath:[[NSBundle mainBundle] pathForResource:@"loop.mp3" ofType:nil] forKey:@"loop"]; 27 | AVAudioPlayer *player = [MCSoundBoard audioPlayerForKey:@"loop"]; 28 | player.numberOfLoops = -1; // Endless 29 | [MCSoundBoard playAudioForKey:@"loop" fadeInInterval:2.0]; 30 | } 31 | 32 | - (void)viewDidUnload 33 | { 34 | [super viewDidUnload]; 35 | // Release any retained subviews of the main view. 36 | } 37 | 38 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 39 | { 40 | return (interfaceOrientation == UIInterfaceOrientationPortrait); 41 | } 42 | 43 | - (IBAction)playSound:(id)sender 44 | { 45 | [MCSoundBoard playSoundForKey:@"ding"]; 46 | } 47 | 48 | - (IBAction)playAudio:(id)sender 49 | { 50 | [MCSoundBoard playAudioForKey:@"play"]; 51 | } 52 | 53 | - (IBAction)loopAudio:(id)sender 54 | { 55 | AVAudioPlayer *player = [MCSoundBoard audioPlayerForKey:@"loop"]; 56 | if (player.playing) { 57 | [MCSoundBoard pauseAudioForKey:@"loop" fadeOutInterval:2.0]; 58 | } else { 59 | [MCSoundBoard playAudioForKey:@"loop" fadeInInterval:2.0]; 60 | } 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /MCSoundBoard/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /MCSoundBoard/en.lproj/ViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1296 5 | 11E53 6 | 2182 7 | 1138.47 8 | 569.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1181 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | IBUIButton 17 | 18 | 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | PluginDependencyRecalculationVersion 23 | 24 | 25 | 26 | 27 | IBFilesOwner 28 | IBCocoaTouchFramework 29 | 30 | 31 | IBFirstResponder 32 | IBCocoaTouchFramework 33 | 34 | 35 | 36 | 274 37 | 38 | 39 | 40 | 292 41 | {{108, 72}, {105, 37}} 42 | 43 | 44 | 45 | _NS:9 46 | NO 47 | IBCocoaTouchFramework 48 | 0 49 | 0 50 | 1 51 | Play sound 52 | 53 | 3 54 | MQA 55 | 56 | 57 | 1 58 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 59 | 60 | 61 | 3 62 | MC41AA 63 | 64 | 65 | 2 66 | 15 67 | 68 | 69 | Helvetica-Bold 70 | 15 71 | 16 72 | 73 | 74 | 75 | 76 | 292 77 | {{108, 185}, {105, 37}} 78 | 79 | 80 | 81 | _NS:9 82 | NO 83 | IBCocoaTouchFramework 84 | 0 85 | 0 86 | 1 87 | Stop audio 88 | Play audio 89 | 90 | 91 | 1 92 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 292 101 | {{108, 235}, {105, 37}} 102 | 103 | 104 | _NS:9 105 | NO 106 | IBCocoaTouchFramework 107 | 0 108 | 0 109 | 1 110 | Stop audio 111 | Loop audio 112 | 113 | 114 | 1 115 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 116 | 117 | 118 | 119 | 120 | 121 | 122 | {{0, 20}, {320, 460}} 123 | 124 | 125 | 126 | 127 | 3 128 | MC43NQA 129 | 130 | 2 131 | 132 | 133 | NO 134 | 135 | IBCocoaTouchFramework 136 | 137 | 138 | 139 | 140 | 141 | 142 | view 143 | 144 | 145 | 146 | 7 147 | 148 | 149 | 150 | playSound: 151 | 152 | 153 | 7 154 | 155 | 16 156 | 157 | 158 | 159 | playAudio: 160 | 161 | 162 | 7 163 | 164 | 22 165 | 166 | 167 | 168 | loopAudio: 169 | 170 | 171 | 7 172 | 173 | 21 174 | 175 | 176 | 177 | 178 | 179 | 0 180 | 181 | 182 | 183 | 184 | 185 | -1 186 | 187 | 188 | File's Owner 189 | 190 | 191 | -2 192 | 193 | 194 | 195 | 196 | 6 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 9 207 | 208 | 209 | 210 | 211 | 10 212 | 213 | 214 | 215 | 216 | 8 217 | 218 | 219 | 220 | 221 | 222 | 223 | ViewController 224 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 225 | UIResponder 226 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 227 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 228 | 229 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 230 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 231 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 232 | 233 | 234 | 235 | 236 | 237 | 238 | 22 239 | 240 | 241 | 242 | 243 | ViewController 244 | UIViewController 245 | 246 | id 247 | id 248 | id 249 | 250 | 251 | 252 | loopAudio: 253 | id 254 | 255 | 256 | playAudio: 257 | id 258 | 259 | 260 | playSound: 261 | id 262 | 263 | 264 | 265 | IBProjectSource 266 | ./Classes/ViewController.h 267 | 268 | 269 | 270 | 271 | 0 272 | IBCocoaTouchFramework 273 | 274 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 275 | 276 | 277 | YES 278 | 3 279 | 1181 280 | 281 | 282 | -------------------------------------------------------------------------------- /MCSoundBoard/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // MCSoundBoard 4 | // 5 | // Created by Baglan Dosmagambetov on 7/14/12. 6 | // Copyright (c) 2012 MobileCreators. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MCSoundBoard 2 | 3 | ## Goal of the project 4 | 5 | Create a singleton class to make playing audio extremely within an iOS app simpler. 6 | 7 | ## License 8 | 9 | This code is available under the MIT license. 10 | 11 | ## Installation 12 | 13 | 1. Drag files from the Classes folder to your project; 14 | 2. Add AudioToolbox and AVFoundation frameworks; 15 | 3. \#import "MCSoundBoard.h" wherever you want to use it. 16 | 17 | ## Usage 18 | 19 | Here's how you initialize and play a "short sound" (30s or shorter .caf, .air or .wav snippets): 20 | 21 | ``` 22 | [MCSoundBoard addSoundAtPath:[[NSBundle mainBundle] pathForResource:@"ding.wav" ofType:nil] forKey:@"ding"]; 23 | 24 | [MCSoundBoard playSoundForKey:@"ding"]; 25 | ``` 26 | 27 | For longer AAC, MP3 and ALAC (Apple Lossless) audio, use: 28 | 29 | ``` 30 | [MCSoundBoard addAudioAtPath:[[NSBundle mainBundle] pathForResource:@"play.mp3" ofType:nil] forKey:@"play"]; 31 | 32 | [MCSoundBoard playAudioForKey:@"play"]; 33 | ``` 34 | 35 | For a nice fede in effect, you can use 36 | 37 | ``` 38 | [MCSoundBoard playAudioForKey:@"play" fadeInInterval:2.0]; 39 | ``` 40 | Similar metods are available for stopping and pausing the audio: 41 | 42 | ``` 43 | + (void)stopAudioForKey:(id)key fadeOutInterval:(NSTimeInterval)fadeOutInterval; 44 | + (void)stopAudioForKey:(id)key; 45 | 46 | + (void)pauseAudioForKey:(id)key fadeOutInterval:(NSTimeInterval)fadeOutInterval; 47 | + (void)pauseAudioForKey:(id)key; 48 | ``` 49 | 50 | For longer audio, this class uses [AVAudioPlayer](http://developer.apple.com/library/ios/#DOCUMENTATION/AVFoundation/Reference/AVAudioPlayerClassReference/Reference/Reference.html) and, if you need to set volume, number of loops and so on, you can get access to the underlying player by calling: 51 | 52 | ``` 53 | AVAudioPlayer *player = [MCSoundBoard audioPlayerForKey:@"play"]; 54 | player.numberOfLoops = -1; // Endless looping 55 | ``` 56 | 57 | Alternatively, if number of loops is all you want to change there is a convenience method for that: 58 | 59 | 60 | ``` 61 | [MCSoundBoard loopAudioForKey:@"play" numberOfLoops:-1]; 62 | ``` -------------------------------------------------------------------------------- /Sounds/ding.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baglan/MCSoundBoard/ad0718868e98315ef4a8d4cb120ef0b093b3646d/Sounds/ding.wav -------------------------------------------------------------------------------- /Sounds/loop.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baglan/MCSoundBoard/ad0718868e98315ef4a8d4cb120ef0b093b3646d/Sounds/loop.mp3 -------------------------------------------------------------------------------- /Sounds/play.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baglan/MCSoundBoard/ad0718868e98315ef4a8d4cb120ef0b093b3646d/Sounds/play.mp3 --------------------------------------------------------------------------------