[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Protux-devel] snd_pcm_hw_params_set_format returns: invalid format
From: |
Remon Sijrier |
Subject: |
Re: [Protux-devel] snd_pcm_hw_params_set_format returns: invalid format |
Date: |
Fri, 6 Jun 2003 00:09:41 +0200 |
User-agent: |
KMail/1.5.1 |
Thanks for the answer.
But no it's not an update problem. I changed it by myself after I detected
that I only can set the parametervalues my sound card supports.
And the ouput says: 10 channels and 32 bit.
I'm looking right now at JACK, but find it very hard to get a clue of the
code. Found a piece of code which may be interesting though. Changed it to
fit into MADM:
// set the sample format
// SHOULD CHECK THE BITDEPTH HERE....
if ((r = snd_pcm_hw_params_set_format (pcmHandle, hwparams,
SND_PCM_FORMAT_S32)) < 0) {
if ((r = snd_pcm_hw_params_set_format (pcmHandle, hwparams,
SND_PCM_FORMAT_S16)) < 0){
PERROR("Invalid sample format to bus %s :
%s",cBusFullReference,snd_strerror(r));
goto ALSA_ERROR_AFTER_OPEN_AND_HWPARAMS_ALLOCATION;
}
}
this solved the bits problem. ALSA itself is capable of converting it? I read
it somewhere that the ALSA driver automaticaly converts the given format if
it doesn't fit.
And this is I nice way of detecting the available channels on the sound card
:)
// detect available channels. Maybe detect some upper limit?? say >
1024 is to much :)
*nchns = snd_pcm_hw_params_get_channels_max (hwparams);
PMESG("detected number of channels = %d", *nchns);
if (*nchns > 1024)
{
PERROR("You appear to be using the ALSA software \"plug\"
layer, probably\n"
"a result of using the \"default\" ALSA device.
This is less\n"
"efficient than it could be. Consider using a
~/.asoundrc file\n"
"to define a hardware audio device rather than
using the plug layer\n"
"setting it to a sane default (10 in this case,
other setting gives\n"
"a segfault :( )\n")
*nchns = 2;
}
r = snd_pcm_hw_params_set_channels(pcmHandle, hwparams, *nchns);
if (r < 0)
{
PERROR("Invalid number of channels (%d) to bus %s :
%s",cBusFullReference, channels, snd_strerror(r));
goto ALSA_ERROR_AFTER_OPEN_AND_HWPARAMS_ALLOCATION;
}
Op donderdag 5 juni 2003 23:49, schreef Luciano Giordana:
> Are you sure this code is from current CVS ?
>
> > Also the setting of the channels isn't working:
> >
> > // set the count of channels
> > r = snd_pcm_hw_params_set_channels(pcmHandle, hwparams, 10);
> > if (r < 0)
>
> I checkd it on my current CVS snapshot, and it is
>
> // set the count of channels
> r = snd_pcm_hw_params_set_channels(pcmHandle, hwparams, channels);
> if (r < 0)
>
> maybe just an update problem?
>
> anyway, I am adding a way to easy change the format, by modifying the API.
> might be available on next releases ( 0.17.6 or 0.17.7 )
>
> Thanks
- [Protux-devel] --enable-debug seems not to be working, Luciano Giordana, 2003/06/04
- Re: [Protux-devel] --enable-debug seems not to be working, Martin Herren, 2003/06/04
- Re: [Protux-devel] --enable-debug seems not to be working, Luciano Giordana, 2003/06/04
- [Protux-devel] snd_pcm_hw_params_set_format returns: invalid format, Remon Sijrier, 2003/06/05
- Re: [Protux-devel] snd_pcm_hw_params_set_format returns: invalid format, Luciano Giordana, 2003/06/05
- Re: [Protux-devel] snd_pcm_hw_params_set_format returns: invalid format, Luciano Giordana, 2003/06/05
- Re: [Protux-devel] snd_pcm_hw_params_set_format returns: invalid format,
Remon Sijrier <=
- Re: [Protux-devel] snd_pcm_hw_params_set_format returns: invalid format, Remon Sijrier, 2003/06/06
- Re: [Protux-devel] snd_pcm_hw_params_set_format returns: invalid format, rsff, 2003/06/06
- Re: [Protux-devel] snd_pcm_hw_params_set_format returns: invalid format, Luciano Giordana, 2003/06/06