Commit graph

13 commits

Author SHA1 Message Date
Jaroslav Kysela
995e279081 include: pcm extplug/ioplug: fix internal include
The header files are directly included when the alsa-lib is building.
Do not show warning.

Fixes: ea8972c8 ("include: prefer alsa/asoundlib.h for apps, dependency cleanups")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 22:00:54 +01:00
Jaroslav Kysela
ea8972c83b include: prefer alsa/asoundlib.h for apps, dependency cleanups
Fixes several issues with header files:

- prefer alsa/asoundlib.h file for the alsa-lib core functionalities
  (use #warning to inform current and future developers, do the job)
- include alsa/asoundlib.h in headers for external plugins by default
- pcm_external.h: dependencies cleanup
- as benefit, the parsers in IDEs should get all information for individial
  header files (see PR#435)

This change was mainly tergetted to fix errors caused by wrong include order
(like for endianness detection, missing typedefs etc.).

Closes: https://github.com/alsa-project/alsa-lib/issues/431
Link: https://github.com/alsa-project/alsa-lib/pull/435
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-02-02 18:56:47 +01:00
Timo Wischer
ee64b4b83a pcm: extplug: Keep format and channels the same if requested
Without this patch it is not possible to link the channel and format
parameter if snd_pcm_extplug_set_param_*() or
snd_pcm_extplug_set_slave_param_*() is called. Therefore the client and
slave parameter can differ. So the extplug has to implement conversion.

To avoid this the new snd_pcm_extplug_set_param_link() function can be
called.
As a reproduction sceanrio the following extplug source code can be used:

===
static snd_pcm_sframes_t my_transfer(snd_pcm_extplug_t *e,
	const snd_pcm_channel_area_t *da, snd_pcm_uframes_t dof,
	const snd_pcm_channel_area_t *sa, snd_pcm_uframes_t sof,
	snd_pcm_uframes_t s) {
	return s;
}
static const snd_pcm_extplug_callback_t my_own_callback = {
	.transfer = my_transfer
};
SND_PCM_PLUGIN_DEFINE_FUNC(my_plug) {
	snd_config_iterator_t i, next;
	snd_config_t *slave = NULL;
	snd_pcm_extplug_t *myplug;
	snd_config_for_each(i, next, conf) {
		snd_config_t *n = snd_config_iterator_entry(i);
		const char *id;
		if (snd_config_get_id(n, &id) < 0)
			continue;
		if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0)
			continue;
		if (strcmp(id, "slave") == 0) {
			slave = n;
			continue;
		}
		return -EINVAL;
	}
	myplug = calloc(1, sizeof(*myplug));
	myplug->version = SND_PCM_EXTPLUG_VERSION;
	myplug->callback = &my_own_callback;
	snd_pcm_extplug_create(myplug, name, root, slave, stream, mode);

	snd_pcm_extplug_set_param_minmax(myplug,
		SND_PCM_EXTPLUG_HW_CHANNELS, 1, 16);
//	snd_pcm_extplug_set_param_link(myplug, SND_PCM_EXTPLUG_HW_CHANNELS, 1);

	*pcmp = myplug->pcm;
	return 0;
}
SND_PCM_PLUGIN_SYMBOL(my_plug);
===

To use this plugin the following ALSA configuration is required:

pcm.myplug {
    type my_plug
    slave.pcm hw:Dummy
}

With this configuration without this patch
snd_pcm_hw_params_get_channels_max() will always return 16 channels
independent of the supported channels of the dummy device. Due to that for
example the start up of JACK would fail:

$ modprobe snd_dummy
$ jackd -d alsa -P myplug
ALSA: cannot set channel count to 16 for playback
ALSA: cannot configure playback channel

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-12-10 11:53:41 +01:00
Jaroslav Kysela
5b9041bced Change FSF address (Franklin Street)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2017-11-14 14:29:26 +01:00
Takashi Iwai
30122df4fa Use __inline__ for exported headers
Some programs are still using C90.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=817077
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-04-25 09:52:33 +02:00
Jaroslav Kysela
b6eb0f9bfd all places: doxygen cleanups
I see no errors with these changes using doxygen 1.8.1.1 .

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-04-08 16:42:24 +02:00
Takashi Iwai
9c1a0ce72d PCM: Introduce snd_pcm_chmap_t and snd_pcm_chmap_query_t
Instead of passing ambiguous integer array, define snd_pcm_chmap_t and
snd_pcm_chmap_query_t so that user can understand more easily which
element is for what.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-13 08:24:58 +02:00
Takashi Iwai
662f79d4ec Implement get_chmap/set_chmap for PCM extplug/ioplug plugins
Added the new ops for both external plugins, so the protocol numbers
are incremented.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-11 11:34:50 +02:00
Takashi Iwai
5c0674aee3 Add init callback to extplug
- Fix the hw constraints of extplug
- Add init callback to extplug
2006-03-20 11:26:16 +00:00
Takashi Iwai
7651690858 Fix documentation of external PCM plugin SDK
Fix documentation of external PCM plugin SDK.
2005-05-24 09:42:01 +00:00
Takashi Iwai
e61d385993 Add protocl version check
- Added protocl version check.  The caller of snd_pcm_{io|ext}plug_create()
  must fill version field with SND_PCM_{IO|EXT}PLUG_VERSION beforehand.

- Added poll_descriptors and poll_descriptors_count callbacks for ioplug.
2005-05-18 10:47:52 +00:00
Takashi Iwai
227441b2c8 More doxygen comments
Added more doxygen comments in pcm_extplug and pcm_ioplug codes.
2005-03-09 11:54:58 +00:00
Takashi Iwai
5eb794fe0b Add filter-type external plugin SDK
Added the SDK for filter-type PCM plugins.
Share some codes with ioplug.
2005-02-14 13:33:08 +00:00