ios - Two NSTimers with one governing the activity of the other? -
i've been looking @ thread re: voice detection (http://mobileorchard.com/tutorial-detecting-when-a-user-blows-into-the-mic/).
i'm looking implement similar, however, following variation.
the leveltimer
in example fires continuously every .03 seconds. need wrap timer around voice check process runs (say) 10 seconds.
i'm finding having like:
outertimer = [nstimer scheduledtimerwithtimeinterval:10.0 target:self selector:@selector(outertimerfinished:) userinfo:nil repeats:no]; leveltimer = [nstimer scheduledtimerwithtimeinterval:0.03 target:self selector:@selector(listenforsounds:) userinfo:nil repeats:yes];
…where outertimerfinished
method calls [leveltimer invalidate]
isn't working - maybe due thread blocking?
so can me determine way leveltimer work, specific amount of time?
thanks.
put counter in listenforsounds: method, , increment each time method called. if want run leveltimer 10 seconds say, check when counter > 333 , invalidate timer.
Comments
Post a Comment