quattro_4 scribble

scribble 落書き (調べた事をただ落書きする)

NSScreencast Episode #114 Playing Sounds with Sprite Kit

Playing Sounds with Sprite Kit - NSScreencast

音声を再生する

  • audio files
  • wav to convert smaller
    • × mp3
      • iphone cannot decode simultaneously
    • ima4
      • afconvert -f caff -d ima4 in.wav -o out.caf
      • hardware accelerated
  • create group and actual folder
    • Resources
      • /Music
      • /Sound Effects
  • GTViewController
    • @import AVFoundation;
    • @property (nonatomic, strong) AVAudioPlayer *audioPlayer;
    • viewDidLoad
      • startBackgroundMusic
    • startBackgroundMusic
      • musicURL = [[NSBundle mainBundle] URLForResource:@"background-music-loop" withExtension:@"caf"];
      • self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:musicURL error:&error];
      • if (self.audioPlayer) {
        • numberOfLoops
        • volume
        • [self.audioPlayer prepareToPlay]
        • [self.audioPlayer play]
  • GTMyScene
    • initWithSize
      • [self preloadSounds];
    • preloadSounds
      • self.giggleSounds = @[
      • [SKAction playSoundFileNamed:@"laugh1.caf" waitForCompletion:YES],
  • pod 'SAMRateLimit'
    • __block SKAction *playSound = [[SKAction alloc] init];
    • [SAMRateLimit executeBlock:^{
      • playSound = self.giggleSounds[arc4random_uniform((uint32_t)self.giggleSounds.count)];
  • hide status bar
    • × [application statusBarHidden:TRUE]
    • (BOOL)prefersStatusBarHidden { return YES;
    • every single view controller