RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    [Solved] Audio output switching with toggle switch

    Scheduled Pinned Locked Moved Help and Support
    audio output
    18 Posts 3 Posters 885 Views
    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.
    • O
      oldspicy @mitu
      last edited by oldspicy

      @mitu exactly. The shutdown command works great, the section to play audio via omxplayer works, its just the amixer lines that dont work. Haven't changed a single thing in the file from the older version of retropie. All of them use the os.system command. That's why I'm thinking it's a retropie change to how audio is handled.

      I'll get the entire code posted to pastebin tomorrow.

      Thanks for responding!

      mituM cyperghostC 2 Replies Last reply Reply Quote 0
      • mituM
        mitu Global Moderator @oldspicy
        last edited by

        @oldspicy RetroPie is not an OS in itself, it just uses Raspbian underneath. So the change is on the OS side or in the python libs used.

        1 Reply Last reply Reply Quote 1
        • O
          oldspicy
          last edited by

          Here is the python: https://pastebin.com/x9j51eKe

          1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator
            last edited by

            The script looks fine - I don't see any problems with it. How are you testing if it works ?

            O 1 Reply Last reply Reply Quote 1
            • cyperghostC
              cyperghost @oldspicy
              last edited by cyperghost

              @oldspicy said in Audio output switching with toggle switch:

              All of them use the os.system command. That's why I'm thinking it's a retropie change to how audio is handled.

              why do you not test via CLI to toogle sound. Just enter the command sudo amixer cset numid=3 2 and see what is happening? As @mitu told there seems no error in the script.

              PS: Are you in DVI mode? Maybe you can force HDMI sound by adding hdmi_drive=2 to your /boot/config.txt

              O 2 Replies Last reply Reply Quote 1
              • O
                oldspicy @cyperghost
                last edited by

                @cyperghost tried that, still isnt working. The amixer code just isnt activating for some reason.

                mituM 1 Reply Last reply Reply Quote 0
                • mituM
                  mitu Global Moderator @oldspicy
                  last edited by

                  @oldspicy Did you check the volume with alsamixer when switching between audio outputs ?

                  O 1 Reply Last reply Reply Quote 1
                  • O
                    oldspicy @mitu
                    last edited by

                    @mitu both in game and from the command line

                    1 Reply Last reply Reply Quote 0
                    • O
                      oldspicy @mitu
                      last edited by

                      @mitu I haven't because there is audio out both, but I'll try that in a bit

                      1 Reply Last reply Reply Quote 0
                      • O
                        oldspicy @cyperghost
                        last edited by

                        @cyperghost I can force one or the other, but the point is to toggle. Sometimes using hdmi, sometimes using the internal speaker

                        cyperghostC 1 Reply Last reply Reply Quote 0
                        • cyperghostC
                          cyperghost @oldspicy
                          last edited by cyperghost

                          @oldspicy I quickly tried on my build ... the commands amixer cset numid=3 2 works. But I'm still on a Jessie build! Maybe @mitu can test?

                          O 2 Replies Last reply Reply Quote 0
                          • O
                            oldspicy @cyperghost
                            last edited by oldspicy

                            @cyperghost @mitu Okay, so I found two more problems. Bluetooth controllers are flaky, and the shutdown script won't work if the screensaver is active. The screensaver holds it and shutdown wont happen.

                            I still have a build I imaged from jessie when everything was working. It's a bit old and I'll have to rebuild some things, but it might be easier. I haven't noticed a big reason to update. I just did because the files got corrupted and I figured it was a good time to update everything.

                            But thanks for trying!

                            mituM 1 Reply Last reply Reply Quote 0
                            • mituM
                              mitu Global Moderator @oldspicy
                              last edited by

                              @oldspicy Can't say I've seen the shutdown command being unable to actually shutdown/restart unless there was an I/O kernel operation stuck somewhere.

                              O 1 Reply Last reply Reply Quote 0
                              • O
                                oldspicy @mitu
                                last edited by

                                @mitu I'm going to try wiping and a fresh install one more time before I give up, maybe something was corrupted that I couldn't find.

                                1 Reply Last reply Reply Quote 0
                                • O
                                  oldspicy @cyperghost
                                  last edited by

                                  @cyperghost @mitu Okay, so a clean install fixed everything. I'm not sure what happened the first time, but now the audio switching works, along with the power and bluetooth. Something must have went wrong on the first install. Thanks for taking the time to help me troubleshoot though!

                                  How do I mark the post as solved?

                                  mituM 1 Reply Last reply Reply Quote 1
                                  • mituM
                                    mitu Global Moderator @oldspicy
                                    last edited by

                                    @oldspicy said in SOLVED - Audio output switching with toggle switch:

                                    How do I mark the post as solved?

                                    Edit the topic starting post and modify the title - append or prepend [solved] to it.

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

                                    Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                    Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.