FROM : Cocoa
DATE : Sat Mar 15 14:56:30 2008
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];
}
}
DATE : Sat Mar 15 14:56:30 2008
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 mail archive

