特殊:Badtitle/NS100:EnableSoftwareMixing:修订间差异

来自Ubuntu中文
跳到导航跳到搜索
Wikibot留言 | 贡献
无编辑摘要
Wikibot留言 | 贡献
无编辑摘要
 
(未显示同一用户的2个中间版本)
第8行: 第8行:
<pre><nowiki>
<pre><nowiki>
pcm.card0 {
pcm.card0 {
type hw
  type hw
card 0
  card 0
# mmap_emulation true
# mmap_emulation true
}
}
#pcm.dmix0 {
#pcm.dmix0 {
#  type dmix  
#  type dmix  
第19行: 第20行:
#  }
#  }
#}
#}
pcm.dmix0 {
pcm.dmix0 {
type dmix
        type dmix
ipc_key 1024 ## needs to be a power of 2
        ipc_key 1024 ## needs to be a power of 2
slave {
        slave {
pcm "hw:0"
                pcm "hw:0"
period_time 0
                period_time 0
period_size 1024
                period_size 1024
buffer_size 8192
                buffer_size 8192
# format S16_LE
              # format S16_LE
rate 44100 ## not necessary
                rate 44100 ## not necessary
}
        }
#slowptr true
#slowptr true
}
}
pcm.dsnoop0 {
pcm.dsnoop0 {
type dsnoop  
  type dsnoop  
ipc_key 2048
  ipc_key 2048
slave {
  slave {
pcm "card0"  
    pcm "card0"  
#  rate 48000
  #  rate 48000
}
  }
}
}
pcm.asym0 {
pcm.asym0 {
type asym  
  type asym  
playback.pcm "dmix0"  
  playback.pcm "dmix0"  
capture.pcm "dsnoop0"
  capture.pcm "dsnoop0"
}
}
pcm.pasym0 {
pcm.pasym0 {
type plug  
  type plug  
slave.pcm "asym0"
  slave.pcm "asym0"
}
}
# 'dsp0' is expected by OSS emulation etc.
# 'dsp0' is expected by OSS emulation etc.
pcm.dsp0 {
pcm.dsp0 {
type                  plug
  type                  plug
slave.pcm            "asym0"
  slave.pcm            "asym0"
}
}
ctl.dsp0 {
ctl.dsp0 {
type                hw
    type                hw
card                0
    card                0
}
}
pcm.!default {
pcm.!default {
type                  plug
  type                  plug
slave.pcm            "asym0"
  slave.pcm            "asym0"
}
}
ctl.!default {
ctl.!default {
type                hw
    type                hw
card                0
    card                0
}
}
</nowiki></pre>
</nowiki></pre>
第70行: 第79行:
<pre><nowiki>
<pre><nowiki>
[esd]
[esd]
auto_spawn=1
auto_spawn=1
spawn_options=-terminate -nobeeps -as 2 -d default
spawn_options=-terminate -nobeeps -as 2 -d default
spawn_wait_ms=100
spawn_wait_ms=100
# default options are used in spawned and non-spawned mode
# default options are used in spawned and non-spawned mode
default_options=
default_options=
</nowiki></pre>
</nowiki></pre>
第87行: 第101行:
vo="xv"
vo="xv"
ao="alsa:device=default"
ao="alsa:device=default"
</nowiki></pre>
</nowiki></pre>
The vo="xv" will set mplayer to use xv hardware overlay for video so most of you will want that as well if you haven't set it as such. I'm mainly use totem but it's nice to have mplayer working with this setup.
The vo="xv" will set mplayer to use xv hardware overlay for video so most of you will want that as well if you haven't set it as such. I'm mainly use totem but it's nice to have mplayer working with this setup.
And the gstreamer-properties test with this setup will work for both playback and recording.
And the gstreamer-properties test with this setup will work for both playback and recording.
=== Comments ===
NOW REALLY, can we not just purge oss completely from a distribution yet?
----
----
[[category:CategoryDocumentation]] [[category:CategoryCleanup]]


[[category:UbuntuHelp]]
[[category:UbuntuHelp]]

2009年5月12日 (二) 16:38的最新版本

{{#ifexist: :EnableSoftwareMixing/zh | | {{#ifexist: EnableSoftwareMixing/zh | | {{#ifeq: {{#titleparts:EnableSoftwareMixing|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:EnableSoftwareMixing|1|-1|}} | zh | | }}

HOWTO: Hear multiple sounds using both esd and ALSA

(taken from http://www.ubuntuforums.org/printthread.php?t=32063&pp=40) These are the instructions on enabling software mixing, to avoid application problems like Audacity needing killall esd to work while another application is playing music. (1) libesd-alsa0 should be installed (it already is in dapper) (2) We need to create /etc/asound.conf, including the following lines:

pcm.card0 {
  type hw
  card 0
# mmap_emulation true
}

#pcm.dmix0 {
#  type dmix 
#  ipc_key 34521 
#  slave {
#    pcm "card0" 
#  }
#}

pcm.dmix0 {
        type dmix
        ipc_key 1024 ## needs to be a power of 2
        slave {
                pcm "hw:0"
                period_time 0
                period_size 1024
                buffer_size 8192
              # format S16_LE
                rate 44100 ## not necessary
        }
#slowptr true
}

pcm.dsnoop0 {
  type dsnoop 
  ipc_key 2048
  slave {
    pcm "card0" 
  #  rate 48000
  }
}

pcm.asym0 {
  type asym 
  playback.pcm "dmix0" 
  capture.pcm "dsnoop0"
}

pcm.pasym0 {
  type plug 
  slave.pcm "asym0"
}

# 'dsp0' is expected by OSS emulation etc.
pcm.dsp0 {
  type                  plug
  slave.pcm            "asym0"
}

ctl.dsp0 {
    type                hw
    card                0
}

pcm.!default {
  type                  plug
  slave.pcm            "asym0"
}

ctl.!default {
    type                hw
    card                0
}

(3) Also, we need to change /etc/esound/esd.conf contents so:

[esd]

auto_spawn=1

spawn_options=-terminate -nobeeps -as 2 -d default

spawn_wait_ms=100

# default options are used in spawned and non-spawned mode

default_options=

(4) Now we need to change ubuntu sound server to alsa (we can leave it ESD but we better use alsa because it has better sound handling): "gstreamer-properties" -- Change both (in the Audio Tab not the Video) from ESD to ALSA. (5) All that's left now is to restart computer (after restart you must hear sound) to enable these changes. Also configure XMMS or Beep-media-player (or any player) to use ALSA instead of eSound/ESD. If you hear a strange sound, just change everything back to ESD. If everything worked correctly, now Audacity & Skype will work normally and all the program will play sound using either Alsa or ESD.

Notes

  • If you couldn't play any sounds using ALSA then your /etc/asound.cond & /etc/esound/esd.conf needs some more advanced tweaking (or your sound card just won't support it).
  • if realplayer still doesn't work after switching to alsa, this is because it is looking for /dev/dsp which is the oss device. Fortunately, alsa includes oss emulation. to enable it, just type "modprobe -v snd-pcm-oss"; this will create the /dev/dsp device, routed to alsa. Realplayer (and other oss only apps, no doubt) then works. If that works fine, then just add snd-pcm-oss to the file /etc/modules; it will be loaded automatically at boot.
  • Also you might find sdl games no longer have sound here's a fix: SDL tries to use hw:0, and without intervention, it fails to open audio device. But SDL uses AUDIODEV environment variable, so it placed such file to /etc/profile.d/, example dmix_sdl.sh: "export AUDIODEV=default".

Note that for sdl games you should have libsdl1.2debian-alsa installed. You could install the esd version but both will work and this way you can have sdl games work in another window manager where you might not be running esd. It defaulted to libsdl1.2debian-oss. Not sure exactly why that doesn't work when alsa has oss emulation.

  • and finally mplayer can be modified within the gui (gmplayer) but mplayer alone won't read that. Here's my ~/.mplayer/config:
vo="xv"
ao="alsa:device=default"
 

The vo="xv" will set mplayer to use xv hardware overlay for video so most of you will want that as well if you haven't set it as such. I'm mainly use totem but it's nice to have mplayer working with this setup. And the gstreamer-properties test with this setup will work for both playback and recording.