Find the answer to your Linux question:
Results 1 to 2 of 2
I am struggling to find some area of code in the kernel that gets executed while audio is playing. My current goal is to be able to find the actual ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2013
    Posts
    3

    Sound / Audio Entry Point


    I am struggling to find some area of code in the kernel that gets executed while audio is playing. My current goal is to be able to find the actual audio data in the kernel and print some of it out to make sure I can actually see audio bytes going through the kernel. Do you know of anywhere in the code that I could insert a printk() and see some data? If not, do you know of any entry point in the kernel sound code that gets executed every time audio gets played?

    I would appreciate information about any version of the kernel that you are familiar with, but I am currently using version 2.6.32.5.

    I have tried putting printk()s in sound/core/pcm_lib.c in functions like snd_pcm_lib_write_transfer. When playing audio, none of those messages show up, so I'm not really sure where else to look at this point.

    Any help is greatly appreciated.

  2. #2
    Just Joined!
    Join Date
    Mar 2009
    Location
    Norway
    Posts
    67
    Quote Originally Posted by lesnaubr View Post
    I am struggling to find some area of code in the kernel that gets executed while audio is playing. My current goal is to be able to find the actual audio data in the kernel and print some of it out to make sure I can actually see audio bytes going through the kernel. Do you know of anywhere in the code that I could insert a printk() and see some data? If not, do you know of any entry point in the kernel sound code that gets executed every time audio gets played?
    A good place to start (you need to understand how the drivers are bolted together, ALSA is a big machinery, you don't make a simple, standalone driver. What you do, is providing ALSA with a set of required functions and then the main core of the sound system will call those as needed.

    I'd start by reading a bit at alsa-project

    As a quick tip, since you are not writing a _new_ PCI driver yourself, you can skip directly to the PCM-part (which is raw, uncompressed sound that is passed to the sound card).

    Quote Originally Posted by lesnaubr View Post

    I would appreciate information about any version of the kernel that you are familiar with, but I am currently using version 2.6.32.5.

    I have tried putting printk()s in sound/core/pcm_lib.c in functions like snd_pcm_lib_write_transfer. When playing audio, none of those messages show up, so I'm not really sure where else to look at this point.
    How much data does your application pass to ALSA in one go? You have this thing called "buffering" you know

    Try writing a short client yourself, and I say this for several reasons:

    • you have absolute control over the client part (mplayer and friends does a _lot_ of magic stuff)
    • you can fine-tune the framesizes
    • you will learn how sound is being fed through both the userspace-library and into the kernel



    Quote Originally Posted by lesnaubr View Post
    Any help is greatly appreciated.
    Good luck!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •