This is PacManInfoController.m in view mode; [Download] [Up]
#import <soundkit/Sound.h>
#import "PacManInfoController.h"
@implementation PacManInfoController
// Pressing the invisible button in the info panel starts the PacMan music.
// When this happens, the game's sounds are temporarily turned off.
// We then turn them back on when the sound finishes playing. If a new
// game is started while we're playing, then we abort the sound so that
// the game's effects can come back.
- playSound:sender
{ // load sound if first time playing...
if (!sound) sound = [[[Sound alloc]
initFromSection:"InfoMusic.snd"] setDelegate:self];
[[[NXApp delegate] soundPlayer] turnOn:NO]; // temp. turn off sound player
[sound play];
return self;
}
- stopSound:sender
{ // will stop the sound (if playing)
[sound stop];
// be sure to turn sound player back on
[[[NXApp delegate] soundPlayer]
turnOn:[[[NXApp delegate] preferencesBrain] effects]];
return self;
}
- didPlay:sender
{ // turn sound player back on
[[[NXApp delegate] soundPlayer]
turnOn:[[[NXApp delegate] preferencesBrain] effects]];
return self;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.