Alsactl store function


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Alsactl store function
# 1  
Old 01-10-2019
Alsactl store function

Recently, I replaced a codec and amplifier on an older embedded system. It required minor changes to the machine startup code, a new timing crystal and minor alterations to the machine driver. The old amp had a MODE pin which was being used as a mute function and the new amp has a dedicated SHDN pin which can be used as a mute (tested and works). After making the alterations I just eluded to I managed to produce a tone by re-initializing the sound device to a default state by running:

Code:
# alsactl init 
# alsactl -f /etc/alsa/asound.play store

I had to alter the new asound.play file slightly (by hand) to make it look as close to the old asound.play file as possible in order to actually produce sound. At some point in the past (old project) someone needed to use the old mute function in order to prevent a "hum" which was being produced by the speaker even when it was supposed to be silent. So they triggered the mute at startup then un-muted when a tone was to be played, waited for the tone to play and triggered it again. Unfortunately, in order to produce a tone with the new CODEC I installed I had to disable that muting behavior Smilie. What I am attempting to do now is to produce sound with that same muting behavior.

Sound is handled in the user-space by a file called SoundManagerAlsa.cpp and I see no reason why I should have to alter that code. It does produce noise but for some reason is not handling the muting functionality the same as it use to. Essentially, in order to mute inside the user-space a GPIO pin which is hooked up to the MODE pin of the amp is being toggled on and off (mute function). The exact same pin can be toggled on and off in order to control the SHDN pin I referred to earlier and like I said that has been tested and it does work. I believe that something about the signal coming into the user-space is slightly different but based on the debugging information (print lines) I enabled inside of SoundManagerAlsa.cpp there doesn't seem to be a difference in the old tone and the new tone. For instance, the frequency is the same, the channel, the pulse width etc. I have no debugger so I can't just step through the code and it's a rather complicated piece of code tbh.

That being said, I believe (is a hunch) that the problem is occurring somewhere prior to the point where SoundManagerAlsa.cpp starts handling sound. So I decided to go take another look at the two .play files again. One thing I noticed: the old asound.play file had a blurb at the top that looked computer generated to me it reads:

Code:
#
# Configuration file for the WM8753 with:
#   - Enabled output for the playback functionality
#   - Using the I2S-interface for the data transfer from the uC
#
#

However, my auto-generated default asound.play file for the new codec had no such blurb it just went straight into the declarations of the different features such as:

Code:
state.ccwmx51js {
    control.1 {
        comment.access 'read write'
        comment.type INTEGER
        comment.count 2
        comment.range '0 - 63'
        iface MIXER
        name 'Capture Volume'
        value.0 48
        value.1 48
    }
    control.2 {
        comment.access 'read write'
        comment.type BOOLEAN
        comment.count 2
        iface MIXER
        name 'Capture ZC Switch'
        value.0 false
        value.1 false
       }

This got me wondering if there was a way to specify with the alsactl init command if I want things like "playback functionality" or if I want "the I2S-interface for the data transfer..." and such as is noted in the old asound.play blurb I referred to earlier that isn't mentioned in the man pages?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Function - Make your function return an exit status

Hi All, Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition. #Body function1() { if then echo "exist" else echo "not exist" } #if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies

2. Shell Programming and Scripting

Need help on awk for printing the function name inside each function

Hi, I am having script which contains many functions. Need to print each function name at the starting of the function. Like below, functionname() { echo "functionname" commands.... } I've tried like below, func=`grep "()" scriptname | cut -d "(" -f1` for i in $func do nawk -v... (4 Replies)
Discussion started by: Sumanthsv
4 Replies

3. Shell Programming and Scripting

Will files, creaetd in one function of the same script will be recognized in another function?

Dear All. I have a script, which process files one by one. In the script I have two functions. one sftp files to different server the other from existing file create file with different name. My question is: Will sftp function recognize files names , which are created in another... (1 Reply)
Discussion started by: digioleg54
1 Replies

4. Shell Programming and Scripting

Help to Modify File Name in each function before calling another function.

I have a script which does gunzip, zip and untar. Input to the script is file name and file directory (where file is located) I am reading the input parameters as follows: FILENAME=$1 FILEDIR=$2 I have created 3 functions that are as follows: 1) gunzip file 2) unzip file... (2 Replies)
Discussion started by: pinnacle
2 Replies

5. Shell Programming and Scripting

How to store value from a function and use it?

There is one function to calculate previous day value and then touch one file with that date.The problem is i am getting the previous day value but not able to store it in other variable and use it. PREVIOUS_DATE_FUNCTION() { date '+%m %d %Y' | { read MONTH DAY YEAR DAY=`expr "$DAY" -... (7 Replies)
Discussion started by: aroragaurav.84
7 Replies

6. Programming

How to step in one function after the function be executed in gdb?

In gdb, I can call one function with command "call", but how can I step in the function? I don't want to restart the program, but the function had been executed, gdb will execute next statement, and I don't know how to recall the function. (4 Replies)
Discussion started by: 915086731
4 Replies

7. Shell Programming and Scripting

Not able to store the results of perl recursive function when applied under for loop

Hi Perl Gurus , need URGENT HELP PLEASE !!!!! I have one recursive Perl function which takes path of any directory as argument and returns array containing all the sub folders inside it recursively. Now the problem is that it works well if i use it with one time but the problem is that when... (0 Replies)
Discussion started by: anthriksh2000
0 Replies

8. Shell Programming and Scripting

Return a value from called function to the calling function

I have two scripts. script1.sh looks -------------------------------- #!/bin/bash display() { echo "Welcome to Unix" } display ----------------------------- Script2.sh #!/bin/bash sh script1.sh //simply calling script1.sh ------------------------------ (1 Reply)
Discussion started by: mvictorvijayan
1 Replies

9. Shell Programming and Scripting

Passing global variable to a function which is called by another function

Hi , I have three funcions f1, f2 and f3 . f1 calls f2 and f2 calls f3 . I have a global variable "period" which i want to pass to f3 . Can i pass the variable directly in the definition of f3 ? Pls help . sars (4 Replies)
Discussion started by: sars
4 Replies
Login or Register to Ask a Question