NSMovieView uses 3-8% CPU after playing a sound?
NSMovieView uses 3-8% CPU after playing a sound?
- Subject: NSMovieView uses 3-8% CPU after playing a sound?
- From: Adam Iser <email@hidden>
- Date: Mon, 17 Sep 2001 18:08:28 -0400
Hiya,
For sound in my app I use a shared 'NSMovieView', simply setting the
movie to the sound I want played and calling 'start:'. But with my
current code I've noticed that after I play a sound, my application uses
3-8% of the CPU (where before I played the sound it would consume almost
0%).
What am I doing wrong to cause this?
Here is the code I use:
NSMovieView *sharedMovieView;
- (void)awakeFromNib
{
sharedMovieView = [[NSMovieView alloc] init];
}
- (void)playSound:(NSString *)soundName
{
NSMovie *theMovie;
NSURL *soundPath;
float soundVolume;
soundPath = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:soundName ofType:@"snd"]]
theMovie = [[[NSMovie alloc] initWithURL:soundPath
byReference:YES] autorelease];
soundVolume = [[AISettings sharedInstance] sound_appVolume] /
100.0;
[sharedMovieView setMovie:theMovie];
[sharedMovieView start:nil];
[sharedMovieView setVolume:soundVolume ];
}
Many thanks for help,
-Adam Iser