Forum

    • Register
    • Login
    • Search
    • Categories

    Can I pipe the Console output to std out

    C++ Development
    3
    12
    200
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • jonhallur
      jonhallur last edited by jonhallur

      When working with External floating tile in C++, can I somehow pipe the console output that is available to the javascript to std out so I can see it in my C++ Debug output next to my std::cout ?

      d.healey 1 Reply Last reply Reply Quote 0
      • d.healey
        d.healey @jonhallur last edited by

        @jonhallur There's a Console.breakInDebugger() command but I don't see anything to forward the output of .print()

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        jonhallur 2 Replies Last reply Reply Quote 0
        • jonhallur
          jonhallur @d.healey last edited by

          @d-healey Thats a great start

          1 Reply Last reply Reply Quote 0
          • jonhallur
            jonhallur @d.healey last edited by

            @d-healey said in Can I pipe the Console output to std out:

            @jonhallur There's a Console.breakInDebugger() command but I don't see anything to forward the output of .print()

            Unless I'm missing some compile option, running the ExternalFloatingTileTest in under Debug in VS2017 does not appear to to break.

            d.healey 1 Reply Last reply Reply Quote 0
            • d.healey
              d.healey @jonhallur last edited by

              @jonhallur I've never used it so perhaps it isn't designed for this use case.

              Libre Wave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              jonhallur 1 Reply Last reply Reply Quote 0
              • jonhallur
                jonhallur @d.healey last edited by

                @d-healey said in Can I pipe the Console output to std out:

                @jonhallur I've never used it so perhaps it isn't designed for this use case.

                It was a good idea

                Christoph Hart 1 Reply Last reply Reply Quote 0
                • Christoph Hart
                  Christoph Hart @jonhallur last edited by

                  @jonhallur If you're running in the debugger, the HiseScript console output gets also printed to the VS debugger using the DBG() macro from JUCE.

                  The Console.break() function just throws an assertion so you can inspect the C++ callstack.

                  jonhallur 1 Reply Last reply Reply Quote 1
                  • jonhallur
                    jonhallur @Christoph Hart last edited by

                    @christoph-hart said in Can I pipe the Console output to std out:

                    @jonhallur If you're running in the debugger, the HiseScript console output gets also printed to the VS debugger using the DBG() macro from JUCE.

                    The Console.break() function just throws an assertion so you can inspect the C++ callstack.

                    I of course meant the DBG output, not std out, which works fine for my C++ code, but nothing I write using Javascript Console.print shows up in my VS Output window. It only shows up when I'm running inside HiseStandalone application.

                    For example, I have a ScriptButton on the Hise side which when pressed prints some stuff to the JS console, which works when inside HiseStandalone application and shows up in the Hise console window under Hise code editor, but when I generate the C++ project (I am using the ExternalFloatingTileTest from the hise_tutorial project on GitHub), and run it under VS and press that same button nothing shows up in VS Output window, where I can see all my DBG lines from the C++ code.

                    Christoph Hart 1 Reply Last reply Reply Quote 0
                    • Christoph Hart
                      Christoph Hart @jonhallur last edited by

                      @jonhallur Ah yes, you're right - it just redirects script errors to DBG in the compiled version.

                      Just add DBG(x.toString()) before this line and you're good.

                      https://github.com/christophhart/HISE/blob/799e337ad74a34ec76b15b1e294c65235bc6fcfc/hi_scripting/scripting/api/ScriptingApi.cpp#L5124

                      jonhallur 2 Replies Last reply Reply Quote 0
                      • jonhallur
                        jonhallur @Christoph Hart last edited by

                        @christoph-hart Thanks

                        1 Reply Last reply Reply Quote 0
                        • jonhallur
                          jonhallur @Christoph Hart last edited by jonhallur

                          @christoph-hart While this works for when running the Hise standalone editor, it does not appear to work when I export a Hise preset to it's own VS standalone project and build and run the debug version.

                          Christoph Hart 1 Reply Last reply Reply Quote 0
                          • Christoph Hart
                            Christoph Hart @jonhallur last edited by

                            You're right (I keep forgetting about the layers I've added to the debug handling). All Console.xxx() calls are ignored in the compiled plugin (in fact they are thrown away by the HiseScript compiler when parsing the Javascript code). This is to prevent that any residual debugging code ends up clogging the finished product.

                            You can remove this by removing everything inside this preprocessing definition:

                            https://github.com/christophhart/HISE/blob/2da59a219ce25c10b6d9d9ee3e1ca0da18850940/hi_scripting/scripting/engine/JavascriptEngineParser.cpp#L379

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post

                            31
                            Online

                            736
                            Users

                            5.4k
                            Topics

                            50.3k
                            Posts