Announcement

Collapse
No announcement yet.

Volume control dial

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Volume control dial

    Is it possible to change the slide object image to a dial or has anyone a sample of a volume dial.

    Thanks

  • #2
    You could look into this example done by LucasTheDuck a while back.
    It uses a dial for volume control:



    You'll need both the AudioControl Object Plugin and the AMSWMemory Action Plugin (attached).
    Attached Files

    Comment


    • #3
      BioHazard,

      I try to use AudioControls, on DrawRuntime tab (and try every Tabs) if i put to GetPosition:

      Code:
      nV = AudioControl.KCGetPosition("Plugin2");
      Label.SetText("Label5", nV);
      it gives me error, like compare to nil and a function line.

      I think that should get position of Control and refresh variable


      I try that with Slider (posChange tab) and i can Up and Down Volume, works perfectly

      Comment


      • #4
        Hmm, yes. This is the error you're getting, right?



        It appears to be an error with the plugin code itself, limited specifically to the KCGetPosition() function. As you know, the function's purpose is to return a number value (position) set initially via the 2nd argument (parameter) of the AudioControl.KCCreate() function (and subsequently via KCSetPosition() arguments.

        As it requires the AMSWMemory plugin and also has an OCX dependency which requires a System.RegisterActiveX() command prior to execution, my first suspicion was that you may have been omitting one of these crucial dependencies. However that's not the case.

        KCGetPosition() is revealed in the 2nd indice of the AudioControl's array of 21 functions (identified via):
        Code:
        i = 0;
        for k in pairs (AudioControl) do
            i = i + 1;
            Dialog.Message(i, k);
        end
        ... but it appears that the control's assigned value has nothing to reference (hence the 'compare number to nil' error) . Unless I'm overlooking something, (as indicated by Stack Traceback) some kind of omission (possibly a typo) is occurring at Line:148 of the .APO source. Or possibly a 'return' command has been accidentally omitted from the KCGetPosition() function source (it's the only one in the KC group which is actually supposed to return a value - so seems logical that's where an oversight might be). But without the source-code to the plugin, a definitive cause is unknowable.

        You'd have to contact the author for more info on this. The plugin was written by LucasTheDuck who's not been active here since 2013. If u wish to get in contact with him, I believe he still maintains a presence over at http://*************.com under the moniker of Pabloko. Or you could try emailing him direct via: [email protected] (no idea if that address is even current).

        Failing that, it seems you're shite out of luck on this one. You might actually find the whole drama somewhat easier by just creating you're own volume-dial with a set of overlayed transparent images. For which it'd be possible to exercise a considerable degree of code control using Riz's AudioEx plugin (attached below if you're interested). Not a small job by any means - but certainly do-able if u have the time.
        Attached Files

        Comment


        • #5
          First of all, i hope you have had a merry xmas and i wish you a Happy New Year

          After that, yeah, it's that Error i get. i'm sorry not being more specific.

          Thanks for the contacts from Creator of Plugin, one more site to see and probably learn more


          About the Plugin, i get a little project from PurpleRose of making a Radio Station and play with my little knowledge. When he(?) ask for a Dial and you show that Plugin, i was play more, because it's really a good idea having a Dial, but well, having fun and discovered a missing piece of the Plugin

          Thanks for your help! You are the man!


          Comment


          • #6
            Update:
            Hey, you're in luck my friend - a little tenacity has paid off!

            Seems that the source-code to the AudioControl APO wasn't so well protected. And so was able to get inside and poke around to find the cause of that error. We'll just call this one a case of reverse-engineering for the 'greater good', shall we?

            This is our 'problem-child', here:



            At Line:148 of the source-code, the author has inadvertently miscoded part of the function. Line:148 should read:
            Code:
            if KnobCtrlPos[ObjectName] > -1 then

            Although we can't recompile the plugin so easily, we can write a 'corrective' function into our app to override this error. So, to correct it, you'd rewrite the function as:
            Code:
            function AudioControl.KCGetPosition(ObjectName)
                if AudioControlObject[ObjectName] > 0 then
                    if KnobCtrlPos[ObjectName] > -1 then
                        return KnobCtrlPos[ObjectName]
                    else
                        return nil
                    end
                end
            end
            ... and then place it anywhere after the AudioControl.KCCreate() command. (Page On Show is a good place for it). Then you just call the function as you normally would - from whichever event you'd like the value returned.

            So here's an example you can look over. (And a screencap from which you can see it's now successfully returning and dumping the value into the Label Object like you wanted):



            Don't ya' love it when a plan comes together!



            Attached Files

            Comment


            • #7
              Amazing!!! it's just Amazing!!!

              I emailed pablo because I was curious to know what he would answer.

              You just did reverse-engineering not to take advantage of but to understand why not worked.

              It's brilliant when we know and understand programming, we can do a lot amazing stuff. I would not be able to! I glad that you're here.

              Once again, BioHazard save the day!

              Cheers

              Comment


              • #8
                BioHazard

                I try to use you Fix but don't work as i think.

                Here is a example of what i try.. because on your example you use a button to GetPosition.. but not AudioControl himself..

                Cheers
                Attached Files

                Comment


                • #9
                  Yes, it would appear that the DrawRuntime event is the ONLY event in the plugin that's functional. The On Move event is the one which is required to return values via manipulation of the KnobControl itself. So, although it's possible to set the value for 'position' at DrawRuntime (and to also manipulate it via other objects like I showed you) it can NOT be manipulated using the plugin's other event tabs. Simply stated - the plugin is incomplete.

                  Examination of its source-code confirms this:



                  You can see at Line:122-123, there is evidence of intent to code these functions in, yet were never actually completed.

                  In light of a possible workaround, analysis of the AudioControls2.ocx (via DLL Export Viewer) reveals correct syntax of the Function Name required for calling the function directly via DLL.CallFunction():



                  ... And we also know the ReturnType would be of DLL_RETURN_TYPE_INTEGER and that the CallConvention would be a DLL_CALL_STDCALL. However there is insufficient information in The Duck's source-code for the correct Call Parameters. Numerous educated guesses turned up naught. So without access to the source-code for the AudioControls2.ocx itself, this information is also unknowable.

                  Given that the AudioControls2.ocx used in this plugin, is in fact a commercial control from Ahead Nero's Wave Editor, I can only speculate on just how LucasTheDuck was able to extract enough information to produce as much as he did for this plugin. I suspect kernel-mode debugging and disassembly was employed. I do know he's a pretty cluey coder with an intimate knowledge of assembly language - so no real surprise there.

                  My advice at this stage would be to move on and go at your project from a different angle. It's a shame too, because it's very easy to replace that outdated KnobControl graphic embedded in the OCX file with some really nice modern ones like these:

                  Nice, eh?




                  Comment


                  • #10
                    BioHazard, first of all, a big thank you for having looked at the bottom line.

                    It's really unfortunate that one of principal functions not be done or are incomplete.

                    I take a look on amspecialist and as you say, i think Pabloko have a intimidade knowledge.

                    We can use buttons to up an down volume and ledmeter to show.

                    A modern KnobControl graphic looks splendid, just by imagining use them...



                    Once again, Thanks for your help and dug from bowels of Plugin.

                    Comment


                    • #11
                      No problemo.

                      Hey listen, given that you're working with audio, you might find these here examples useful. I wrote them back in 2010 but have just recently updated/improved them a little bit.

                      Might not be of much use to you right now, but in future may be of some assistance - if seeking to enhance the GUI of whatever audio project you're working on.
                      Attached Files

                      Comment


                      • #12
                        Awesome work Bio, much appreciated

                        Comment


                        • #13
                          The more examples, the better! It was a nice job what you did here.

                          Thanks once, for your help

                          Comment


                          • #14
                            I am struggling with getting a simple two button (one for volume up and one for volume down) working

                            How do i go about getting the current volume first then decreasing or increasing saying 10% each click of the up or down button.

                            A small sample would be great to get my head around it then i can try an implement into a dial of some sort

                            Comment


                            • #15
                              Hello Happy New Year.. Why is it on my side?
                              Attached Files

                              Comment

                              Working...
                              X
                              😀
                              🥰
                              🤢
                              😎
                              😡
                              👍
                              👎