Play a QTMovie twice at the same time

Discussion in 'Mac Programming' started by fernandovalente, Feb 2, 2010.

  1. fernandovalente macrumors 6502

    fernandovalente

    Joined:
    Aug 29, 2008
    Location:
    Third world **** hole, I mean, Brazil
    #1
    Hi, I'm developing an app that has a button. When the user press this button, a sound is played. I would like to be able to play the sound twice in case of the user press the button again before the sound ends playing. Anyway to do that using a QTMovie?
     
  2. HiRez macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #2
    It sounds like you just want to disable the button while the sound is playing and then re-enable it when the sound is done? That would prevent a double tap, although maybe I'm misunderstanding what you want.
     
  3. fernandovalente thread starter macrumors 6502

    fernandovalente

    Joined:
    Aug 29, 2008
    Location:
    Third world **** hole, I mean, Brazil
    #3
    No, I don't want to disable the button. I really want to allow the user to press the button twice.
     
  4. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    Just make a second instance of the QTMovie and play it.
     
  5. HiRez macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #5
    In that case I suppose you could spawn a second movie in memory (no visual representation) and play it, although Core Audio would probably be more appropriate to something like this.
     
  6. fernandovalente thread starter macrumors 6502

    fernandovalente

    Joined:
    Aug 29, 2008
    Location:
    Third world **** hole, I mean, Brazil
    #6
    Tried this:
    Code:
    [[[QTMovie alloc] initWithFile:[[NSBundle mainBundle] pathForResource:@"1.mp3" ofType:nil] error:nil] play];
    The problem is that it doesn't release it from the memory when it finished playing.
     
  7. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #7
    So store a reference and release it when it's done playing - read the docs for what notification gets sent at that time.
     

Share This Page