[LAD] (no subject)

Mathieu Dalexis dev.audioaero at orange.fr
Mon Feb 11 18:24:45 UTC 2008


The PCI card I'm working with was made to receive the signal as a 32 bits frame (16 bits by channels) each time I write to the file device so I have to turn the src_data.data_out frames (2 floats) into a unique 32bit unsigned long and write it:

1) "unsigned long frame;" : I declare an unsigned long that will receive the entire frame.

2) "frame = (unsigned long) ((src_data.data_out[sent]))>>16;" : I convert the float at the index equal to sent and initialise the frame with it. So my frame look like this 0000000000000000XXXXXXXXXXXXXXXX Where Xs represent one channel signal.
 
3) "frame |= (((unsigned long) (src_data.data_out[sent+1])) & 0xFFFF0000);" Apply a mask to the 16 first low bits of the data_out float value and aplly a OR between it and frame. It should look like this : 
     
      yyyyyyyyyyyyyyyy0000000000000000 | 0000000000000000XXXXXXXXXXXXXXXX = YYYYYYYYYYYYYYYYXXXXXXXXXXXX 

Where Ys is the other channel signal.

Is it clear enough,I hope so :)

I have to emphasize that this stuff seems to work because when I send the src_data.data_in frames buffer this way, the signal is perfect.

> Message du 11/02/08 14:12
> De : "Erik de Castro Lopo" <mle+la at mega-nerd.com>
> A : linux-audio-dev at lists.linuxaudio.org
> Copie à : "Mathieu Dalexis" <dev.audioaero at orange.fr>
> Objet : Re: [LAD] (no subject)
> 
> Mathieu Dalexis wrote:
> 
> >           unsigned long frame;
> >           frame = (unsigned long) ((src_data.data_out[sent]))>>16;
> >           frame |= (((unsigned long) (src_data.data_out[sent+1])) & 0xFFFF0000);
> 
> Sorry, but what is all this stuff?
> 
> Erik
> -- 
> -----------------------------------------------------------------
> Erik de Castro Lopo
> -----------------------------------------------------------------
> "Projects promoting programming in natural language are intrinsically
> doomed to fail." -- Edsger Dijkstra
> ---------------------------------------------------------------------------------------
> Orange vous informe que cet  e-mail a ete controle par l'anti-virus mail. 
> Aucun virus connu a ce jour par nos services n'a ete detecte.
> 
> 
> 




More information about the Linux-audio-dev mailing list