Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6186921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:58:19+00:00 2026-05-24T01:58:19+00:00

I use ALSA to play PCM samples. I open the PCM stream with this

  • 0

I use ALSA to play PCM samples. I open the PCM stream with this function:

int snd_pcm_open(snd_pcm_t** pcmp,
        const char* name,
        snd_pcm_stream_t stream,
        int mode);

I’m currently using “default” as the name parameter. I would like to be able to choose other devices. What I cannot understand is how I can determine what are the names of the other available devices.

I attached a USB microphone to my system and aplay and amixer seems to detect the new device. How do I determine the name of that device? Is there any ALSA function to get a list of available devices with their respective names?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:58:20+00:00Added an answer on May 24, 2026 at 1:58 am

    I think you can use snd_device_name_hint for enumerating devices.
    Here is an example. Beware that I haven’t compiled it !

    char **hints;
    /* Enumerate sound devices */
    int err = snd_device_name_hint(-1, "pcm", (void***)&hints);
    if (err != 0)
       return;//Error! Just return
    
    char** n = hints;
    while (*n != NULL) {
    
        char *name = snd_device_name_get_hint(*n, "NAME");
    
        if (name != NULL && 0 != strcmp("null", name)) {
            //Copy name to another buffer and then free it
            free(name);
        }
        n++;
    }//End of while
    
    //Free hint buffer too
    snd_device_name_free_hint((void**)hints);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to be able to set the volume of my ALSA stream (snd_pcm_t
use this website a lot but first time posting. My program creates a number
use strict; use warnings; open(FILE1, /cygdrive/c/cpros/mola.txt); my $line = <FILE1>; print $line; close(FILE1); open(FILE1,
use strict; use warnings; open(FILE1,/cygdrive/c/cpros/karthik/molk.txt); my $line = < FILE1 > ; print $line
I cannot use alsa as a normal user (resulting in me not having sound
Use trap to capture signals like this: i=-1;while((++i<33)); do trap echo $i >> log.txt
I want to playback some audio data using ALSA to a PCM device. As
Use case: -Visual Studio is open -Master branch is clean (confirmed with git status)
Use case is this: I want to unit test (in browser, QUnit or something
Use of function calls in where clause of stored procedure slows down performance in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.