• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
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

Audio change script

Scheduled Pinned Locked Moved Help and Support
scriptaudioretropie menu
3 Posts 2 Posters 208 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.
  • C
    Codafire
    last edited by 30 Apr 2020, 15:19

    Hi again mates. Im making an script to add a new element to the RetroPie menu, so i can change audio output between HDMI and Jack without entering the dos type menus, only pushing the new option i added.

    The code its the next, im having problems so i dont know where is the problem, any help? Thanks.

    #!/usr/bin/env bash

    AUDIO=0

    if [[AUDIO=0]]; then
    amixer cset numid=3 1
    AUDIO=1
    else [[AUDIO=1]]; then
    amixer cset numid=3 2
    AUDIO=0
    fi

    exit

    Any help?

    1 Reply Last reply Reply Quote 0
    • M
      mitu Global Moderator
      last edited by mitu 30 Apr 2020, 17:46

      Well, I'd suggest you take a primer in Bash scripting, because there's some basic blocks that you're missing. I suggest using the Bash scriptiung guide to get started.

      1. The variables are referenced with $VARNAME,
      2. if testing expression needs space around the condition
        3 . The condition should be ==, = is an assignment operator.
      3. There's no then after else and else does not have a test expression as

      What you want is probably similar to this

      #!/usr/bin/env bash
      AUDIO=0
      if [[ $AUDIO==0 ]]; then
      echo "Audio zero"
      AUDIO=1
      else
      echo "Audio one"
      AUDIO=0
      fi
      1 Reply Last reply Reply Quote 1
      • C
        Codafire
        last edited by 30 Apr 2020, 21:47

        Thanks a lot, i solved it!!!

        1 Reply Last reply Reply Quote 0
        3 out of 3
        • First post
          3/3
          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.

          This community forum collects and processes your personal information.
          consent.not_received