[Expired for alsa-driver (Ubuntu) because there has been no activity for
60 days.]

** Changed in: alsa-driver (Ubuntu)
       Status: Incomplete => Expired

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to alsa-driver in Ubuntu.
https://bugs.launchpad.net/bugs/770526

Title:
  C-Media CM106 SPDIF-IN does not seem to record

Status in alsa-driver package in Ubuntu:
  Expired

Bug description:
  Hello,

  I have a C-MEDIA CM106 USB External SoundCard. And its been a while
  since I used SPDIF in Linux. I am trying to figure out why SPDIF-IN or
  Optical IN is not recording. I did find nice tutorials about HOW to
  RECORD sound using SPDIF. And here is my current output:

  OS: ubuntu 10.10 x64
  Kernel:  default-generic (based on updates)
  Current kernel: Linux atlantis 2.6.35-28-generic #50-Ubuntu SMP Fri Mar 18 
18:42:20 UTC 2011 x86_64 GNU/Linux

  USB Device:
  Bus 003 Device 007: ID 0d8c:0102 C-Media Electronics, Inc. CM106 Like Sound 
Device

  AlsaMixer:
  │                    │  │       │  │       │  │                               
 │
  │                    │  │       │  │       │  │                               
 │
  │                    │  │       │  │       │  │                               
 │
  │                    │▒▒│       │  │       │  │                               
 │
  │                    │▒▒│       │▒▒│       │  │                               
 │
  │                    │▒▒│       │▒▒│       │▒▒│                               
 │
  │                    │▒▒│       │▒▒│       │▒▒│                               
 │
  │                    │▒▒│       │▒▒│       │▒▒│                               
 │
  │                    │▒▒│       │▒▒│       │▒▒│                               
 │
  │                    │▒▒│       │▒▒│       │▒▒│                               
 │
  │                    │▒▒│       │▒▒│       │▒▒│                               
 │
  │                    └──┘       └──┘       └──┘      L    R                   
 │
  │                  -------    -------    -------    CAPTURE                   
 │
  │                   70<>70     55<>55     46<>46                              
 │
  │                <   PCM    >   Line       Mic     S/PDIF In        

  
  I am not sure if S/PDIF IN should have bars in this case. 

  Tryed to use following commands:
  1. arecord -D hw:2,0 -f dat | aplay -D hw:1,0
  2. arecord -D hw:2,0 -f dat | ac3dec -D hw:1,0
  2. arecord -D hw:2,0 -f dat -t raw | ac3dec -D surround51:1,0 -6
  3. arecord -D spdif:2,0 -f dat -t raw | ac3dec -D surround51:1,0 -6
  4. arecord -D spdif:2,0 -t raw -f dat | ac3dec -D surround51:1,0

  Output 1:
  andrej@atlantis:~$ arecord -D spdif:2,0 -t raw -f dat | ac3dec -D 
surround51:1,0
  Recording raw data 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, 
Stereo
  2.0 Mode 48.0 KHz  32 kbps Complete Main Audio Service
  Using PCM device 'surround51:1,0'

  Output 2:
  andrej@atlantis:~$ arecord -D spdif:2,0 -t raw -f dat | ac3dec -D 
surround51:1,0 -6
  Recording raw data 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, 
Stereo
  2.0 Mode 48.0 KHz  32 kbps Complete Main Audio Service
  unsupported 1/1 channels 6

  Driver works fine. Analog input works (both MIC). Analog output works. Tryed 
stereo only for now. I wanted to use this card
  for Optical IN. I am combining it with Xbox360 for better game atmosphere. 
Windows7, XP work great using realtime in GraphEdit. But I wen't to Ubuntu 
10.10 x64. 

  Tryed to pipe also with:
  arecord -D spdif:2,0 -t raw -f dat | spdifextract | ac3dec -D surround51:1,0 
-6

  spdifextract:

  code from forum about converting from 24,32bit to 16 or something like
  that. can't remeber that much.

  CODE:

  #include <stdio.h>

  typedef unsigned char uint8_t; 
  typedef unsigned short uint16_t; 
  typedef unsigned long uint32_t; 

  #define SPDIF_SYNC      0x4e1ff872

  struct spdif_head_t { 
          uint32_t        sync; 
          uint8_t         type; 
          uint8_t         bsmod; 
          uint16_t        databits;        
  }; 

  int spdif_sync(FILE *in, struct spdif_head_t *header) 
  { 
          uint32_t byte; 
          uint32_t dword = 0xffffffff; 

          while ((byte = fgetc(in)) != EOF) { 
         
                  dword = dword >> 8 | (byte << 24); 
                  if (dword == SPDIF_SYNC) { 
                          header->sync = dword; 
                          if ((byte = fgetc(in)) == EOF) 
                                  return -1; 
                          header->type = byte; 
                          if ((byte = fgetc(in)) == EOF) 
                                  return -1; 
                          header->bsmod = byte; 
                          if ((byte = fgetc(in)) == EOF) 
                                  return -1; 
                          header->databits = byte; 
                          if ((byte = fgetc(in)) == EOF) 
                                  return -1; 
                          header->databits |= byte << 8; 
                          return 0; 
                  } 
          } 
          
          return -1; 
  } 

  int main(int argc, char **argv) 
  { 
          char *stream_name = "stdin"; 
          FILE *in = stdin, *out = stdout; 
          fpos_t fpos; 
          int i, byte0, byte1, pos, last_pos; 
          struct spdif_head_t header; 

          last_pos = 0; 
          while (spdif_sync(in, &header) == 0) { 
          /*      fgetpos(in, &fpos); 
                  pos = *((int *) &fpos); 
                  printf("Found SPDIF sync at %010lx: %5x, len %5x\n", pos, 
                                                          pos - last_pos, 
                                                          header.databits / 8); 
                  last_pos = pos; 
          */ 
                  for (i = 0; i < header.databits / 8 / 2; i++) { 
                          if ((byte1 = fgetc(in)) == EOF) 
                                  break; 
                          if ((byte0 = fgetc(in)) == EOF) 
                                  break; 
                          fputc(byte0, out); 
                          fputc(byte1, out); 
                  } 
          } 

          return 0; 
  }

  CODE END;

  And thats it for now. Still searching for a solution. Just as long its
  not windows. I converted all my machines to linux and I am happy how
  stable it is.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/770526/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to