[alsa-devel] [PATCH 0/2] Patches for salsa-lib
Hi,
Here are two little patches for salsa-lib. I would be happy if these could be included in the next release.
And I saw that in the released salsa-lib 0.1.6 tarball, the generated headers asoundlib.h, version.h and recipe.h are included. I guess this is by mistake? This caused unexpected behaviour for me, because when performing an out-of-tree build, these are used instead of the generated headers in the build directory.
Regards, Felix
g++ does not allow implicit casting of void * to another pointer type (at least not without -fpermissive)
Signed-off-by: Felix Hädicke felixhaedicke@web.de --- src/mixer_macros.h | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-)
diff --git a/src/mixer_macros.h b/src/mixer_macros.h index 9b38848..c0e8c8a 100644 --- a/src/mixer_macros.h +++ b/src/mixer_macros.h @@ -487,7 +487,9 @@ int snd_mixer_selem_set_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value) { - return _snd_selem_update_volume(elem->items[SND_SELEM_ITEM_PVOLUME], channel, value); + return _snd_selem_update_volume((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], + channel, + value); }
__SALSA_EXPORT_FUNC @@ -495,19 +497,23 @@ int snd_mixer_selem_set_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value) { - return _snd_selem_update_volume(elem->items[SND_SELEM_ITEM_CVOLUME], channel, value); + return _snd_selem_update_volume((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], + channel, + value); }
__SALSA_EXPORT_FUNC int snd_mixer_selem_set_playback_volume_all(snd_mixer_elem_t *elem, long value) { - return _snd_selem_update_volume_all(elem->items[SND_SELEM_ITEM_PVOLUME], value); + return _snd_selem_update_volume_all((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], + value); }
__SALSA_EXPORT_FUNC int snd_mixer_selem_set_capture_volume_all(snd_mixer_elem_t *elem, long value) { - return _snd_selem_update_volume_all(elem->items[SND_SELEM_ITEM_CVOLUME], value); + return _snd_selem_update_volume_all((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], + value); }
__SALSA_EXPORT_FUNC @@ -531,7 +537,7 @@ int snd_mixer_selem_is_enum_capture(snd_mixer_elem_t *elem) __SALSA_EXPORT_FUNC int snd_mixer_selem_get_enum_items(snd_mixer_elem_t *elem) { - snd_selem_enum_item_t *eitem = elem->items[SND_SELEM_ITEM_ENUM]; + snd_selem_enum_item_t *eitem = (snd_selem_enum_item_t *)elem->items[SND_SELEM_ITEM_ENUM]; if (!eitem) return -EINVAL; return eitem->items; @@ -542,7 +548,7 @@ int snd_mixer_selem_get_enum_item(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *itemp) { - snd_selem_enum_item_t *eitem = elem->items[SND_SELEM_ITEM_ENUM]; + snd_selem_enum_item_t *eitem = (snd_selem_enum_item_t *)elem->items[SND_SELEM_ITEM_ENUM]; if (!eitem || (unsigned int)channel >= eitem->head.channels) return -EINVAL; *itemp = eitem->item[channel]; @@ -602,7 +608,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem, long *min, long *max) { - return _snd_selem_vol_get_dB_range(elem->items[SND_SELEM_ITEM_PVOLUME], + return _snd_selem_vol_get_dB_range((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], min, max); }
@@ -611,7 +617,7 @@ int snd_mixer_selem_get_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value) { - return _snd_selem_vol_get_dB(elem->items[SND_SELEM_ITEM_PVOLUME], + return _snd_selem_vol_get_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], channel, value); }
@@ -619,7 +625,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_ask_playback_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue) { - return _snd_selem_ask_vol_dB(elem->items[SND_SELEM_ITEM_PVOLUME], + return _snd_selem_ask_vol_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], value, dBvalue); }
@@ -627,7 +633,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_ask_playback_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value) { - return _snd_selem_ask_dB_vol(elem->items[SND_SELEM_ITEM_PVOLUME], + return _snd_selem_ask_dB_vol((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], dBvalue, value, dir); }
@@ -636,7 +642,7 @@ int snd_mixer_selem_set_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir) { - return _snd_selem_vol_set_dB(elem->items[SND_SELEM_ITEM_PVOLUME], + return _snd_selem_vol_set_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], (int)channel, value, dir); }
@@ -644,14 +650,15 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_set_playback_dB_all(snd_mixer_elem_t *elem, long value, int dir) { - return _snd_selem_vol_set_dB_all(elem->items[SND_SELEM_ITEM_PVOLUME], value, dir); + return _snd_selem_vol_set_dB_all((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], + value, dir); }
__SALSA_EXPORT_FUNC int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem, long *min, long *max) { - return _snd_selem_vol_get_dB_range(elem->items[SND_SELEM_ITEM_CVOLUME], + return _snd_selem_vol_get_dB_range((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], min, max); }
@@ -660,7 +667,7 @@ int snd_mixer_selem_get_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value) { - return _snd_selem_vol_get_dB(elem->items[SND_SELEM_ITEM_CVOLUME], + return _snd_selem_vol_get_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], channel, value); }
@@ -668,7 +675,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_ask_capture_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue) { - return _snd_selem_ask_vol_dB(elem->items[SND_SELEM_ITEM_CVOLUME], + return _snd_selem_ask_vol_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], value, dBvalue); }
@@ -676,7 +683,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_ask_capture_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value) { - return _snd_selem_ask_dB_vol(elem->items[SND_SELEM_ITEM_CVOLUME], + return _snd_selem_ask_dB_vol((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], dBvalue, value, dir); }
@@ -685,7 +692,7 @@ int snd_mixer_selem_set_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir) { - return _snd_selem_vol_set_dB(elem->items[SND_SELEM_ITEM_CVOLUME], + return _snd_selem_vol_set_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], channel, value, dir); }
@@ -693,7 +700,8 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_set_capture_dB_all(snd_mixer_elem_t *elem, long value, int dir) { - return _snd_selem_vol_set_dB_all(elem->items[SND_SELEM_ITEM_CVOLUME], value, dir); + return _snd_selem_vol_set_dB_all((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], + value, dir); }
#else /* SALSA_HAS_TLV_SUPPORT */
On Wed, 12 Jul 2017 22:31:13 +0200, Felix Hädicke wrote:
g++ does not allow implicit casting of void * to another pointer type (at least not without -fpermissive)
It's a known issue, and intentionally ignored. Cast is just ugly. The salsa-lib headers are for C, not for C++, after all.
thanks,
Takashi
Signed-off-by: Felix Hädicke felixhaedicke@web.de
src/mixer_macros.h | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-)
diff --git a/src/mixer_macros.h b/src/mixer_macros.h index 9b38848..c0e8c8a 100644 --- a/src/mixer_macros.h +++ b/src/mixer_macros.h @@ -487,7 +487,9 @@ int snd_mixer_selem_set_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value) {
- return _snd_selem_update_volume(elem->items[SND_SELEM_ITEM_PVOLUME], channel, value);
- return _snd_selem_update_volume((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME],
channel,
value);
}
__SALSA_EXPORT_FUNC @@ -495,19 +497,23 @@ int snd_mixer_selem_set_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value) {
- return _snd_selem_update_volume(elem->items[SND_SELEM_ITEM_CVOLUME], channel, value);
- return _snd_selem_update_volume((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME],
channel,
value);
}
__SALSA_EXPORT_FUNC int snd_mixer_selem_set_playback_volume_all(snd_mixer_elem_t *elem, long value) {
- return _snd_selem_update_volume_all(elem->items[SND_SELEM_ITEM_PVOLUME], value);
- return _snd_selem_update_volume_all((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME],
value);
}
__SALSA_EXPORT_FUNC int snd_mixer_selem_set_capture_volume_all(snd_mixer_elem_t *elem, long value) {
- return _snd_selem_update_volume_all(elem->items[SND_SELEM_ITEM_CVOLUME], value);
- return _snd_selem_update_volume_all((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME],
value);
}
__SALSA_EXPORT_FUNC @@ -531,7 +537,7 @@ int snd_mixer_selem_is_enum_capture(snd_mixer_elem_t *elem) __SALSA_EXPORT_FUNC int snd_mixer_selem_get_enum_items(snd_mixer_elem_t *elem) {
- snd_selem_enum_item_t *eitem = elem->items[SND_SELEM_ITEM_ENUM];
- snd_selem_enum_item_t *eitem = (snd_selem_enum_item_t *)elem->items[SND_SELEM_ITEM_ENUM]; if (!eitem) return -EINVAL; return eitem->items;
@@ -542,7 +548,7 @@ int snd_mixer_selem_get_enum_item(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *itemp) {
- snd_selem_enum_item_t *eitem = elem->items[SND_SELEM_ITEM_ENUM];
- snd_selem_enum_item_t *eitem = (snd_selem_enum_item_t *)elem->items[SND_SELEM_ITEM_ENUM]; if (!eitem || (unsigned int)channel >= eitem->head.channels) return -EINVAL; *itemp = eitem->item[channel];
@@ -602,7 +608,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem, long *min, long *max) {
- return _snd_selem_vol_get_dB_range(elem->items[SND_SELEM_ITEM_PVOLUME],
- return _snd_selem_vol_get_dB_range((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], min, max);
}
@@ -611,7 +617,7 @@ int snd_mixer_selem_get_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value) {
- return _snd_selem_vol_get_dB(elem->items[SND_SELEM_ITEM_PVOLUME],
- return _snd_selem_vol_get_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], channel, value);
}
@@ -619,7 +625,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_ask_playback_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue) {
- return _snd_selem_ask_vol_dB(elem->items[SND_SELEM_ITEM_PVOLUME],
- return _snd_selem_ask_vol_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], value, dBvalue);
}
@@ -627,7 +633,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_ask_playback_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value) {
- return _snd_selem_ask_dB_vol(elem->items[SND_SELEM_ITEM_PVOLUME],
- return _snd_selem_ask_dB_vol((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], dBvalue, value, dir);
}
@@ -636,7 +642,7 @@ int snd_mixer_selem_set_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir) {
- return _snd_selem_vol_set_dB(elem->items[SND_SELEM_ITEM_PVOLUME],
- return _snd_selem_vol_set_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], (int)channel, value, dir);
}
@@ -644,14 +650,15 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_set_playback_dB_all(snd_mixer_elem_t *elem, long value, int dir) {
- return _snd_selem_vol_set_dB_all(elem->items[SND_SELEM_ITEM_PVOLUME], value, dir);
- return _snd_selem_vol_set_dB_all((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME],
value, dir);
}
__SALSA_EXPORT_FUNC int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem, long *min, long *max) {
- return _snd_selem_vol_get_dB_range(elem->items[SND_SELEM_ITEM_CVOLUME],
- return _snd_selem_vol_get_dB_range((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], min, max);
}
@@ -660,7 +667,7 @@ int snd_mixer_selem_get_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value) {
- return _snd_selem_vol_get_dB(elem->items[SND_SELEM_ITEM_CVOLUME],
- return _snd_selem_vol_get_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], channel, value);
}
@@ -668,7 +675,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_ask_capture_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue) {
- return _snd_selem_ask_vol_dB(elem->items[SND_SELEM_ITEM_CVOLUME],
- return _snd_selem_ask_vol_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], value, dBvalue);
}
@@ -676,7 +683,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_ask_capture_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value) {
- return _snd_selem_ask_dB_vol(elem->items[SND_SELEM_ITEM_CVOLUME],
- return _snd_selem_ask_dB_vol((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], dBvalue, value, dir);
}
@@ -685,7 +692,7 @@ int snd_mixer_selem_set_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir) {
- return _snd_selem_vol_set_dB(elem->items[SND_SELEM_ITEM_CVOLUME],
- return _snd_selem_vol_set_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], channel, value, dir);
}
@@ -693,7 +700,8 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_set_capture_dB_all(snd_mixer_elem_t *elem, long value, int dir) {
- return _snd_selem_vol_set_dB_all(elem->items[SND_SELEM_ITEM_CVOLUME], value, dir);
- return _snd_selem_vol_set_dB_all((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME],
value, dir);
}
#else /* SALSA_HAS_TLV_SUPPORT */
2.13.2
On 07/12/17 22:38, Takashi Iwai wrote:
On Wed, 12 Jul 2017 22:31:13 +0200, Felix Hädicke wrote:
g++ does not allow implicit casting of void * to another pointer type (at least not without -fpermissive)
It's a known issue, and intentionally ignored. Cast is just ugly. The salsa-lib headers are for C, not for C++, after all.
What is wrong with using salsa-lib it in a C++ project? Is it really not desinged for being used from C++ code?
From asoundlib-head.h:
#ifdef __cplusplus extern "C" { #endif
thanks,
Takashi
Signed-off-by: Felix Hädicke felixhaedicke@web.de
src/mixer_macros.h | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-)
diff --git a/src/mixer_macros.h b/src/mixer_macros.h index 9b38848..c0e8c8a 100644 --- a/src/mixer_macros.h +++ b/src/mixer_macros.h @@ -487,7 +487,9 @@ int snd_mixer_selem_set_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value) {
- return _snd_selem_update_volume(elem->items[SND_SELEM_ITEM_PVOLUME], channel, value);
- return _snd_selem_update_volume((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME],
channel,
value);
}
__SALSA_EXPORT_FUNC @@ -495,19 +497,23 @@ int snd_mixer_selem_set_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value) {
- return _snd_selem_update_volume(elem->items[SND_SELEM_ITEM_CVOLUME], channel, value);
- return _snd_selem_update_volume((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME],
channel,
value);
}
__SALSA_EXPORT_FUNC int snd_mixer_selem_set_playback_volume_all(snd_mixer_elem_t *elem, long value) {
- return _snd_selem_update_volume_all(elem->items[SND_SELEM_ITEM_PVOLUME], value);
- return _snd_selem_update_volume_all((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME],
value);
}
__SALSA_EXPORT_FUNC int snd_mixer_selem_set_capture_volume_all(snd_mixer_elem_t *elem, long value) {
- return _snd_selem_update_volume_all(elem->items[SND_SELEM_ITEM_CVOLUME], value);
- return _snd_selem_update_volume_all((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME],
value);
}
__SALSA_EXPORT_FUNC @@ -531,7 +537,7 @@ int snd_mixer_selem_is_enum_capture(snd_mixer_elem_t *elem) __SALSA_EXPORT_FUNC int snd_mixer_selem_get_enum_items(snd_mixer_elem_t *elem) {
- snd_selem_enum_item_t *eitem = elem->items[SND_SELEM_ITEM_ENUM];
- snd_selem_enum_item_t *eitem = (snd_selem_enum_item_t *)elem->items[SND_SELEM_ITEM_ENUM]; if (!eitem) return -EINVAL; return eitem->items;
@@ -542,7 +548,7 @@ int snd_mixer_selem_get_enum_item(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *itemp) {
- snd_selem_enum_item_t *eitem = elem->items[SND_SELEM_ITEM_ENUM];
- snd_selem_enum_item_t *eitem = (snd_selem_enum_item_t *)elem->items[SND_SELEM_ITEM_ENUM]; if (!eitem || (unsigned int)channel >= eitem->head.channels) return -EINVAL; *itemp = eitem->item[channel];
@@ -602,7 +608,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem, long *min, long *max) {
- return _snd_selem_vol_get_dB_range(elem->items[SND_SELEM_ITEM_PVOLUME],
- return _snd_selem_vol_get_dB_range((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], min, max);
}
@@ -611,7 +617,7 @@ int snd_mixer_selem_get_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value) {
- return _snd_selem_vol_get_dB(elem->items[SND_SELEM_ITEM_PVOLUME],
- return _snd_selem_vol_get_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], channel, value);
}
@@ -619,7 +625,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_ask_playback_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue) {
- return _snd_selem_ask_vol_dB(elem->items[SND_SELEM_ITEM_PVOLUME],
- return _snd_selem_ask_vol_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], value, dBvalue);
}
@@ -627,7 +633,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_ask_playback_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value) {
- return _snd_selem_ask_dB_vol(elem->items[SND_SELEM_ITEM_PVOLUME],
- return _snd_selem_ask_dB_vol((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], dBvalue, value, dir);
}
@@ -636,7 +642,7 @@ int snd_mixer_selem_set_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir) {
- return _snd_selem_vol_set_dB(elem->items[SND_SELEM_ITEM_PVOLUME],
- return _snd_selem_vol_set_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME], (int)channel, value, dir);
}
@@ -644,14 +650,15 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_set_playback_dB_all(snd_mixer_elem_t *elem, long value, int dir) {
- return _snd_selem_vol_set_dB_all(elem->items[SND_SELEM_ITEM_PVOLUME], value, dir);
- return _snd_selem_vol_set_dB_all((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_PVOLUME],
value, dir);
}
__SALSA_EXPORT_FUNC int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem, long *min, long *max) {
- return _snd_selem_vol_get_dB_range(elem->items[SND_SELEM_ITEM_CVOLUME],
- return _snd_selem_vol_get_dB_range((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], min, max);
}
@@ -660,7 +667,7 @@ int snd_mixer_selem_get_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value) {
- return _snd_selem_vol_get_dB(elem->items[SND_SELEM_ITEM_CVOLUME],
- return _snd_selem_vol_get_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], channel, value);
}
@@ -668,7 +675,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_ask_capture_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue) {
- return _snd_selem_ask_vol_dB(elem->items[SND_SELEM_ITEM_CVOLUME],
- return _snd_selem_ask_vol_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], value, dBvalue);
}
@@ -676,7 +683,7 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_ask_capture_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value) {
- return _snd_selem_ask_dB_vol(elem->items[SND_SELEM_ITEM_CVOLUME],
- return _snd_selem_ask_dB_vol((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], dBvalue, value, dir);
}
@@ -685,7 +692,7 @@ int snd_mixer_selem_set_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir) {
- return _snd_selem_vol_set_dB(elem->items[SND_SELEM_ITEM_CVOLUME],
- return _snd_selem_vol_set_dB((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME], channel, value, dir);
}
@@ -693,7 +700,8 @@ __SALSA_EXPORT_FUNC int snd_mixer_selem_set_capture_dB_all(snd_mixer_elem_t *elem, long value, int dir) {
- return _snd_selem_vol_set_dB_all(elem->items[SND_SELEM_ITEM_CVOLUME], value, dir);
- return _snd_selem_vol_set_dB_all((snd_selem_vol_item_t *)elem->items[SND_SELEM_ITEM_CVOLUME],
value, dir);
}
#else /* SALSA_HAS_TLV_SUPPORT */
2.13.2
On Thu, 13 Jul 2017 22:16:49 +0200, Felix H4dicke wrote:
On 07/12/17 22:38, Takashi Iwai wrote:
On Wed, 12 Jul 2017 22:31:13 +0200, Felix Hädicke wrote:
g++ does not allow implicit casting of void * to another pointer type (at least not without -fpermissive)
It's a known issue, and intentionally ignored. Cast is just ugly. The salsa-lib headers are for C, not for C++, after all.
What is wrong with using salsa-lib it in a C++ project? Is it really not desinged for being used from C++ code?
I'm not interested in it, that's all. If it were about alsa-lib, I would accept the changes. But salsa-lib is really not meant as a generic library for every use case.
thanks,
Takashi
According to POSIX.1-2001, the correct include path is <poll.h>. And when compiling against musl, it generates "deprecated" warnings, if <sys/poll.h> is included.
Signed-off-by: Felix Hädicke felixhaedicke@web.de --- src/asoundlib-head.h | 2 +- src/control.c | 2 +- src/ctl_macros.h | 2 +- src/hcontrol.c | 2 +- src/hctl_macros.h | 2 +- src/hwdep.c | 2 +- src/hwdep_macros.h | 2 +- src/mixer.c | 2 +- src/mixer_macros.h | 2 +- src/pcm_macros.h | 2 +- src/rawmidi.c | 2 +- src/rawmidi_macros.h | 2 +- src/timer.c | 2 +- src/timer_macros.h | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/asoundlib-head.h b/src/asoundlib-head.h index a852fbe..cc7b154 100644 --- a/src/asoundlib-head.h +++ b/src/asoundlib-head.h @@ -29,7 +29,7 @@ #include <fcntl.h> #include <assert.h> #include <endian.h> -#include <sys/poll.h> +#include <poll.h> #include <errno.h> #include <stdarg.h>
diff --git a/src/control.c b/src/control.c index 17398ba..c9eab72 100644 --- a/src/control.c +++ b/src/control.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "control.h" #include "local.h" #if SALSA_SUPPORT_FLOAT diff --git a/src/ctl_macros.h b/src/ctl_macros.h index 9ed3357..ce86a8f 100644 --- a/src/ctl_macros.h +++ b/src/ctl_macros.h @@ -12,7 +12,7 @@ #include <string.h> #include <errno.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_ctl { char *name; diff --git a/src/hcontrol.c b/src/hcontrol.c index fce1b13..14dfeb1 100644 --- a/src/hcontrol.c +++ b/src/hcontrol.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "hcontrol.h" #include "local.h"
diff --git a/src/hctl_macros.h b/src/hctl_macros.h index fc1348b..613237b 100644 --- a/src/hctl_macros.h +++ b/src/hctl_macros.h @@ -12,7 +12,7 @@ #include <string.h> #include <errno.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_hctl { snd_ctl_t *ctl; diff --git a/src/hwdep.c b/src/hwdep.c index 3b5ee6d..b4c23f9 100644 --- a/src/hwdep.c +++ b/src/hwdep.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "hwdep.h" #include "local.h"
diff --git a/src/hwdep_macros.h b/src/hwdep_macros.h index 6a52c68..3d2ea13 100644 --- a/src/hwdep_macros.h +++ b/src/hwdep_macros.h @@ -11,7 +11,7 @@ #include <errno.h> #include <unistd.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_hwdep { const char *name; diff --git a/src/mixer.c b/src/mixer.c index c0ccc3d..15fcc30 100644 --- a/src/mixer.c +++ b/src/mixer.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "mixer.h" #include "local.h"
diff --git a/src/mixer_macros.h b/src/mixer_macros.h index c0e8c8a..7355046 100644 --- a/src/mixer_macros.h +++ b/src/mixer_macros.h @@ -10,7 +10,7 @@ #include <string.h> #include <errno.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_mixer { snd_hctl_t *hctl; diff --git a/src/pcm_macros.h b/src/pcm_macros.h index a35c794..f252014 100644 --- a/src/pcm_macros.h +++ b/src/pcm_macros.h @@ -12,7 +12,7 @@ #include <string.h> #include <errno.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
typedef struct { struct sndrv_pcm_channel_info info; diff --git a/src/rawmidi.c b/src/rawmidi.c index 79f9b21..ca96f5d 100644 --- a/src/rawmidi.c +++ b/src/rawmidi.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "rawmidi.h" #include "control.h" #include "local.h" diff --git a/src/rawmidi_macros.h b/src/rawmidi_macros.h index c32b440..c3146cc 100644 --- a/src/rawmidi_macros.h +++ b/src/rawmidi_macros.h @@ -13,7 +13,7 @@ #include <errno.h> #include <unistd.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
typedef struct _snd_rawmidi_hw { char *name; diff --git a/src/timer.c b/src/timer.c index 00a8534..b9fbb00 100644 --- a/src/timer.c +++ b/src/timer.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "timer.h" #include "local.h"
diff --git a/src/timer_macros.h b/src/timer_macros.h index a1837e7..1cd37be 100644 --- a/src/timer_macros.h +++ b/src/timer_macros.h @@ -11,7 +11,7 @@ #include <errno.h> #include <unistd.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_timer { char *name;
On Wed, 12 Jul 2017 22:31:14 +0200, Felix Hädicke wrote:
According to POSIX.1-2001, the correct include path is <poll.h>. And when compiling against musl, it generates "deprecated" warnings, if <sys/poll.h> is included.
Does the current code-lib work with musl? It's never tested and intended...
thanks,
Takashi
Signed-off-by: Felix Hädicke felixhaedicke@web.de
src/asoundlib-head.h | 2 +- src/control.c | 2 +- src/ctl_macros.h | 2 +- src/hcontrol.c | 2 +- src/hctl_macros.h | 2 +- src/hwdep.c | 2 +- src/hwdep_macros.h | 2 +- src/mixer.c | 2 +- src/mixer_macros.h | 2 +- src/pcm_macros.h | 2 +- src/rawmidi.c | 2 +- src/rawmidi_macros.h | 2 +- src/timer.c | 2 +- src/timer_macros.h | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/asoundlib-head.h b/src/asoundlib-head.h index a852fbe..cc7b154 100644 --- a/src/asoundlib-head.h +++ b/src/asoundlib-head.h @@ -29,7 +29,7 @@ #include <fcntl.h> #include <assert.h> #include <endian.h> -#include <sys/poll.h> +#include <poll.h> #include <errno.h> #include <stdarg.h>
diff --git a/src/control.c b/src/control.c index 17398ba..c9eab72 100644 --- a/src/control.c +++ b/src/control.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "control.h" #include "local.h" #if SALSA_SUPPORT_FLOAT diff --git a/src/ctl_macros.h b/src/ctl_macros.h index 9ed3357..ce86a8f 100644 --- a/src/ctl_macros.h +++ b/src/ctl_macros.h @@ -12,7 +12,7 @@ #include <string.h> #include <errno.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_ctl { char *name; diff --git a/src/hcontrol.c b/src/hcontrol.c index fce1b13..14dfeb1 100644 --- a/src/hcontrol.c +++ b/src/hcontrol.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "hcontrol.h" #include "local.h"
diff --git a/src/hctl_macros.h b/src/hctl_macros.h index fc1348b..613237b 100644 --- a/src/hctl_macros.h +++ b/src/hctl_macros.h @@ -12,7 +12,7 @@ #include <string.h> #include <errno.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_hctl { snd_ctl_t *ctl; diff --git a/src/hwdep.c b/src/hwdep.c index 3b5ee6d..b4c23f9 100644 --- a/src/hwdep.c +++ b/src/hwdep.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "hwdep.h" #include "local.h"
diff --git a/src/hwdep_macros.h b/src/hwdep_macros.h index 6a52c68..3d2ea13 100644 --- a/src/hwdep_macros.h +++ b/src/hwdep_macros.h @@ -11,7 +11,7 @@ #include <errno.h> #include <unistd.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_hwdep { const char *name; diff --git a/src/mixer.c b/src/mixer.c index c0ccc3d..15fcc30 100644 --- a/src/mixer.c +++ b/src/mixer.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "mixer.h" #include "local.h"
diff --git a/src/mixer_macros.h b/src/mixer_macros.h index c0e8c8a..7355046 100644 --- a/src/mixer_macros.h +++ b/src/mixer_macros.h @@ -10,7 +10,7 @@ #include <string.h> #include <errno.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_mixer { snd_hctl_t *hctl; diff --git a/src/pcm_macros.h b/src/pcm_macros.h index a35c794..f252014 100644 --- a/src/pcm_macros.h +++ b/src/pcm_macros.h @@ -12,7 +12,7 @@ #include <string.h> #include <errno.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
typedef struct { struct sndrv_pcm_channel_info info; diff --git a/src/rawmidi.c b/src/rawmidi.c index 79f9b21..ca96f5d 100644 --- a/src/rawmidi.c +++ b/src/rawmidi.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "rawmidi.h" #include "control.h" #include "local.h" diff --git a/src/rawmidi_macros.h b/src/rawmidi_macros.h index c32b440..c3146cc 100644 --- a/src/rawmidi_macros.h +++ b/src/rawmidi_macros.h @@ -13,7 +13,7 @@ #include <errno.h> #include <unistd.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
typedef struct _snd_rawmidi_hw { char *name; diff --git a/src/timer.c b/src/timer.c index 00a8534..b9fbb00 100644 --- a/src/timer.c +++ b/src/timer.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "timer.h" #include "local.h"
diff --git a/src/timer_macros.h b/src/timer_macros.h index a1837e7..1cd37be 100644 --- a/src/timer_macros.h +++ b/src/timer_macros.h @@ -11,7 +11,7 @@ #include <errno.h> #include <unistd.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_timer { char *name; -- 2.13.2
On Wed, 12 Jul 2017 22:40:12 +0200, Takashi Iwai wrote:
On Wed, 12 Jul 2017 22:31:14 +0200, Felix Hädicke wrote:
According to POSIX.1-2001, the correct include path is <poll.h>. And when compiling against musl, it generates "deprecated" warnings, if <sys/poll.h> is included.
Does the current code-lib work with musl? It's never tested and intended...
In anyway, applied this patch now. Thanks.
Takashi
On 07/12/17 22:40, Takashi Iwai wrote:
On Wed, 12 Jul 2017 22:31:14 +0200, Felix Hädicke wrote:
According to POSIX.1-2001, the correct include path is <poll.h>. And when compiling against musl, it generates "deprecated" warnings, if <sys/poll.h> is included.
Does the current code-lib work with musl? It's never tested and intended...
yes, salsa-lib is working fine with musl for me.
Btw. I am using salsa-lib for audio output for the XCSoar gliding computer on Kobo eReaders via USB-OTG. https://www.youtube.com/watch?v=9u4qki3GA0M
thanks,
Takashi
Signed-off-by: Felix Hädicke felixhaedicke@web.de
src/asoundlib-head.h | 2 +- src/control.c | 2 +- src/ctl_macros.h | 2 +- src/hcontrol.c | 2 +- src/hctl_macros.h | 2 +- src/hwdep.c | 2 +- src/hwdep_macros.h | 2 +- src/mixer.c | 2 +- src/mixer_macros.h | 2 +- src/pcm_macros.h | 2 +- src/rawmidi.c | 2 +- src/rawmidi_macros.h | 2 +- src/timer.c | 2 +- src/timer_macros.h | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/asoundlib-head.h b/src/asoundlib-head.h index a852fbe..cc7b154 100644 --- a/src/asoundlib-head.h +++ b/src/asoundlib-head.h @@ -29,7 +29,7 @@ #include <fcntl.h> #include <assert.h> #include <endian.h> -#include <sys/poll.h> +#include <poll.h> #include <errno.h> #include <stdarg.h>
diff --git a/src/control.c b/src/control.c index 17398ba..c9eab72 100644 --- a/src/control.c +++ b/src/control.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "control.h" #include "local.h" #if SALSA_SUPPORT_FLOAT diff --git a/src/ctl_macros.h b/src/ctl_macros.h index 9ed3357..ce86a8f 100644 --- a/src/ctl_macros.h +++ b/src/ctl_macros.h @@ -12,7 +12,7 @@ #include <string.h> #include <errno.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_ctl { char *name; diff --git a/src/hcontrol.c b/src/hcontrol.c index fce1b13..14dfeb1 100644 --- a/src/hcontrol.c +++ b/src/hcontrol.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "hcontrol.h" #include "local.h"
diff --git a/src/hctl_macros.h b/src/hctl_macros.h index fc1348b..613237b 100644 --- a/src/hctl_macros.h +++ b/src/hctl_macros.h @@ -12,7 +12,7 @@ #include <string.h> #include <errno.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_hctl { snd_ctl_t *ctl; diff --git a/src/hwdep.c b/src/hwdep.c index 3b5ee6d..b4c23f9 100644 --- a/src/hwdep.c +++ b/src/hwdep.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "hwdep.h" #include "local.h"
diff --git a/src/hwdep_macros.h b/src/hwdep_macros.h index 6a52c68..3d2ea13 100644 --- a/src/hwdep_macros.h +++ b/src/hwdep_macros.h @@ -11,7 +11,7 @@ #include <errno.h> #include <unistd.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_hwdep { const char *name; diff --git a/src/mixer.c b/src/mixer.c index c0ccc3d..15fcc30 100644 --- a/src/mixer.c +++ b/src/mixer.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "mixer.h" #include "local.h"
diff --git a/src/mixer_macros.h b/src/mixer_macros.h index c0e8c8a..7355046 100644 --- a/src/mixer_macros.h +++ b/src/mixer_macros.h @@ -10,7 +10,7 @@ #include <string.h> #include <errno.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_mixer { snd_hctl_t *hctl; diff --git a/src/pcm_macros.h b/src/pcm_macros.h index a35c794..f252014 100644 --- a/src/pcm_macros.h +++ b/src/pcm_macros.h @@ -12,7 +12,7 @@ #include <string.h> #include <errno.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
typedef struct { struct sndrv_pcm_channel_info info; diff --git a/src/rawmidi.c b/src/rawmidi.c index 79f9b21..ca96f5d 100644 --- a/src/rawmidi.c +++ b/src/rawmidi.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "rawmidi.h" #include "control.h" #include "local.h" diff --git a/src/rawmidi_macros.h b/src/rawmidi_macros.h index c32b440..c3146cc 100644 --- a/src/rawmidi_macros.h +++ b/src/rawmidi_macros.h @@ -13,7 +13,7 @@ #include <errno.h> #include <unistd.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
typedef struct _snd_rawmidi_hw { char *name; diff --git a/src/timer.c b/src/timer.c index 00a8534..b9fbb00 100644 --- a/src/timer.c +++ b/src/timer.c @@ -26,7 +26,7 @@ #include <string.h> #include <fcntl.h> #include <signal.h> -#include <sys/poll.h> +#include <poll.h> #include "timer.h" #include "local.h"
diff --git a/src/timer_macros.h b/src/timer_macros.h index a1837e7..1cd37be 100644 --- a/src/timer_macros.h +++ b/src/timer_macros.h @@ -11,7 +11,7 @@ #include <errno.h> #include <unistd.h> #include <sys/ioctl.h> -#include <sys/poll.h> +#include <poll.h>
struct _snd_timer { char *name; -- 2.13.2
On Wed, 12 Jul 2017 22:31:12 +0200, Felix Hädicke wrote:
Hi,
Here are two little patches for salsa-lib. I would be happy if these could be included in the next release.
And I saw that in the released salsa-lib 0.1.6 tarball, the generated headers asoundlib.h, version.h and recipe.h are included. I guess this is by mistake? This caused unexpected behaviour for me, because when performing an out-of-tree build, these are used instead of the generated headers in the build directory.
Yeah, this must be some harmless leftover at packaging.
thanks,
Takashi
participants (2)
-
Felix Hädicke
-
Takashi Iwai