Skip to content

Instantly share code, notes, and snippets.

@C4Code
Created September 24, 2012 04:48
Show Gist options
  • Save C4Code/3774225 to your computer and use it in GitHub Desktop.
Save C4Code/3774225 to your computer and use it in GitHub Desktop.
Toggle Audio Playback
//
// C4WorkSpace.m
// gettingThingsOnScreen
//
// Created by moi on 12-09-23.
// Copyright (c) 2012 moi. All rights reserved.
//
#import "C4WorkSpace.h"
@implementation C4WorkSpace {
C4Sample *audioSample;
}
-(void)setup {
audioSample = [C4Sample sampleNamed:@"C4Loop.aif"];
}
-(void)touchesBegan {
if(audioSample.isPlaying) {
[audioSample stop];
} else {
[audioSample play];
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment