Minim play snip on every mouse click

edited December 2013 in Questions about Code

Hi there, I'm trying to get a short popping noise to play on every 8 clicks of the mouse, at the moment it will only play once, what am I doing wrong?

code:

void mouseClicked()    { //----------THIS IS WHERE MY PARTICLES ARE SPAWNED IN ON MOUSE CLICK------------
       listW.add ( new Walker () );
       clicks += 1;
       if(clicks == 8)    {
            listD.add (new Diamond () );
            snip.play();
            clicks = 0;
            }

 }
Tagged:

Answers

  • For questions like these, you need to consult the API. Assuming you're talking about minim here (you haven't actually told us what type of Object snip is), the API is here: http://code.compartmental.net/minim/javadoc/

    Find the type of Object snip is, find the play() method, and read exactly what it does. Then consult the API for other useful functions that might help fix your problem.

  • Problem solved, thanks!

  • If you could share the solution would be nice, for the records : )

  • edited December 2013

    Sure, this is what my code looks like now.

    void mouseClicked()    { //----------THIS IS WHERE MY PARTICLES ARE SPAWNED IN ON MOUSE CLICK------------
           listW.add ( new Walker () );
           clicks += 1;
           snip2.play(0);
           if(clicks == 8)    {
             snip1.play(0);
                listD.add (new Diamond () );
                clicks = 0;
           }               
     }      
    
Sign In or Register to comment.