Linux woes - selecting correct device

I am trying to get FMOD (low level API) working on Ubuntu 13.04. All other applications use my default settings and play appropriately, but FMOD seems to be choosing my HDMI output as the default device. I can manually switch to the Built-In Analog device with FMOD, and everything works fine when I do that (using the “multiple systems” example code). But how is FMOD getting a different default device than every other application?

The HDMI Audio device is, in fact, the first one that comes up on any list of my devices (pacmd, etc.) but it’s strange that all other audio applications don’t exhibit the same behavior as FMOD.

EDIT:
pacmd list-sinks

>>> 2 sink(s) available.
    index: 0
	name: <alsa_output.pci-0000_01_00.1.hdmi-stereo>
	driver: <module-alsa-card.c>
	flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE 
	priority: 9050
	volume: 0: 100% 1: 100%
	        0: 0.00 dB 1: 0.00 dB
	        balance 0.00
	base volume: 100%
	             0.00 dB
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max request: 0 KiB
	max rewind: 0 KiB
	monitor source: 0
	sample spec: s16le 2ch 48000Hz
	channel map: front-left,front-right
	             Stereo
	used by: 0
	linked by: 0
	configured latency: 0.00 ms; range is 0.50 .. 341.33 ms
	card: 0 <alsa_card.pci-0000_01_00.1>
	module: 5
	properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "HDMI 0"
		alsa.id = "HDMI 0"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "3"
		alsa.card = "1"
		alsa.card_name = "HDA ATI HDMI"
		alsa.long_card_name = "HDA ATI HDMI at 0xcfeec000 irq 49"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:01:00.1"
		sysfs.path = "/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1"
		device.bus = "pci"
		device.vendor.id = "1002"
		device.vendor.name = "Advanced Micro Devices, Inc. [AMD/ATI]"
		device.product.id = "aa20"
		device.product.name = "RV635 HDMI Audio [Radeon HD 3600 Series]"
		device.string = "hdmi:1"
		device.buffering.buffer_size = "65536"
		device.buffering.fragment_size = "32768"
		device.access_mode = "mmap+timer"
		device.profile.name = "hdmi-stereo"
		device.profile.description = "Digital Stereo (HDMI)"
		device.description = "RV635 HDMI Audio [Radeon HD 3600 Series] Digital Stereo (HDMI)"
		alsa.mixer_name = "ATI R6xx HDMI"
		alsa.components = "HDA:1002aa01,00aa0100,00100000"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	ports:
		hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: no)
			properties:
				device.icon_name = "video-display"
	active port: <hdmi-output-0>
  * index: 1
	name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
	driver: <module-alsa-card.c>
	flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE 
	priority: 9959
	volume: 0:  81% 1:  81%
	        0: -5.42 dB 1: -5.42 dB
	        balance 0.00
	base volume: 100%
	             0.00 dB
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max request: 0 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
	configured latency: 0.00 ms; range is 0.50 .. 371.52 ms
	card: 1 <alsa_card.pci-0000_00_1b.0>
	module: 6
	properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "92HD73C1X5 Analog"
		alsa.id = "92HD73C1X5 Analog"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "0"
		alsa.card = "0"
		alsa.card_name = "HDA Intel"
		alsa.long_card_name = "HDA Intel at 0xfc400000 irq 47"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:00:1b.0"
		sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
		device.bus = "pci"
		device.vendor.id = "8086"
		device.vendor.name = "Intel Corporation"
		device.product.id = "293e"
		device.product.name = "82801I (ICH9 Family) HD Audio Controller"
		device.form_factor = "internal"
		device.string = "front:0"
		device.buffering.buffer_size = "65536"
		device.buffering.fragment_size = "32768"
		device.access_mode = "mmap+timer"
		device.profile.name = "analog-stereo"
		device.profile.description = "Analog Stereo"
		device.description = "Built-in Audio Analog Stereo"
		alsa.mixer_name = "IDT 92HD73C1X5"
		alsa.components = "HDA:111d7675,10280272,00100103"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	ports:
		analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: unknown)
			properties:
				device.icon_name = "audio-speakers"
		analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: unknown)
			properties:
				device.icon_name = "audio-headphones"
	active port: <analog-output-headphones>

Log output:

[LOG] SystemI::init                            : FMOD Studio Version: 00010503 (59123)
[LOG] SystemI::init                            : maxchannels = 32, flags = 00000000, extradriverdata = (nil)
[LOG] SystemI::close                           : 
[LOG] SystemI::close                           : Stop all sounds
[LOG] SystemI::close                           : Remove miscllaneous DSP stuff.
[LOG] SystemI::close                           : done.

[LOG] SystemI::init                            : Set up software engine
[LOG] OutputPulseAudio::registerLib            : Loaded PulseAudio version 4.0.0.
[LOG] OutputPulseAudio::enumOutput             : Found output device NAME:alsa_output.pci-0000_01_00.1.hdmi-stereo DESC:RV635 HDMI Audio [Radeon HD 3600 Series] Digital Stereo (HDMI) CHANNELS:2 RATE:48000.
[LOG] OutputPulseAudio::enumOutput             : Found output device NAME:alsa_output.pci-0000_00_1b.0.analog-stereo DESC:Built-in Audio Analog Stereo CHANNELS:2 RATE:44100.
[LOG] OutputPulseAudio::enumInput              : Found input device NAME:alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor DESC:Monitor of RV635 HDMI Audio [Radeon HD 3600 Series] Digital Stereo (HDMI) CHANNELS:2 RATE:48000.
[LOG] OutputPulseAudio::enumInput              : Found input device NAME:alsa_output.pci-0000_00_1b.0.analog-stereo.monitor DESC:Monitor of Built-in Audio Analog Stereo CHANNELS:2 RATE:44100.
[LOG] OutputPulseAudio::enumInput              : Found input device NAME:alsa_input.pci-0000_00_1b.0.analog-stereo DESC:Built-in Audio Analog Stereo CHANNELS:2 RATE:44100.
[WRN] FMOD_OS_CriticalSection_Enter            : cannot enter NULL critical section
[WRN] FMOD_OS_CriticalSection_Leave            : cannot leave NULL critical section
[LOG] Thread::initThread                       : Initializing FMOD mixer thread.  priority 3
[LOG] Thread::initThread                       : - Stacksize 49152.  Stack pointer (nil) : usesemaphore = 1 : sleeptime = 0
[WRN] FMOD_OS_Thread_Create                    : Cannot set real-time thread priorities due to insufficient privileges
[LOG] Thread::callback                         : * FMOD mixer thread started
[LOG] Thread::initThread                       : done.
[LOG] SystemI::init                            : Set up emulated output
[LOG] SystemI::init                            : create the channel pool
[LOG] SystemI::init                            : Set up streamer
[LOG] Thread::initThread                       : Initializing FMOD stream thread.  priority 2
[LOG] Thread::initThread                       : - Stacksize 65536.  Stack pointer (nil) : usesemaphore = 0 : sleeptime = 10
[WRN] FMOD_OS_Thread_Create                    : Cannot set real-time thread priorities due to insufficient privileges
[LOG] Thread::callback                         : * FMOD stream thread started
[LOG] Thread::initThread                       : done.
[LOG] SystemI::init                            : done

[LOG] SystemI::createSoundInternal             : filename = /home/alex/Downloads/fmodstudioapi10503linux/api/lowlevel/examples/make/../media/drumloop.wav : mode 00000000
[LOG] SystemI::createSoundInternal             : 16 codecs found.  Scan all until one succeeds
[LOG] SystemI::createSoundInternal             : Scan for tags.
[LOG] CodecTag::openInternal                   : attempting to open ID3 or ASF tags..
[LOG] Codec::release                           : 
[LOG] Codec::release                           : done
[LOG] CodecWav::openInternal                   : attempting to open as WAV..
[LOG] CodecWav::parseRIFF                      : chunk : id fmt  size 16
[LOG] CodecWav::parseRIFF                      : offset = 28 / 84420
[LOG] CodecWav::parseRIFF                      : chunk : id data size 84316
[LOG] CodecWav::parseRIFF                      : offset = 84352 / 84420
[LOG] CodecWav::parseRIFF                      : chunk : id smpl size 60
[LOG] CodecWav::parseRIFF                      : offset = 84420 / 84420
[LOG] CodecWav::openInternal                   : mSrcFormat->wFormatTag = 1
[LOG] CodecWav::openInternal                   : mSrcFormat->nChannels = 1
[LOG] CodecWav::openInternal                   : mSrcFormat->nSamplesPerSec = 44100
[LOG] CodecWav::openInternal                   : mSrcFormat->nAvgBytesPerSec = 88200
[LOG] CodecWav::openInternal                   : mSrcFormat->nBlockAlign = 2
[LOG] CodecWav::openInternal                   : mSrcFormat->wBitsPerSample = 16
[LOG] CodecWav::openInternal                   : mSrcFormat->cbSize = 0
[LOG] SystemI::createSoundInternal             : Format has 0 subsounds.
[LOG] SystemI::createSoundInternal             : Create as FMOD_CREATESAMPLE
[LOG] SystemI::createSoundInternal             : creating subsound 0/0
[LOG] SystemI::createSample                    : mode 00000000 length 42158 samples, lengthbytes 84316
[LOG] SystemI::createSample                    : subsamples = 1, channels = 1
[LOG] SystemI::createSample                    : subsample 0.  output = 0x166fd18
[LOG] SystemI::createSample                    : mSoftware = 0x166fd18
[LOG] OutputSoftware::createSample             : lengthpcm 42158, lengthbytes 84316, channels 1, format 2, freq 44100, mode 0000000a
[LOG] OutputSoftware::createSample             : done
[LOG] SystemI::createSample                    : done
[LOG] SystemI::createSoundInternal             : No name found in file, use filename.
[LOG] SystemI::createSoundInternal             : done.  OpenState now = FMOD_OPENSTATE_READY.

[LOG] SystemI::createSoundInternal             : filename = /home/alex/Downloads/fmodstudioapi10503linux/api/lowlevel/examples/make/../media/jaguar.wav : mode 00000000
[LOG] SystemI::createSoundInternal             : 16 codecs found.  Scan all until one succeeds
[LOG] SystemI::createSoundInternal             : Scan for tags.
[LOG] CodecTag::openInternal                   : attempting to open ID3 or ASF tags..
[LOG] Codec::release                           : 
[LOG] Codec::release                           : done
[LOG] CodecWav::openInternal                   : attempting to open as WAV..
[LOG] CodecWav::parseRIFF                      : chunk : id fmt  size 16
[LOG] CodecWav::parseRIFF                      : offset = 28 / 77860
[LOG] CodecWav::parseRIFF                      : chunk : id data size 77824
[LOG] CodecWav::parseRIFF                      : offset = 77860 / 77860
[LOG] CodecWav::openInternal                   : mSrcFormat->wFormatTag = 1
[LOG] CodecWav::openInternal                   : mSrcFormat->nChannels = 1
[LOG] CodecWav::openInternal                   : mSrcFormat->nSamplesPerSec = 22050
[LOG] CodecWav::openInternal                   : mSrcFormat->nAvgBytesPerSec = 44100
[LOG] CodecWav::openInternal                   : mSrcFormat->nBlockAlign = 2
[LOG] CodecWav::openInternal                   : mSrcFormat->wBitsPerSample = 16
==================================================
Play Sound Example.
Copyright (c) Firelight Technologies 2004-2014.
==================================================

Press 1 to play a mono sound (drumloop)
Press 2 to play a mono sound (jaguar)
Press 3 to play a stereo sound (swish)
Press Q to quit

Time 00:00:00/00:00:00 : Stopped
Channels Playing 0
[LOG] SoundI::release                          : drumloop.wav (0x16b0908)
[LOG] SoundI::release                          : release codec. (0x16b0908)
[LOG] Codec::release                           : 
[LOG] Codec::release                           : done
[LOG] SoundI::release                          : free this. (0x16b0908)
[LOG] SoundI::release                          : done (0x16b0908)
[LOG] SoundI::release                          : jaguar.wav (0x16c5b08)
[LOG] SoundI::release                          : release codec. (0x16c5b08)
[LOG] Codec::release                           : 
[LOG] Codec::release                           : done
[LOG] SoundI::release                          : free this. (0x16c5b08)
[LOG] SoundI::release                          : done (0x16c5b08)
[LOG] SoundI::release                          : swish.wav (0x16da6b8)
[LOG] SoundI::release                          : release codec. (0x16da6b8)
[LOG] Codec::release                           : 
[LOG] CodecWAV::release                        : Free PCM Buffer
[LOG] Codec::release                           : done
[LOG] SoundI::release                          : free this. (0x16da6b8)
[LOG] SoundI::release                          : done (0x16da6b8)
[LOG] SystemI::close                           : 
[LOG] SystemI::close                           : Stop all sounds
[LOG] Thread::callback                         : * FMOD stream thread finished
[LOG] Thread::close                            : FMOD stream thread thread destroyed
[LOG] SystemI::close                           : Stream thread destroyed
[LOG] SystemI::close                           : Shut down output.
[LOG] Thread::callback                         : * FMOD mixer thread finished
[LOG] Thread::close                            : FMOD mixer thread thread destroyed
[LOG] SystemI::close                           : Free master channel group.
[LOG] SystemI::close                           : Remove 'master' sound group.
[LOG] SystemI::close                           : Free software output.
[LOG] SystemI::close                           : Free emulated output.
[LOG] SystemI::close                           : Free channel pool.
[LOG] SystemI::close                           : Remove miscllaneous DSP stuff.
[LOG] Global::decRef                           : Shut down streamer and FMOD_NONBLOCKING and FileSystem thread.
[LOG] Global::decRef                           : Shut down file system.
[LOG] SystemI::close                           : done.

It looks like FMOD is assuming that the PulseAudio API will return the default device first, which I believe is not the case for you. Can you provide the output from the following:

pacmd list-sinks

Also the TTY output from the logging version of FMOD.

If the output is as I expect, this will need a code patch on our side to fix.

Thanks for the response. I added the info to the original question.

Thanks for the info, the output is as I expected. I will need to fix this for a coming release. I’ll update this post when the work is complete.

The work is now complete, this fix is scheduled for release this week.

Thank you Mathew!

Please help. Unity engine has no sound. The sound is routed to the HDMI port. Linux. ScreenShot

Tell me can I fix it somehow. Thank you.

Hi,

I’ve responded to your issue in the separate thread you posted: Unity3D 2022 - Linux PopOs Not Sound Play - #2 by Louis_FMOD