• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
usleep()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: usleep()
      • From: Michael Watson <email@hidden>
  • Prev by Date: Re: ScriptingBridgeConcepts problem
  • Next by Date: Re: usleep()
  • Previous by thread: Re: Sorting arrays with strings
  • Next by thread: Re: usleep()
  • Index(es):
    • Date
    • Thread