where and how to get analog input volume data for level meter display ( 8 analog inputs,I2S 24bits format)

All the latest news and announcements from XCore and XMOS.
susanyin0501
Active Member
Posts: 45
Joined: Thu Apr 20, 2017 9:00 am

where and how to get analog input volume data for level meter display ( 8 analog inputs,I2S 24bits format)

Post by susanyin0501 »

Hi all,
we are preparing for analog inputs voulme level meter display on panel, i tried to read out ADC convert result from deliver( ) in audio.xc
but g_in_0 didn't change almost even inputing analog voice signal (from Micphone, we can record and playback voice with Audacity tool )
where and how to get analog input volume data ? Thanks!

Code: Select all

[/#pragma loop unroll
            /* First time around we get channel 7 of TDM8 */
            for(int i = 0; i < I2S_CHANS_ADC; i+=I2S_CHANS_PER_FRAME)
            {
                // p_i2s_adc[index++] :> sample;
                // Manual IN instruction since compiler generates an extra setc per IN (bug #15256)
                unsigned sample;
                unsigned sample_0;
                asm volatile("in %0, res[%1]" : "=r"(sample)  : "r"(p_i2s_adc[index++]));

                /* Note the use of readBuffNo changes based on frameCount */
               [highlight=yellow]if (i ==0){
                    sample_0 = sample & 0x7fffffff;
                    sample_0 = sample_0 >> 7;
                    SET_SHARED_GLOBAL( g_in_0, sample_0);
                  //  vu_calc_in_0(sample_0);
                }[/highlight]
                if(buffIndex)
                    samplesIn_1[((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i] = bitrev(sample); // channels 0, 2, 4.. on each line.
                else
                    samplesIn_0[((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i] = bitrev(sample);
            }code]
User avatar
xsamc
Active Member
Posts: 55
Joined: Fri Mar 04, 2011 3:38 pm

Post by xsamc »

Hi there,

The code you have added in yellow occurs before the bitrev is performed, are you sure 'sample' is in form you're expecting?
Cheers,
Sam
susanyin0501
Active Member
Posts: 45
Joined: Thu Apr 20, 2017 9:00 am

Post by susanyin0501 »

i'm not sure, i don't know where should i get them?