Audio Driver ==================== .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow Topics in this section, * :ref:`Learnings in this section ` * :ref:`Terminology ` * :ref:`Version Info ` * :ref:`Architecure ` * :ref:`HW ` * :ref:`SW ` * :ref:`Applications & Libraries ` * :ref:`Features ` * :ref:`Kernel & Driver modules ` * :ref:`List of driver modules ` * :ref:`Use case ` * :ref:`Driver Development ` * :ref:`Custom build of driver modules ` * :ref:`Load custom built driver modules ` * :ref:`Init path ` * :ref:`Control path ` * :ref:`Data path ` * :ref:`Contexts ` * :ref:`Threads ` * :ref:`Timers ` * :ref:`Interrupts ` * :ref:`Data Structures ` * :ref:`FAQs ` * :ref:`Reference links ` .. _FreebsdDeviceDriver_audio_driver_step1: .. tab-set:: .. tab-item:: Learnings in this section * In this section, you are going to learn .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * Audio driver .. _FreebsdDeviceDriver_audio_driver_step2: .. tab-set:: .. tab-item:: Terminology * Terminology .. _FreebsdDeviceDriver_audio_driver_step3: .. tab-set:: .. tab-item:: Version Info =============================== ======================================= # Version =============================== ======================================= Freebsd 14.1.0 =============================== ======================================= .. _FreebsdDeviceDriver_audio_driver_step4: .. tab-set:: .. tab-item:: Architecture * Architecture .. _FreebsdDeviceDriver_audio_driver_step5: .. tab-set:: .. tab-item:: HW .. code-block:: c test:~$ dmesg | grep pcm .. _FreebsdDeviceDriver_audio_driver_step6: .. tab-set:: .. tab-item:: SW .. _FreebsdDeviceDriver_audio_driver_step7: .. tab-set:: .. tab-item:: Applications & Libraries .. tab-set:: .. tab-item:: CLI Based * Utilities - mixer * Source Path - /usr/src/usr.sbin/mixer .. tab-set:: .. tab-item:: GUI Based * Utilities - dsbmixer * Source Path - /usr/ports/audio/dsbmixer/ .. _FreebsdDeviceDriver_audio_driver_step8: .. tab-set:: .. tab-item:: Features * Before checking audio feature go through the reference link at the end * Default pcm0 device selected by a audio driver, user can switch the device by running the below comments .. code-block:: c test:~$ mixer -d pcm* .. tab-set:: .. tab-item:: Equalization setting * Enable the equalization on sound system, add the below line in the configuration file .. code-block:: c test:~$ vim /boot/loader.conf hint.pcm.0.eq=1 ` * Note: Default 0 is setted to equalizer, after adding below line reboot the system. Base & treble controls added to the sound device * Example : .. code-block:: c test:~$ mixer pcm0:mixer: on hdaa0 (play/rec) (default) vol = 0.53:0.53 pbk bass = 0.50:0.50 pbk treble = 0.50:0.50 pbk pcm = 1.00:1.00 pbk speaker = 1.00:1.00 pbk mic = 0.00:0.00 rec rec = 0.01:0.01 pbk monitor = 0.42:0.42 rec src .. tab-set:: .. tab-item:: Low latency setting * Default value is 2, based on requirement adjust the latency value . Support (0-10) .. code-block:: c test:~$ sysctl hw.snd.latency=0 * Profile is optimized for the lowest possible latency. Support (0, 1) .. code-block:: c test:~$ sysctl hw.snd.latency_profile=0 .. tab-set:: .. tab-item:: To Adjust the Volume * min 0 to max 100 can set on device * For a same user can set other feature level of the deivce using "rec", "mic", "speaker". .. code-block:: c test:~$ mixer vol=+5% pcm0:mixer: on hdaa0 (play/rec) (default) vol = 0.58:0.58 pbk pcm = 1.00:1.00 pbk speaker = 1.00:1.00 pbk mic = 0.00:0.00 rec rec = 0.01:0.01 pbk monitor = 0.42:0.42 rec src .. tab-set:: .. tab-item:: To Record Audio .. code-block:: c test:~$ ffmpeg -f oss -i /dev/dsp0 output.wav .. _FreebsdDeviceDriver_audio_driver_step9: .. tab-set:: .. tab-item:: Kernel & Driver modules .. _FreebsdDeviceDriver_audio_driver_step10: .. tab-set:: .. tab-item:: List of driver modules .. tab-set:: .. tab-item:: 1. sound.ko .. csv-table:: :file: ./sound_ko.csv :widths: 50, 50 .. tab-set:: .. tab-item:: 2. snd_hda.ko .. csv-table:: :file: ./snd_hda_ko.csv :widths: 50, 50 .. _FreebsdDeviceDriver_audio_driver_step11: .. tab-set:: .. tab-item:: Use case .. code-block:: test:~$ .. _FreebsdDeviceDriver_audio_driver_step12: .. tab-set:: .. tab-item:: Driver Development .. _FreebsdDeviceDriver_audio_driver_step13: .. tab-set:: .. tab-item:: Custom build of driver modules * Source path : /usr/src/sys/dev/sound/ * /usr/src/sys/dev/sound/pci/hda --> add the source code changes in this directory * Compile path : /usr/src/sys/modules/sound --> compile source makefile path .. code-block:: c test:~$ make * Source path : /usr/src/sys/dev/sound/ * /usr/src/sys/dev/sound/pci/hda --> add the source code changes in this directory * Compile path : /usr/src/sys/modules/sound --> compile source makefile path .. code-block:: c test:~$ make * Binary file: /usr/obj/usr/src/amd64.amd64/sys/modules/sound/sound .. _FreebsdDeviceDriver_audio_driver_step14: .. tab-set:: .. tab-item:: Load custom built driver modules * Run the make install command, it will copy the compiled module into /boot/modules directory .. code-block:: c test:~$ cd /usr/obj/usr/src/amd64.amd64/sys/modules/sound/sound/ test:~$ kldload sound.ko test:~$ cd /usr/obj/usr/src/amd64.amd64/sys/modules/sound/driver/hda/ test:~$ kldload snd_hda.ko .. _FreebsdDeviceDriver_audio_driver_step15: .. tab-set:: .. tab-item:: Init path .. code-block:: test:~$ .. _FreebsdDeviceDriver_audio_driver_step16: .. tab-set:: .. tab-item:: Control path .. code-block:: test:~$ .. _FreebsdDeviceDriver_audio_driver_step17: .. tab-set:: .. tab-item:: Data path .. code-block:: test:~$ .. _FreebsdDeviceDriver_audio_driver_step18: .. tab-set:: .. tab-item:: Contexts .. code-block:: test:~$ .. _FreebsdDeviceDriver_audio_driver_step19: .. tab-set:: .. tab-item:: Threads .. code-block:: test:~$ .. _FreebsdDeviceDriver_audio_driver_step20: .. tab-set:: .. tab-item:: Timers .. code-block:: test:~$ .. _FreebsdDeviceDriver_audio_driver_step21: .. tab-set:: .. tab-item:: Interrupts .. code-block:: test:~$ .. _FreebsdDeviceDriver_audio_driver_step22: .. tab-set:: .. tab-item:: Data Structures .. code-block:: test:~$ .. _FreebsdDeviceDriver_audio_driver_step23: .. tab-set:: .. tab-item:: FAQs .. code-block:: c test:~$ .. _FreebsdDeviceDriver_audio_driver_step24: .. tab-set:: .. tab-item:: Reference links * `Sound & Audio `_ * `FreeBSD Manual Page : Sound `_ * `Sound Subsystem `_