> > Please give more information. I have a Audiotrak Maya EX7 (USB)
> > (8 channels) and would love to use it as 2 (or 3 or 4) stereo devices.
Clemens, I followed your advice and wrote the following .asoundrc.
The device pcm.main works with aplay, alsaplayer and xmms (without
the mmap option) but it doesn't work with libao2 version 0.8.4-1.1
(Debian). Attempts to send sound to the device just hang (please see
below).
One problem that I have with this setup is that if I connect mplayer
to pcm.main then plug resamples to 44100Hz even if, for example, I am
playing a 32000Hz sample that my hardware can play directly. This almost
doubles the CPU used by mplayer. I guess that there is no way around
this (which is why I still have pcm.mplayer). (I chose 44100Hz as the
default because I normally play MP3s.)
pcm_slave.ex7 {
pcm "hw:0"
channels 8
rate 44100
buffer_size 4096
period_size 2048
}
pcm.ch12 {
type dshare
ipc_key 1234321
slave ex7
bindings.0 0
bindings.1 1
}
pcm.ch34 {
type dshare
ipc_key 1234321
slave ex7
bindings.0 2
bindings.1 3
}
pcm.phones {
type plug
slave.pcm ch12
}
pcm.main {
type plug
slave.pcm ch34
}
pcm.!default {
type plug
slave.pcm ch34
}
pcm.mplayer{
type plug
slave {
pcm {
type hw
card 0
}
}
ttable
{
0 { 2 1 }
1 { 3 1 }
}
}
Why doesn't libao work with pcm.main or pcm.phones? It works
fine with pcm.mplayer. Here is my little test program:
#include <stdio.h>
#include <ao/ao.h>
#include <math.h>
#include <assert.h>
int main(int argc, char **argv)
{
ao_device *device;
ao_sample_format format;
int default_driver;
char *buffer;
int buf_size;
int sample;
float freq = 440.0;
ao_option * options = 0;
int i;
ao_info * info;
ao_initialize();
default_driver = ao_driver_id("alsa09");
info = ao_driver_info(default_driver);
printf("short_name=%s", info->short_name);
for (i = 0; i < info->option_count; i++)
printf(" %s", info->options[i]);
putchar('\n');
assert(ao_append_option(&options, "dev", argv[1]));
for (i = 2; argv[i] && argv[i + 1]; i += 2)
assert(ao_append_option(&options, argv[i], argv[i + 1]));
format.bits = 16;
format.channels = 2;
format.rate = 44100;
format.byte_format = AO_FMT_LITTLE;
device = ao_open_live(default_driver, &format, options);
if (device == NULL) {
fprintf(stderr, "Error opening device.\n");
return 1;
}
buf_size = format.bits/8 * format.channels * format.rate;
buffer = calloc(buf_size, sizeof(char));
for (i = 0; i < format.rate; i++) {
sample = (int)(0.75 * 32768.0 *
sin(2 * M_PI * freq * ((float) i/format.rate)));
/* Put the same stuff in left and right channel */
buffer[4*i] = buffer[4*i+2] = sample & 0xff;
buffer[4*i+1] = buffer[4*i+3] = (sample >> 8) & 0xff;
}
assert(ao_play(device, buffer, buf_size));
printf("played!\n");
ao_close(device);
ao_shutdown();
return 0;
}
The command "./a.out mplayer" beeps and says
short_name=alsa09 dev buffer_time period_time
played!
If I try "./a.out main" I get
short_name=alsa09 dev buffer_time period_time
and then nothing. Any ideas? No values of buffer_time or
period_time that I could find got a beep out of pcm.main
(I listen to my MP3s with pytone which uses libao.) I am
using Linux 2.6.3-1-686 and Alsa 1.0.2c
> > How do I increase the buffering (latency) with the EX7?
> Try adding period_size and/or buffer_size entries to the slave
> definition (both values are in bytes).
As you can see I made up some values for period_size and buffer_size.
How do I find out the maximum values for these parameters? Aplay uses
period_size=2048 and buffer_size=4096 even if I put bigger values
in .asoundrc. Perhaps these are thus the maximums. I cannot hear any
latency with these values. Are these the best values to reduce clicks?
I haven't found anywhere to specify period_size and buffer_size for
pcm.mplayer.
thanks again
Stuart
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Alsa-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-user