ADC and IIS inputs coexist

Discussion about writing software for VS1005 and the VSOS Operating System. Also posts about VS1005-related hardware design and device drivers should be posted here.
Post Reply
winwan
Senior User
Posts: 62
Joined: Fri 2014-07-04 15:51

ADC and IIS inputs coexist

Post by winwan »

I have an application that uses ADC INPUT and IIS INPUT. I run FTOREV to process ADC signals, mix them into IIS INPUT signals, and then output them to IIS OUT or DAC. Is the STDAudioin signal link accessed by FTOREV connected to ADC or IIS INPUT? How do I distinguish between ADC and IIS input and handle them when mixing
Hannu
Senior User
Posts: 396
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

Re: ADC and IIS inputs coexist

Post by Hannu »

Hi,

First to answer your question: stdaudioin is single stereo source. It is usually selected when an input driver is loaded with the s parameter.

Second thing is that FtORev is output effect. Adding Input side feature should be small matter of programming. But let's not worry about it.

Third point is that if VS1005 can be I2S master, this can be relatively easy task. I2S master and ADC are in sync so no problems. Just writing a small driver.

Config.txt should have something like this. I didn't think much about the parameters

Code: Select all

#step 1
auiadc s
#step 2
auodac s
#step 3
mymixer
#step 4
ftorev
#set samplerate and bits. Add the wanted channels
run auinput -r48000 -b16
run auoutput -r48000 -b16
#start moving audio
auxplay
What the mymixer driver does?
It saves original stdaudioout and implements own stdaudioout FILE (actually SIMPLE_FILE is OK) Identify(), Write() and Ioctl() methods.Rest can be CommonOkResultFunction(). It loads the I2S driver too. It also needs to have the I2S and ADC balance information. I usually copy .flags from stdout_orig to my new file. Then set stdaudioout to point to my new file.

To implement this take a look at roots and sources 3.65 or newer. You need to load manually the AUXI2SM library, get the file pointer and use it. The solution has the README.TXT which shows how it is done. There is also FtMono where you can take a look how to implement the FILE structure and all the needed stuff like init() and fini() and how those setup and reset the features. And VSOS_Audio.pdf is also a good reference manual.

In Ioctl() pass the commands to both, stdaudioout_orig and i2s_fp. At least samplerate and bits are important. I think I2S supports 48 and 96 kHz
Also you need a new IOCTL_AUDIO_SET_MIX_BALANCE request or similar to change the I2S, ADC mixing balance.

In Write(), read same amount from I2S as is incoming from Write. Then mix them together and write to stdaudioout_orig and to i2s_fp.

At th end you get something like in my horrible picture where I planned this.
mixer design
mixer design
mixing_plan.png (52.06 KiB) Viewed 465 times
Oh and when this is all set up. you can just call ioctl() to change balance and happily run your UI as mymixer is doing mixing in the background and auxplay does the ADC -> stdaudioout copy. One benefit also that the I2S forwarding stops also if you unload the AUXPLAY. This is because the I2S read and mix happens in the Write() method.
User avatar
Henrik
VLSI Staff
Posts: 1271
Joined: Tue 2010-06-22 14:10

Re: ADC and IIS inputs coexist

Post by Henrik »

Hello!

I have been working on and released a new version of the Reverb driver that can connect to stdaudioin:
viewtopic.php?f=13&t=2239

This will make it easier to do what I think you are asking:
1) Read input A
2) Read input B
3) Apply reverb to input B
4) Mix together and output

(QUESTION: Is 1-4 what you want?)

I will try to provide an example on how to use the new driver tomorrow.

Kind regards,
- Henrik
Good signatures never die. They just fade away.
winwan
Senior User
Posts: 62
Joined: Fri 2014-07-04 15:51

Re: ADC and IIS inputs coexist

Post by winwan »

In MIX, NOW I want to apply FTOEQU to the specified path, such as ADCIN. The test result is that when FTOEQU runs, it will directly apply STDAUDIOOUT, that is, after the two signals are mixed. Could you please modify FTOEQU so that I can choose this function for ADC or IIS? Just like reverb , I can choose FTIREV or FTOREV
FTOEQU.png
FTOEQU.png (12.2 KiB) Viewed 201 times
FTOEQU2.png
FTOEQU2.png (12.21 KiB) Viewed 201 times
Post Reply