OSS with C-Media CM8738 and XBMC

OSS specific BSD discussion (FreeBSD/NetBSD/OpenBSD)

Moderators: hannu, dev, cesium, kodachi

OSS with C-Media CM8738 and XBMC

Postby Energybeing » Fri Jan 13, 2012 3:45 am

Hi, I am having quite a bit of trouble getting any sound out of the optical interface of my C-Media CM8738 using FreeBSD 9.0 rc3. In order to use the OSS driver as the snd_cmi driver was not working, I had to compile the kernel without the default sound driver support. Once OSS was compiled and started up, I had some sound with XBMC, but as soon as I changed a single setting, it was gone. I would like to get 5.1 surround from the optical out for use with XBMC. Here is my system info:

cat/dev/sndstat

Code: Select all
OSS 4.2 (b 2005/201201081817)BSD (C) 4Front Technologies 1996-2011
Kernel: FreeBSD 9.0-RC3 #0: Sun Jan  8 01:25:58 PST 2012
    root@Medialol:/usr/obj/usr/src/sys/MYKERNEL


Audio devices:
0: CMedia CM8768 (rev 68) (DUPLEX)
   Engine 1 opened INOUT by VMIX/0 @ 48000/48000 Hz Fragment: 2048/768000 (2.6 msec)
   Engine 2 opened OUT by xbmc.bin/1974 @ 44100/48000 Hz Fragment: 32768/192000 (170.6 msec)
1: CMedia CM8768 (playback only) (OUTPUT)

MIDI devices:

Mixers:
0: CMedia CMPCI


ossinfo -v9

Code: Select all
Version info: OSS 4.2 (b 2005/201201081817) (0x00040100) BSD
Platform: FreeBSD/amd64 9.0-RC3 FreeBSD 9.0-RC3 #0: Sun Jan  8 01:25:58 PST 2012
     root@Medialol:/usr/obj/usr/src/sys/MYKERNEL (Medialol)

Number of audio devices:   2
Number of audio engines:   6
Number of MIDI devices:      0
Number of mixer devices:   1


Device objects
0: oss_cmpci0 CMedia CM8738 interrupts=5503491 (6205651)

MIDI devices (/dev/midi*)

Mixer devices
0: CMedia CMPCI (Mixer 0 of device object 0)
    Device file /dev/oss/oss_cmpci0/mix0, Legacy device /dev/mixer0
    Priority: 1
    Caps:
    Device handle: OSS-PCI-mx01
    Device priority: 1


Audio devices
CMedia CM8768 (rev 68)            /dev/oss/oss_cmpci0/pcm0  (device index 0)
    Legacy device /dev/dsp0
    Caps: DUPLEX TRIGGER MMAP
    Modes: IN/OUT
      Engine      1: 0/CMedia CM8768 (rev 68)
                     Busy (IN/OUT) label 'VMIX'
      Engine      2: 1/CMedia CM8768 (rev 68) (vmix)
                     Busy (OUT) by PID 1974 / xbmc.bin label 'xbmc.bin'
      Engine      3: 2/CMedia CM8768 (rev 68) (vmix)
                     Available for use
      Engine      4: 3/CMedia CM8768 (rev 68) (vmix)
                     Available for use
      Engine      5: 4/CMedia CM8768 (rev 68) (vmix)
                     Available for use
    Input formats (0x00000418):
      AFMT_U8      - 8 bit unsigned
      AFMT_S16_LE   - 16 bit signed little endian
      AFMT_AC3      - AC3 (Dolby Digital) encoded audio
    Output formats (0x00000418):
      AFMT_U8      - 8 bit unsigned
      AFMT_S16_LE   - 16 bit signed little endian
      AFMT_AC3      - AC3 (Dolby Digital) encoded audio
    Device handle: OSS-PCI-au01
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 8
    Native sample rates (min - max): 5000 - 48000
    HW Type: ANALOG_OUT ANALOG_IN DIGITAL_OUT DIGITAL_IN     Minimum latency: Not indicated

CMedia CM8768 (playback only)     /dev/oss/oss_cmpci0/pcm1  (device index 1)
    Legacy device /dev/dsp1
    Caps: TRIGGER MMAP
    Modes: OUTPUT
      Out engine  1: 5/CMedia CM8768 (playback only)
                     Available for use
    Input formats (0x00000418):
      AFMT_U8      - 8 bit unsigned
      AFMT_S16_LE   - 16 bit signed little endian
      AFMT_AC3      - AC3 (Dolby Digital) encoded audio
    Output formats (0x00000418):
      AFMT_U8      - 8 bit unsigned
      AFMT_S16_LE   - 16 bit signed little endian
      AFMT_AC3      - AC3 (Dolby Digital) encoded audio
    Device handle: OSS-PCI-au02
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 8
    Native sample rates (min - max): 5000 - 48000
    HW Type: ANALOG_OUT ANALOG_IN DIGITAL_OUT DIGITAL_IN     Minimum latency: Not indicated


Nodes
  /dev/dsp -> /dev/oss/oss_cmpci0/pcm0
  /dev/dsp_in -> /dev/oss/oss_cmpci0/pcm0
  /dev/dsp_out -> /dev/oss/oss_cmpci0/pcm0
  /dev/dsp_ac3 -> /dev/oss/oss_cmpci0/pcm0
  /dev/dsp_mmap -> /dev/oss/oss_cmpci0/pcm0
  /dev/dsp_multich -> /dev/oss/oss_cmpci0/pcm0
  /dev/dsp_spdifout -> /dev/oss/oss_cmpci0/pcm0
  /dev/dsp_spdifin -> /dev/oss/oss_cmpci0/pcm0


ossmix

Code: Select all
Selected mixer 0/CMedia CMPCI
Known controls are:
vol [<leftvol>:<rightvol>] (currently 90:90)
synth [<leftvol>:<rightvol>] (currently 75:75)
synth.rec ON|OFF (currently OFF)
pcm [<leftvol>:<rightvol>] (currently 75:75)
speaker <monovol> (currently 75)
line [<leftvol>:<rightvol>] (currently 75:75)
line.rec ON|OFF (currently OFF)
mic <monovol> (currently 32)
mic.rec ON|OFF (currently ON)
cd [<leftvol>:<rightvol>] (currently 75:75)
cd.rec ON|OFF (currently OFF)
rec [<leftvol>:<rightvol>] (currently 75:75)
igain [<leftvol>:<rightvol>] (currently 75:75)
aux1 [<leftvol>:<rightvol>] (currently 64:64)
aux1.rec ON|OFF (currently OFF)
mutectl.linemute ON|OFF (currently ON)
mutectl.cdmute ON|OFF (currently ON)
mutectl.micmute ON|OFF (currently ON)
mutectl.line1mute ON|OFF (currently ON)
jackctl.rear2line ON|OFF (currently ON)
jackctl.cen2line ON|OFF (currently ON)
jackctl.bass2line ON|OFF (currently ON)
jackctl.cen2mic ON|OFF (currently ON)
mixext.spkmode <FRONT|SPREAD> (currently SPREAD)
mixext.dualdac ON|OFF (currently OFF)
mixext.micboost ON|OFF (currently OFF)
spdif.play ON|OFF (currently ON)
spdif.loop ON|OFF (currently ON)
spdif.record ON|OFF (currently OFF)
spdif.imon ON|OFF (currently ON)
spdif.polrev ON|OFF (currently ON)
spdif.copyprot ON|OFF (currently ON)
spdif.optical ON|OFF (currently ON)
vmix0-enable ON|OFF (currently ON)
vmix0-rate <decimal value> (currently 48000) (Read-only)
vmix0-channels <Stereo|Multich> (currently Multich)
vmix0-src <High|OFF> (currently Fast)
vmix0-outvol <monovol> (currently 24.7 dB)
vmix0-invol <monovol> (currently 25.0 dB)
vmix0.pcm1 [<leftvol>:<rightvol>] (currently 25.0:25.0 dB) ("xbmc.bin")
vmix0.pcm2 [<leftvol>:<rightvol>] (currently 25.0:25.0 dB)
vmix0.pcm3 [<leftvol>:<rightvol>] (currently 25.0:25.0 dB)
vmix0.pcm4 [<leftvol>:<rightvol>] (currently 25.0:25.0 dB)


I have tried messing with .asoundrc to no avail. I have been on IRC and have had a couple people try to help me again without success. Thank you for any help you can give.
Energybeing
 
Posts: 3
Joined: Fri Jan 13, 2012 3:38 am

Re: OSS with C-Media CM8738 and XBMC

Postby cesium » Fri Jan 13, 2012 10:31 am

A) Returning to default settings - erase /usr/local/lib/oss/etc/mixer.save and restart OSS. (/usr/lib/oss/etc/mixer.save on Linux)

B) 5.1 - before trying xbmc, try testing with a simpler program. Try using ossplay on a 5.1 wav file (like this) and outputing to /dev/dsp_multich .
cesium
 
Posts: 903
Joined: Sun Aug 12, 2007 12:51 am

Re: OSS with C-Media CM8738 and XBMC

Postby Energybeing » Sat Jan 14, 2012 6:50 am

cesium:

Thank you very much for your help! I made great progress, but unfortunately I am still having issues. Deleting the ossmix configuration file was a good idea. After messing with the ossmix settings for a bit I was able to get the audio file to play, however, it would only play on two channels. I would change the mixext.spkmode to SPREAD from FRONT and it would change back every time. Also, when vmix0 was enabled, sound would come out but it was very garbled and barely audible. All 6 channels would play through the two front channels, as I believe the mixext.spkmode setting not sticking to be the cause of that. After this, I fired XBMC up and the audio works fine when navigating the menus. My custom passthrough device is surround51 as specified by the default asoundr.conf file in /usr/local/etc. When starting to play a 5.1 video file, the file plays 5.1 just great! My receiver shows 6 channels and everything sounds perfect. Then when I pause it, the receiver indicates 2 channel audio, and when I resume the file, I get no audio and the video becomes very choppy. This may be a problem with XBMC. I am getting these error messages from ALSA:

Code: Select all
ALSA lib conf.c:4600:(snd_config_expand) Unknown parameters AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2
ALSA lib pcm.c:2213:(snd_pcm_open_noupdate) Unknown PCM surround51:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2


Do you have any ideas? I feel like I am so close yet so far. I was so happy when I heard 5.1 coming beautifully out of my speakers and then so frustrated when it broke as soon as I paused and resumed the video.
Energybeing
 
Posts: 3
Joined: Fri Jan 13, 2012 3:38 am

Re: OSS with C-Media CM8738 and XBMC

Postby Energybeing » Sat Jan 14, 2012 10:53 am

Ok I turned debugging on with XBMC and here is the contents of the log:

http://pastebin.com/VHcipguh

Here is where the problem occurs, whether it is caused here is to be determined:
Code: Select all
10:32:19 T:34686923776 M:391131136   DEBUG: OnKey: 61472 pressed, action is Pause
10:32:19 T:34686923776 M:391131136   DEBUG: CAnnouncementManager - Announcement: PlaybackPaused from xbmc
10:32:19 T:34686923776 M:391131136   DEBUG: CGUIAudioManager::Initialize
10:32:19 T:34686923776 M:391131136   ERROR: Unable to open audio mixer
10:32:19 T:34686923776 M:391131136   DEBUG: ------ Window Init (DialogSeekBar.xml) ------
10:32:19 T:34747554816 M:391110656 WARNING: CALSADirectSound::CALSADirectSound - device is not able to pause playback, will flush and prefix with 0 frames
Energybeing
 
Posts: 3
Joined: Fri Jan 13, 2012 3:38 am


Return to BSD

Who is online

Users browsing this forum: No registered users and 3 guests