I thouhgt I had this solved. But the value is 1 and it looks like if K is pressed then it changes to 0 and then back to 1.
The value of start is defined as 0 at the first. There are if start=1 statements but none but this for changing the value of start

case OAPI_KEY_K: // start
       if (0 ==start) 
              start = 0;
      return 1;

>>There are if start=1 statements

Please post that exact code -- what you posted is an assignment statement, not a boolean logic statement. use == instead of = to test if start is or is not 1. C, C++ and C# require two equal symbols to test for equality, VB and a few other languages use only sigle = statement. If you are coming from VB I can understand your confusion.

I do have if 0==start then play the wav and then start=1
else start=0
So when K is pressed and start=0 then play the wav and set start to 1.
if K is pressed and start =1 nothing happens.
The only statements with start are if start =1 then play this wav
if start=0 no power.
The only time start should be 1 is if k is pressed.

But it is 1 when I press k is goes to 0 and then back to 1

It sort of sounds like the program is hitting that case statement twice. Put a print statement in each of those if statements to see how often it goes there -- or learn to use your debugger and put a break statement there. We can't really tell you much with such a small amount of code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.