usleep()
usleep()
- Subject: usleep()
- From: Cocoa <email@hidden>
- Date: Sun, 16 Mar 2008 02:56:30 +1300
these code is from ScriptBridgeConcept.pdf. Does anyone know what the
red code below mean, specifically rampVolume += orignalVolume/16) i
search usleep() in Xcode documentation, it explain that suspend thread
execution for an interval measured in microseconds. Does it just mean
it will stop the the code for how many microseconds?
- (IBAction)play:(id)sender {
iTunesApplication *iTunes = [SBApplication
applicationWithBundleIdentifier:@"com.apple.iTunes"];
if ( [iTunes isRunning] ) {
int rampVolume, originalVolume;
originalVolume = [iTunes soundVolume];
[iTunes setSoundVolume:0];
[iTunes playOnce:NO];
for (rampVolume = 0; rampVolume < originalVolume; rampVolume +=
originalVolume / 16) {
[iTunes setSoundVolume: rampVolume];
/* pause 1/10th of a second (100,000 microseconds) between
adjustments. */
usleep(100000);
}
[iTunes setSoundVolume:originalVolume];
}
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden