5512,
8000,
11025,
+ 12000,
16000,
22050,
+ 24000,
32000,
44100,
48000,
96000,
176400,
192000,
- 384000, /* Yes, there are sound cards that go this high. */
+ 384000,
+ 768000, /* Yes, there are sound cards that go this high. */
};
static void alsa_scan_handle_dev(GSList **devices,
devc->num_probes = channels;
devc->hw_params = hw_params;
memcpy(devrates, hwrates, offset * sizeof(uint64_t));
- devc->supp_rates.list = devrates;
+ devc->samplerates = devrates;
sdi->priv = devc;
sdi->driver = di;
for (i = 0; i < devc->num_probes; i++) {
snprintf(p_name, sizeof(p_name), "Ch_%d", i);
- if (!(probe = sr_probe_new(0, SR_PROBE_ANALOG, TRUE, p_name)))
+ if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE, p_name)))
goto scan_error_cleanup;
sdi->probes = g_slist_append(sdi->probes, probe);
}
(void)options;
if ((ret = snd_ctl_card_info_malloc(&info)) < 0) {
- sr_err("Failed to malloc card info: %s.", snd_strerror(ret));
+ sr_dbg("Failed to malloc card info: %s.", snd_strerror(ret));
return NULL;
}
if ((ret = snd_pcm_info_malloc(&pcminfo) < 0)) {
- sr_err("Cannot malloc pcm info: %s.", snd_strerror(ret));
+ sr_dbg("Cannot malloc pcm info: %s.", snd_strerror(ret));
return NULL;
}
while (snd_card_next(&card) >= 0 && card >= 0) {
snprintf(hwcard, sizeof(hwcard), "hw:%d", card);
if ((ret = snd_ctl_open(&handle, hwcard, 0)) < 0) {
- sr_err("Cannot open (%d): %s.", card, snd_strerror(ret));
+ sr_dbg("Cannot open (%d): %s.", card, snd_strerror(ret));
continue;
}
if ((ret = snd_ctl_card_info(handle, info)) < 0) {
- sr_err("Cannot get hardware info (%d): %s.",
+ sr_dbg("Cannot get hardware info (%d): %s.",
card, snd_strerror(ret));
if ((ret = snd_ctl_close(handle)) < 0) {
- sr_err("Cannot close device (%d): %s.",
+ sr_dbg("Cannot close device (%d): %s.",
card, snd_strerror(ret));
}
continue;
snd_pcm_info_set_stream(pcminfo,
SND_PCM_STREAM_CAPTURE);
if ((ret = snd_ctl_pcm_info(handle, pcminfo)) < 0) {
- sr_err("Cannot get device info (%s): %s.",
+ sr_dbg("Cannot get device info (%s): %s.",
hwdev, snd_strerror(ret));
continue;
}
di, pcminfo);
}
if ((ret = snd_ctl_close(handle)) < 0) {
- sr_err("Cannot close device (%d): %s.",
+ sr_dbg("Cannot close device (%d): %s.",
card, snd_strerror(ret));
}
}
return devices;
}
-/*
- * Helper to be used with g_slist_free_full(); for properly freeing an alsa
- * dev instance.
- */
-SR_PRIV void alsa_dev_inst_clear(struct sr_dev_inst *sdi)
-{
- struct dev_context *devc;
-
- if (!(devc = sdi->priv))
- return;
-
- snd_pcm_hw_params_free(devc->hw_params);
- g_free((void*)devc->supp_rates.list);
- sr_dev_inst_free(sdi);
-}
-
/**
* Set the samplerate of the ALSA device.
*
i = 0;
do {
- if (newrate == devc->supp_rates.list[i]) {
+ if (newrate == devc->samplerates[i]) {
rate = newrate;
break;
}
- } while (devc->supp_rates.list[i++] != 0);
+ } while (devc->samplerates[i++] != 0);
if (!rate) {
- sr_err("Sample rate " PRIu64 " not supported.", newrate);
+ sr_err("Sample rate %" PRIu64 " not supported.", newrate);
return SR_ERR_ARG;
}
}
/* Send a sample packet with the analog values. */
+ analog.probes = sdi->probes;
analog.num_samples = count;
analog.mq = SR_MQ_VOLTAGE; /* FIXME */
analog.unit = SR_UNIT_VOLT; /* FIXME */