Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9045463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:19:47+00:00 2026-06-16T11:19:47+00:00

My game plays a ticking clock sound every second. I would like the sound

  • 0

My game plays a ticking clock sound every second. I would like the sound to slowly speed up throughout the game. My initial thought was to use an NSTimer and update the speed when the method fires, like this:

static float soundDelay = 1.0;
timer = [NSTimer scheduledTimerWithTimeInterval:clickClackDelay
                                                     target:self
                                                   selector:@selector(playSound)
                                                   userInfo:nil
                                                    repeats:YES];

- (void)playSound {
    soundDelay -= 0.1;
    NSLog(@"Play sound");
}

This didn’t work, and it seems like NSTimer isn’t really meant to be used that way. Any other suggestions on how I could accomplish this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:19:48+00:00Added an answer on June 16, 2026 at 11:19 am

    You can implement it by calling the playSound method from itself.
    You can do it in the following way.

    - (void)playSound
    {
       static float soundDelay = 1.0;
       if([timer isValid])
       {
         [timer invalidate];
         timer = nil;
       }
       timer = [NSTimer scheduledTimerWithTimeInterval:clickClackDelay
                                                         target:self
                                                       selector:@selector(playSound)
                                                       userInfo:nil
                                                        repeats:NO];
        soundDelay -= 0.1;
        if(soundDelay <=0)   //when sound delay is zero invalidate timer
        {
           [timer invalidate];
           timer = nil;
        }
        NSLog(@"Play sound");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I launch my iPhone game as soon as a sound plays the background
I have some code like this in a controller: def index @plays = current_user.plays.includes(:game).order(created_at
I have a OpenGL game that plays in landscape mode, when the use rotates
My game is using Cocos2d-x. When a sound plays, the game crashes randomly on
I have an game app which occasionally plays sounds. When the phone goes into
There is an app call DurionLite (free on iPhone) which plays a word game
I'm using AVAudioPlayer to play sound effects in an iPhone game. This is part
I have a logical statement that says If everyone plays the game, we will
I'm making a game where the user plays against the computer. The computer opponent
I'm building a snake game that plays on the surface of a cube. Currently

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.