1. 程式人生 > >嵌入式linux開發板使用pulseaudio連線藍芽耳機播放音訊檔案

嵌入式linux開發板使用pulseaudio連線藍芽耳機播放音訊檔案

Show this help list-modules List loaded modules list-cards List cards list-sinks List loaded sinks list-sources List loaded sources list-clients List loaded clients list-sink-inputs List sink inputs list-source-outputs List source outputs stat Show
memory block statistics info Show comprehensive status load-module Load a module (args: name, arguments) unload-module Unload a module (args: index|name) describe-module Describe a module (arg: name) set-sink-volume Set
the volume of a sink (args: index|name, volume) set-source-volume Set the volume of a source (args: index|name, volume) set-sink-mute Set the mute switch of a sink (args: index|name, bool) set-source-mute Set the mute switch of a source (args: index|name, bool) set
-sink-input-volume Set the volume of a sink input (args: index, volume) set-source-output-volume Set the volume of a source output (args: index, volume) set-sink-input-mute Set the mute switch of a sink input (args: index, bool) set-source-output-mute Set the mute switch of a source output (args: index, bool) set-default-sink Set the default sink (args: index|name) set-default-source Set the default source (args: index|name) set-card-profile Change the profile of a card (args: index|name, profile-name) set-sink-port Change the port of a sink (args: index|name, port-name) set-source-port Change the port of a source (args: index|name, port-name) set-port-latency-offset Change the latency of a port (args: card-index|card-name, port-name, latency-offset) suspend-sink Suspend sink (args: index|name, bool) suspend-source Suspend source (args: index|name, bool) suspend Suspend all sinks and all sources (args: bool) move-sink-input Move sink input to another sink (args: index, sink) move-source-output Move source output to another source (args: index, source) update-sink-proplist Update the properties of a sink (args: index|name, properties) update-source-proplist Update the properties of a source (args: index|name, properties) update-sink-input-proplist Update the properties of a sink input (args: index, properties) update-source-output-proplist Update the properties of a source output (args: index, properties) list-samples List all entries in the sample cache play-sample Play a sample from the sample cache (args: name, sink|index) remove-sample Remove a sample from the sample cache (args: name) load-sample Load a sound file into the sample cache (args: name, filename) load-sample-lazy Lazily load a sound file into the sample cache (args: name, filename) load-sample-dir-lazy Lazily load all files in a directory into the sample cache (args: pathname) kill-client Kill a client (args: index) kill-sink-input Kill a sink input (args: index) kill-source-output Kill a source output (args: index) set-log-target Change the log target (args: null|auto|syslog|stderr|file:PATH|newfile:PATH) set-log-level Change the log level (args: numeric level) set-log-meta Show source code location in log messages (args: bool) set-log-time Show timestamps in log messages (args: bool) set-log-backtrace Show backtrace in log messages (args: frames) play-file Play a sound file (args: filename, sink|index) dump Dump daemon configuration dump-volumes Debug: Show the state of all volumes shared Debug: Show shared properties exit Terminate the daemon [email protected]:~#pactl list cards Card #0 Name: alsa_card.platform-sound.20 Driver: module-alsa-card.c Owner Module: 7 Properties: alsa.card = "0" alsa.card_name = "wm8962-audio" alsa.long_card_name = "wm8962-audio" device.bus_path = "platform-sound.20" sysfs.path = "/devices/soc0/sound.20/sound/card0" device.string = "0" device.description = "wm8962-audio" module-udev-detect.discovered = "1" device.icon_name = "audio-card" Profiles: input:analog-mono: Analog Mono Input (sinks: 0, sources: 1, priority: 2, available: yes) input:analog-stereo: Analog Stereo Input (sinks: 0, sources: 1, priority: 60, available: yes) output:analog-mono: Analog Mono Output (sinks: 1, sources: 0, priority: 200, available: yes) output:analog-mono+input:analog-mono: Analog Mono Duplex (sinks: 1, sources: 1, priority: 202, available: yes) output:analog-stereo: Analog Stereo Output (sinks: 1, sources: 0, priority: 6000, available: yes) output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (sinks: 1, sources: 1, priority: 6060, available: yes) off: Off (sinks: 0, sources: 0, priority: 0, available: yes) Active Profile: output:analog-stereo+input:analog-stereo Ports: analog-input: Analog Input (priority: 10000, latency offset: 0 usec) Part of profile(s): input:analog-mono, input:analog-stereo, output:analog-mono+input:analog-mono, output:analog-stereo+input:analog-stereo analog-output-speaker: Speakers (priority: 10000, latency offset: 0 usec, not available) Properties: device.icon_name = "audio-speakers" Part of profile(s): output:analog-mono, output:analog-mono+input:analog-mono, output:analog-stereo, output:analog-stereo+input:analog-stereo analog-output-headphones: Headphones (priority: 9000, latency offset: 0 usec, available) Properties: device.icon_name = "audio-headphones" Part of profile(s): output:analog-mono, output:analog-mono+input:analog-mono, output:analog-stereo, output:analog-stereo+input:analog-stereo 如果發現板子上有單個音效卡裝置,則按照步驟5.1配置既可以,如果有多個音效卡裝置按照5.2步驟配置 5.1 單聲音配置 Card #1 Name: bluez_card.35_BD_7B_5D_CC_AE Driver: module-bluez5-device.c Owner Module: 24 Properties: device.description = "J2-USB Bluetooth" device.string = "35:BD:7B:5D:CC:AE" device.api = "bluez" device.class = "sound" device.bus = "bluetooth" device.form_factor = "headset" bluez.path = "/org/bluez/hci0/dev_35_BD_7B_5D_CC_AE" bluez.class = "0x240404" bluez.alias = "J2-USB Bluetooth" device.icon_name = "audio-headset-bluetooth" device.intended_roles = "phone" Profiles: a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes) headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: no) off: Off (sinks: 0, sources: 0, priority: 0, available: yes) Active Profile: a2dp_sink Ports: headset-output: Headset (priority: 0, latency offset: 0 usec) Part of profile(s): a2dp_sink, headset_head_unit headset-input: Headset (priority: 0, latency offset: 0 usec, not available) Part of profile(s): headset_head_unit [email protected]:~#pacmd list-sinks 1 sink(s) available. * index: 1 name: <bluez_sink.35_BD_7B_5D_CC_AE> driver: <module-bluez5-device.c> flags: HARDWARE DECIBEL_VOLUME LATENCY state: SUSPENDED suspend cause: IDLE priority: 9030 volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB balance 0.00 base volume: 65536 / 100% / 0.00 dB volume steps: 65537 muted: no current latency: 0.00 ms max request: 2 KiB max rewind: 0 KiB monitor source: 1 sample spec: s16le 2ch 44100Hz channel map: front-left,front-right Stereo used by: 0 linked by: 0 fixed latency: 39.51 ms card: 0 <bluez_card.35_BD_7B_5D_CC_AE> module: 24 properties: bluetooth.protocol = "a2dp_sink" device.description = "J2-USB Bluetooth" device.string = "35:BD:7B:5D:CC:AE" device.api = "bluez" device.class = "sound" device.bus = "bluetooth" device.form_factor = "headset" bluez.path = "/org/bluez/hci0/dev_35_BD_7B_5D_CC_AE" bluez.class = "0x240404" bluez.alias = "J2-USB Bluetooth" device.icon_name = "audio-headset-bluetooth" device.intended_roles = "phone" ports: headset-output: Headset (priority 0, latency offset 0 usec, available: unknown) properties: active port: <headset-output> [email protected]:~#pacmd list-cards 1 card(s) available. index: 0 name: <bluez_card.35_BD_7B_5D_CC_AE> driver: <module-bluez5-device.c> owner module: 24 properties: device.description = "J2-USB Bluetooth" device.string = "35:BD:7B:5D:CC:AE" device.api = "bluez" device.class = "sound" device.bus = "bluetooth" device.form_factor = "headset" bluez.path = "/org/bluez/hci0/dev_35_BD_7B_5D_CC_AE" bluez.class = "0x240404" bluez.alias = "J2-USB Bluetooth" device.icon_name = "audio-headset-bluetooth" device.intended_roles = "phone" profiles: a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 10, available: unknown) headset_head_unit: Headset Head Unit (HSP/HFP) (priority 20, available: no) off: Off (priority 0, available: yes) active profile: <a2dp_sink> sinks: bluez_sink.35_BD_7B_5D_CC_AE/#1: J2-USB Bluetooth sources: bluez_sink.35_BD_7B_5D_CC_AE.monitor/#1: Monitor of J2-USB Bluetooth ports: headset-output: Headset (priority 0, latency offset 0 usec, available: unknown) properties: headset-input: Headset (priority 0, latency offset 0 usec, available: no) properties: [email protected]:~#pacmd set-default-sink 1 [email protected]:~#pacmd set-card-profile 0 a2dp_sink [email protected]:~#pacmd info Memory blocks currently allocated: 1, size: 64.0 KiB. Memory blocks allocated during the whole lifetime: 53616, size: 67.8 MiB. Memory blocks imported from other processes: 0, size: 0 B. Memory blocks exported to other processes: 0, size: 0 B. Total sample cache size: 0 B. Default sample spec: s16le 2ch 44100Hz Default channel map: front-left,front-right Default sink name: bluez_sink.35_BD_7B_5D_CC_AE Default source name: bluez_sink.35_BD_7B_5D_CC_AE.monitor Memory blocks of type POOL: 1 allocated/39706 accumulated. Memory blocks of type POOL_EXTERNAL: 0 allocated/0 accumulated. Memory blocks of type APPENDED: 0 allocated/0 accumulated. Memory blocks of type USER: 0 allocated/0 accumulated. Memory blocks of type FIXED: 0 allocated/0 accumulated. Memory blocks of type IMPORTED: 0 allocated/13910 accumulated. 24 module(s) loaded. index: 0 name: <module-device-restore> argument: <> used: -1 load once: yes properties: module.author = "Lennart Poettering" module.description = "Automatically restore the volume/mute state of devices" module.version = "6.0" index: 1 name: <module-stream-restore> argument: <> used: -1 load once: yes properties: module.author = "Lennart Poettering" module.description = "Automatically restore the volume/mute/device state of streams" module.version = "6.0" index: 2 name: <module-card-restore> argument: <> used: -1 load once: yes properties: module.author = "Lennart Poettering" module.description = "Automatically restore profile of cards" module.version = "6.0" index: 3 name: <module-augment-properties> argument: <> used: -1 load once: yes properties: module.author = "Lennart Poettering" module.description = "Augment the property sets of streams with additional static information" module.version = "6.0" index: 4 name: <module-switch-on-port-available> argument: <> used: -1 load once: no properties: index: 5 name: <module-udev-detect> argument: <tsched=0> used: -1 load once: yes properties: module.author = "Lennart Poettering" module.description = "Detect available audio hardware and load matching drivers" module.version = "6.0" index: 7 name: <module-bluetooth-policy> argument: <> used: -1 load once: yes properties: module.author = "Fr茅d茅ric Dalleau" module.description = "When a bluetooth sink or source is added, load module-loopback" module.version = "6.0" index: 8 name: <module-bluetooth-discover> argument: <> used: -1 load once: yes properties: module.author = "Jo茫o Paulo Rechi Vita" module.description = "Detect available Bluetooth daemon and load the corresponding discovery module" module.version = "6.0" index: 9 name: <module-bluez5-discover> argument: <> used: -1 load once: yes properties: module.author = "Jo茫o Paulo Rechi Vita" module.description = "Detect available BlueZ 5 Bluetooth audio devices and load BlueZ 5 Bluetooth audio drivers" module.version = "6.0" index: 10 name: <module-native-protocol-unix> argument: <> used: -1 load once: no properties: module.author = "Lennart Poettering" module.description = "Native protocol (UNIX sockets)" module.version = "6.0" index: 11 name: <module-default-device-restore> argument: <> used: -1 load once: yes properties: module.author = "Lennart Poettering" module.description = "Automatically restore the default sink and source" module.version = "6.0" index: 12 name: <module-rescue-streams> argument: <> used: -1 load once: yes properties: module.author = "Lennart Poettering" module.description = "When a sink/source is removed, try to move its streams to the default sink/source" module.version = "6.0" index: 13 name: <module-always-sink> argument: <> used: -1 load once: yes properties: module.author = "Colin Guthrie" module.description = "Always keeps at least one sink loaded even if it's a null one" module.version = "6.0" index: 15 name: <module-intended-roles> argument: <> used: -1 load once: yes properties: module.author = "Lennart Poettering" module.description = "Automatically set device of streams based on intended roles of devices" module.version = "6.0" index: 16 name: <module-suspend-on-idle> argument: <> used: -1 load once: yes properties: module.author = "Lennart Poettering" module.description = "When a sink/source is idle for too long, suspend it" module.version = "6.0" index: 17 name: <module-console-kit> argument: <> used: -1 load once: yes properties: module.author = "Lennart Poettering" module.description = "Create a client for each ConsoleKit session of this user" module.version = "6.0" index: 18 name: <module-position-event-sounds> argument: <> used: -1 load once: yes properties: module.author = "Lennart Poettering" module.description = "Position event sounds between L and R depending on the position on screen of the widget triggering them." module.version = "6.0" index: 19 name: <module-role-cork> argument: <> used: -1 load once: yes properties: module.author = "Lennart Poettering" module.description = "Mute & cork streams with certain roles while others exist" module.version = "6.0" index: 20 name: <module-filter-heuristics> argument: <> used: -1 load once: yes properties: module.author = "Colin Guthrie" module.description = "Detect when various filters are desirable" module.version = "6.0" index: 21 name: <module-filter-apply> argument: <> used: -1 load once: yes properties: module.author = "Colin Guthrie" module.description = "Load filter sinks automatically when needed" module.version = "6.0" index: 22 name: <module-x11-publish> argument: <display=:0> used: -1 load once: no properties: module.author = "Lennart Poettering" module.description = "X11 credential publisher" module.version = "6.0" index: 23 name: <module-x11-cork-request> argument: <display=:0> used: -1 load once: no properties: module.author = "Lennart Poettering" module.description = "Synthesize X11 media key events when cork/uncork is requested" module.version = "6.0" index: 24 name: <module-bluez5-device> argument: <path=/org/bluez/hci0/dev_35_BD_7B_5D_CC_AE> used: 0 load once: no properties: module.author = "Jo茫o Paulo Rechi Vita" module.description = "BlueZ 5 Bluetooth audio sink and source" module.version = "6.0" index: 25 name: <module-cli-protocol-unix> argument: <> used: -1 load once: no properties: module.author = "Lennart Poettering" module.description = "Command line interface protocol (UNIX sockets)" module.version = "6.0" 1 sink(s) available. * index: 1 name: <bluez_sink.35_BD_7B_5D_CC_AE> driver: <module-bluez5-device.c> flags: HARDWARE DECIBEL_VOLUME LATENCY state: SUSPENDED suspend cause: IDLE priority: 9030 volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB balance 0.00 base volume: 65536 / 100% / 0.00 dB volume steps: 65537 muted: no current latency: 0.00 ms max request: 2 KiB max rewind: 0 KiB monitor source: 1 sample spec: s16le 2ch 44100Hz channel map: front-left,front-right Stereo used by: 0 linked by: 0 fixed latency: 39.51 ms card: 0 <bluez_card.35_BD_7B_5D_CC_AE> module: 24 properties: bluetooth.protocol = "a2dp_sink" device.description = "J2-USB Bluetooth" device.string = "35:BD:7B:5D:CC:AE" device.api = "bluez" device.class = "sound" device.bus = "bluetooth" device.form_factor = "headset" bluez.path = "/org/bluez/hci0/dev_35_BD_7B_5D_CC_AE" bluez.class = "0x240404" bluez.alias = "J2-USB Bluetooth" device.icon_name = "audio-headset-bluetooth" device.intended_roles = "phone" ports: headset-output: Headset (priority 0, latency offset 0 usec, available: unknown) properties: active port: <headset-output> 1 source(s) available. * index: 1 name: <bluez_sink.35_BD_7B_5D_CC_AE.monitor> driver: <module-bluez5-device.c> flags: DECIBEL_VOLUME LATENCY state: SUSPENDED suspend cause: IDLE priority: 1030 volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB balance 0.00 base volume: 65536 / 100% / 0.00 dB volume steps: 65537 muted: no current latency: 0.00 ms max rewind: 0 KiB sample spec: s16le 2ch 44100Hz channel map: front-left,front-right Stereo used by: 0 linked by: 0 fixed latency: 39.51 ms monitor_of: 1 card: 0 <bluez_card.35_BD_7B_5D_CC_AE> module: 24 properties: device.description = "Monitor of J2-USB Bluetooth" device.class = "monitor" device.string = "35:BD:7B:5D:CC:AE" device.api = "bluez" device.bus = "bluetooth" device.form_factor = "headset" bluez.path = "/org/bluez/hci0/dev_35_BD_7B_5D_CC_AE" bluez.class = "0x240404" bluez.alias = "J2-USB Bluetooth" device.icon_name = "audio-headset-bluetooth" device.intended_roles = "phone" 1 client(s) logged in. index: 26 driver: <cli.c> owner module: 25 properties: application.name = "UNIX socket client" 1 card(s) available. index: 0 name: <bluez_card.35_BD_7B_5D_CC_AE> driver: <module-bluez5-device.c> owner module: 24 properties: device.description = "J2-USB Bluetooth" device.string = "35:BD:7B:5D:CC:AE" device.api = "bluez" device.class = "sound" device.bus = "bluetooth" device.form_factor = "headset" bluez.path = "/org/bluez/hci0/dev_35_BD_7B_5D_CC_AE" bluez.class = "0x240404" bluez.alias = "J2-USB Bluetooth" device.icon_name = "audio-headset-bluetooth" device.intended_roles = "phone" profiles: a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 10, available: unknown) headset_head_unit: Headset Head Unit (HSP/HFP) (priority 20, available: no) off: Off (priority 0, available: yes) active profile: <a2dp_sink> sinks: bluez_sink.35_BD_7B_5D_CC_AE/#1: J2-USB Bluetooth sources: bluez_sink.35_BD_7B_5D_CC_AE.monitor/#1: Monitor of J2-USB Bluetooth ports: headset-output: Headset (priority 0, latency offset 0 usec, available: unknown) properties: headset-input: Headset (priority 0, latency offset 0 usec, available: no) properties: 0 sink input(s) available. 0 source output(s) available. 0 cache entrie(s) available. [email protected]:~#pacmd stat Memory blocks currently allocated: 1, size: 64.0 KiB. Memory blocks allocated during the whole lifetime: 53616, size: 67.8 MiB. Memory blocks imported from other processes: 0, size: 0 B. Memory blocks exported to other processes: 0, size: 0 B. Total sample cache size: 0 B. Default sample spec: s16le 2ch 44100Hz Default channel map: front-left,front-right Default sink name: bluez_sink.35_BD_7B_5D_CC_AE Default source name: bluez_sink.35_BD_7B_5D_CC_AE.monitor Memory blocks of type POOL: 1 allocated/39706 accumulated. Memory blocks of type POOL_EXTERNAL: 0 allocated/0 accumulated. Memory blocks of type APPENDED: 0 allocated/0 accumulated. Memory blocks of type USER: 0 allocated/0 accumulated. Memory blocks of type FIXED: 0 allocated/0 accumulated. Memory blocks of type IMPORTED: 0 allocated/13910 accumulated. 5.2 多音效卡裝置配置 [email protected]:~# pacmd set-card-profile 1 a2dp_sink [email protected]:~# pactl list sinks Sink #0 State: SUSPENDED Name: alsa_output.platform-sound.20.analog-stereo Description: wm8962-audio Analog Stereo Driver: module-alsa-card.c Sample Specification: s16le 2ch 44100Hz Channel Map: front-left,front-right Owner Module: 7 Mute: no Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB balance 0.00 Base Volume: 65536 / 100% / 0.00 dB Monitor Source: alsa_output.platform-sound.20.analog-stereo.monitor Latency: 0 usec, configured 0 usec Flags: HARDWARE DECIBEL_VOLUME LATENCY Properties: alsa.resolution_bits = "16" device.api = "alsa" device.class = "sound" alsa.class = "generic" alsa.subclass = "generic-mix" alsa.name = "" alsa.id = "HiFi wm8962-0" alsa.subdevice = "0" alsa.subdevice_name = "subdevice #0" alsa.device = "0" alsa.card = "0" alsa.card_name = "wm8962-audio" alsa.long_card_name = "wm8962-audio" device.bus_path = "platform-sound.20" sysfs.path = "/devices/soc0/sound.20/sound/card0" device.string = "hw:0" device.buffering.buffer_size = "17632" device.buffering.fragment_size = "4408" device.access_mode = "mmap" device.profile.name = "analog-stereo" device.profile.description = "Analog Stereo" device.description = "wm8962-audio Analog Stereo" module-udev-detect.discovered = "1" device.icon_name = "audio-card" Ports: analog-output-speaker: Speakers (priority: 10000, not available) analog-output-headphones: Headphones (priority: 9000, available) Active Port: analog-output-headphones Formats: pcm Sink #1 State: SUSPENDED Name: bluez_sink.35_BD_7B_5D_CC_AE Description: J2-USB Bluetooth Driver: module-bluez5-device.c Sample Specification: s16le 2ch 44100Hz Channel Map: front-left,front-right Owner Module: 24 Mute: no Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB balance 0.00 Base Volume: 65536 / 100% / 0.00 dB Monitor Source: bluez_sink.35_BD_7B_5D_CC_AE.monitor Latency: 0 usec, configured 0 usec Flags: HARDWARE DECIBEL_VOLUME LATENCY Properties: bluetooth.protocol = "a2dp_sink" device.description = "J2-USB Bluetooth" device.string = "35:BD:7B:5D:CC:AE" device.api = "bluez" device.class = "sound" device.bus = "bluetooth" device.form_factor = "headset" bluez.path = "/org/bluez/hci0/dev_35_BD_7B_5D_CC_AE" bluez.class = "0x240404" bluez.alias = "J2-USB Bluetooth" device.icon_name = "audio-headset-bluetooth" device.intended_roles = "phone" Ports: headset-output: Headset (priority: 0) Active Port: headset-output Formats: pcm [email protected]:~# pacmd set-default-sink 1 [email protected]:~# pactl list sources Source #0 State: SUSPENDED Name: alsa_output.platform-sound.20.analog-stereo.monitor Description: Monitor of wm8962-audio Analog Stereo Driver: module-alsa-card.c Sample Specification: s16le 2ch 44100Hz Channel Map: front-left,front-right Owner Module: 7 Mute: no Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB balance 0.00 Base Volume: 65536 / 100% / 0.00 dB Monitor of Sink: alsa_output.platform-sound.20.analog-stereo Latency: 0 usec, configured 0 usec Flags: DECIBEL_VOLUME LATENCY Properties: device.description = "Monitor of wm8962-audio Analog Stereo" device.class = "monitor" alsa.card = "0" alsa.card_name = "wm8962-audio" alsa.long_card_name = "wm8962-audio" device.bus_path = "platform-sound.20" sysfs.path = "/devices/soc0/sound.20/sound/card0" device.string = "0" module-udev-detect.discovered = "1" device.icon_name = "audio-card" Formats: pcm Source #1 State: SUSPENDED Name: alsa_input.platform-sound.20.analog-stereo Description: wm8962-audio Analog Stereo Driver: module-alsa-card.c Sample Specification: s16le 2ch 44100Hz Channel Map: front-left,front-right Owner Module: 7 Mute: no Volume: front-left: 33804 / 52% / -17.25 dB, front-right: 33804 / 52% / -17.25 dB balance 0.00 Base Volume: