Cocoaはさっぱり!!! Version.3
■ このスレッドは過去ログ倉庫に格納されています
0102名称未設定
03/11/05 01:22ID:RhqfG/Oh@implementation SoundTest
- (IBAction)soundPlay:(id)sender
{
isLoop = YES;
[NSThread detachNewThreadSelector:@selector(playLoop) toTarget:self withObject:nil];
}
- (IBAction)soundStop:(id)sender
{
isLoop = NO;
[aSound stop];
}
- (void)playLoop
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[aSound play];
[pool release];
}
- (void)applicationDidFinishLaunching: (NSNotification *)notification
{
aSound = [[NSSound soundNamed:@"sound.aiff"] retain];
[aSound setDelegate:self];
}
- (void)sound:(NSSound *)sound didFinishPlaying:(BOOL)aBool
{
if(isLoop) [NSThread detachNewThreadSelector:@selector(playLoop) toTarget:self withObject:nil];
}
@end
■ このスレッドは過去ログ倉庫に格納されています