Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 12 of 12

Thread: Button Question

  1. #1
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Grin Button Question

    I am messing around with the Audio Capture .apz that was on here. I am not sure who's it is (Thank you tho) but I wanted to add a function to the stop capture button. I want to be able to hit the space bar and stop the capture as well as the stop button.



    Any help would be much appreciated..

    Thanks,
    Joe

  2. #2
    Join Date
    Apr 2009
    Posts
    277
    without seeing some code or the original apz its impossible to help

  3. #3
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Smile Here ya go..

    This is the origiinal app, and I added a Hi quality record button.. I want to hit the space bar to have it stop recording /and or playing.

    Also is there a way to show a time like: (00:00:00) For the playback or record??

    Thank you so much for a reply!!!
    Attached Files

  4. #4
    Join Date
    Apr 2009
    Posts
    277
    1. use a timer and System.IsKeyDown to check if the spacebar is pressed

    Code:
    if System.IsKeyDown(VK.Spacebar)  then
    	AudioCapture.PlayStop();
            AudioCapture.CaptureStop();
    end
    2, use this function

    Code:
    -- this function will Convert  Milliseconds into standard time format ie HH:MM:SS
    function MilliSecondsToClock(sMilliSeconds)
    	local nMilliSeconds = String.ToNumber(sMilliSeconds)
    	if nMilliSeconds == 0 then
    		--return nil;
    		return "00:00:00";
    	else
    		nHours = string.format("%02.f", Math.Floor(nMilliSeconds/3600000));
    		nMins = string.format("%02.f", Math.Floor(nMilliSeconds/60000 - (nHours*60000)));
    		nSecs = string.format("%02.f", Math.Floor(nMilliSeconds/1000 - nHours*3600000 - nMins *60000));
    		nMilliSecs = Math.Round(nMilliSeconds - (nHours*3600000) - (nMins *60000) - (nSecs *1000))
    		return nHours..":"..nMins..":"..nSecs
    	end
    end
    and replace the code in the timer
    Code:
    Input.SetText("InputLength", MilliSecondsToClock(AudioCapture.GetLength()));
    Input.SetText("InputSize", AudioCapture.GetSize());
    Input.SetText("InputStatus", AudioCapture.GetStatus());

    that should get you going.
    Last edited by MicroByte; 06-17-2009 at 01:57 AM.

  5. #5
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Grin Wow

    Thank you MicroByte for a speedy response!! Only, I am lost, and confused. I am totally novice to code, BUT I do like to ask questions...

    Code:
     use a timer and System.IsKeyDown to check if the spacebar is pressed
    Where do I find System.IsKeyDown? Timer in the plugins? And number 2???? Lol. I am blown away... Sorry for the questions.

    Is it possible to post me a .apz?

  6. #6
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Grin Anyone??

    Can anyone help me out.. Please?????
    Attached Files
    Last edited by JDog37; 06-18-2009 at 05:21 PM.

  7. #7
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Grin ???

    Com on fellas, can anyone give me a hand? I'll make a few buttons...
    Seriously tho, any help is much appreciated!

    Joe

  8. #8
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Peekaboo! Ok...

    Ok, I found out how to set the timer... after 2 days.. But I can not figure out where to put this code?:

    Code:
    if System.IsKeyDown(VK.Spacebar)  then
    	AudioCapture.PlayStop();
            AudioCapture.CaptureStop();
    end
    I tried in globals but no luck...
    I also tried putting this code on the page show:

    Code:
    -- this function will Convert  Milliseconds into standard time format ie HH:MM:SS
    function MilliSecondsToClock(sMilliSeconds)
    	local nMilliSeconds = String.ToNumber(sMilliSeconds)
    	if nMilliSeconds == 0 then
    		--return nil;
    		return "00:00:00";
    	else
    		nHours = string.format("%02.f", Math.Floor(nMilliSeconds/3600000));
    		nMins = string.format("%02.f", Math.Floor(nMilliSeconds/60000 - (nHours*60000)));
    		nSecs = string.format("%02.f", Math.Floor(nMilliSeconds/1000 - nHours*3600000 - nMins *60000));
    		nMilliSecs = Math.Round(nMilliSeconds - (nHours*3600000) - (nMins *60000) - (nSecs *1000))
    		return nHours..":"..nMins..":"..nSecs
    	end
    end
    But No luck..

  9. #9
    Join Date
    Aug 2003
    Posts
    2,427
    OK I'm probably going to show my ignorance here but VK.Spacebar doesn't mean anything to me or apparently to AMS either however the code -

    Code:
    if System.IsKeyDown(32) then
    does detect the spacebar state.

    p.s. the code will monitor whether a key is up or down so a page timer might be a good place for it although I don't know how that would fit in with everything else.
    Last edited by longedge; 06-21-2009 at 03:09 AM.

  10. #10
    Join Date
    Aug 2003
    Posts
    2,427
    Found the answer to VK.Spacebar which is fully explained in Desmond's post in this thread.

    Defining the VK table explicitly on my laptop makes it work so the lua file is obviously missing. Must have a look...

  11. #11
    Join Date
    Aug 2003
    Posts
    2,427
    Putting the following in pre-load ( the table defines the table entry "Spacebar" as = to 32)

    Code:
    VK = {
    	Spacebar = 32,
    };
    and then the following into the page timer

    Code:
    if System.IsKeyDown(VK.Spacebar)  then
    	AudioCapture.PlayStop();
            AudioCapture.CaptureStop();
    end
    works for me.
    Last edited by longedge; 06-21-2009 at 04:29 AM.

  12. #12
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Talking Cool..

    Thank you longedge, I am going to try it!! Thank you all as well!!

    Joe

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts