summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-softmixer.h
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2018-05-11 01:18:43 +0200
committerFulup Ar Foll <fulup@iot.bzh>2018-05-11 01:18:43 +0200
commit1dd1509a02fee564ff87f80c2f29055d7aad889c (patch)
tree031a0a9e912fa3f9ab94a268ad6058d774e6f8dd /plugins/alsa/alsa-softmixer.h
parente904b7da51297b0417df31ab79568c3f1243fb64 (diff)
Initial version with softvol control and DMIX
Diffstat (limited to 'plugins/alsa/alsa-softmixer.h')
-rw-r--r--plugins/alsa/alsa-softmixer.h84
1 files changed, 41 insertions, 43 deletions
diff --git a/plugins/alsa/alsa-softmixer.h b/plugins/alsa/alsa-softmixer.h
index c777f5d..17e7cf2 100644
--- a/plugins/alsa/alsa-softmixer.h
+++ b/plugins/alsa/alsa-softmixer.h
@@ -31,63 +31,61 @@
#include <alsa/asoundlib.h>
-#define MAINLOOP_WATCHDOG 10000
+#define MAINLOOP_WATCHDOG 30000
#define MAX_AUDIO_STREAMS 8
-// Provide proto for LibASound low level API
-int _snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
- snd_config_t *root, snd_config_t *conf,
- snd_pcm_stream_t stream, int mode);
+#define ALSA_PLUG_PROTO(plugin) \
+ int _snd_pcm_ ## plugin ## _open(snd_pcm_t **pcmp, const char *name, snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode)
-// alsa-ctl.c
-PUBLIC snd_ctl_card_info_t *AlsaCtlGetInfo (CtlSourceT *source, const char *devid);
-PUBLIC snd_ctl_t *AlsaCtlOpenCtl (CtlSourceT *source, const char *devid);
-PUBLIC int AlsaCtlSubscribe(CtlSourceT *source, snd_ctl_t *ctlDev);
-PUBLIC int AlsaCtlRegister(CtlSourceT *source, snd_pcm_t *pcm, int numid);
-
-// alsa-tools-dump.c
-PUBLIC void AlsaDumpFormats(CtlSourceT *source, snd_pcm_t *pcmHandle);
-PUBLIC char *AlsaDumpPcmUid(snd_pcm_t *pcmHandle, char *buffer, size_t len);
-PUBLIC void AlsaDumpCtlSubdev(CtlSourceT *source, snd_ctl_t *handle);
-PUBLIC void AlsaDumpPcmInfo(CtlSourceT *source, snd_pcm_t *pcm, const char* info);
-PUBLIC void AlsaDumpPcmParams(CtlSourceT *source, snd_pcm_hw_params_t *pcmHwParams);
-PUBLIC void AlsaDumpCtlConfig(CtlSourceT *source, snd_config_t *config, int indent);
-#define AlsaPcmUID(pcmHandle, buffer) AlsaDumpPcmUid(pcmHandle, buffer, sizeof(buffer))
-PUBLIC char *AlsaDumpCtlUid(snd_ctl_t *ctlHandle, char *buffer, size_t len);
-#define AlsaCtlUID(ctlHandle, buffer) AlsaDumpCtlUid(ctlHandle, buffer, sizeof(buffer))
-
-// alsa-tools-bypath.c
+// alsa-utils-bypath.c
typedef struct {
- char *devpath;
- char *devid;
+ const char *devpath;
+ const char *devid;
int device;
int subdev;
int numid;
-} AlsaDevByPathT;
+ int cardid;
+ snd_pcm_t *handle;
+} AlsaPcmInfoT;
-PUBLIC snd_ctl_card_info_t* AlsaByPathInfo (CtlSourceT *source, const char *control);
-PUBLIC snd_pcm_t* AlsaByPathOpenPcm(CtlSourceT *source, AlsaDevByPathT *dev, snd_pcm_stream_t direction);
-PUBLIC snd_ctl_t *AlsaByPathOpenCtl (CtlSourceT *source, AlsaDevByPathT *dev);
-#define ALSA_PCM_DEFAULT_FORMAT (unsigned int)-99
-#define ALSA_PCM_DEFAULT_ACCESS (snd_pcm_access_t)-99
-#define ALSA_PCM_DEFAULT_RATE (snd_pcm_format_t)-99
-#define ALSA_PCM_DEFAULT_CHANNELS (unsigned int)-99
-
-// alsa-pcm.c
typedef struct {
- snd_pcm_format_t format;
+ unsigned int rate;
unsigned int channels;
+ snd_pcm_format_t format;
+ snd_pcm_access_t access;
size_t sampleSize;
- unsigned int rate;
} AlsaPcmHwInfoT;
-PUBLIC void AlsaPcmSetDefault (snd_pcm_format_t format, snd_pcm_access_t access, unsigned int rate, unsigned int channel);
-PUBLIC int AlsaPcmConf(CtlSourceT *source, snd_pcm_t *pcmHandle, snd_pcm_format_t pcmFormat, unsigned int pcmRate, unsigned int pcmChannels, AlsaPcmHwInfoT *pcmHwInfo);
-PUBLIC int AlsaPcmCopy(CtlSourceT *source, snd_pcm_t *pcmIn, snd_pcm_t *pcmOut, snd_pcm_format_t format, snd_pcm_access_t access, unsigned int rate, unsigned int channel);
+PUBLIC snd_ctl_card_info_t* AlsaByPathInfo (CtlSourceT *source, const char *control);
+PUBLIC AlsaPcmInfoT* AlsaByPathOpenPcm(CtlSourceT *source, AlsaPcmInfoT *dev, snd_pcm_stream_t direction);
+PUBLIC snd_ctl_t *AlsaByPathOpenCtl (CtlSourceT *source, AlsaPcmInfoT *dev);
+PUBLIC int AlsaByPathDevid (CtlSourceT *source, AlsaPcmInfoT *dev);
+
+// alsa-utils-dump.c
+PUBLIC void AlsaDumpFormats(CtlSourceT *source, snd_pcm_t *pcmHandle);
+PUBLIC char *AlsaDumpPcmUid(snd_pcm_t *pcmHandle, char *buffer, size_t len);
+PUBLIC void AlsaDumpCtlSubdev(CtlSourceT *source, snd_ctl_t *handle);
+PUBLIC void AlsaDumpPcmInfo(CtlSourceT *source, snd_pcm_t *pcm, const char* info);
+PUBLIC void AlsaDumpPcmParams(CtlSourceT *source, snd_pcm_hw_params_t *pcmHwParams);
+PUBLIC void AlsaDumpCtlConfig(CtlSourceT *source, snd_config_t *config, int indent);
+#define ALSA_PCM_UID(pcmHandle, buffer) AlsaDumpPcmUid(pcmHandle, buffer, sizeof(buffer))
+PUBLIC char *AlsaDumpCtlUid(snd_ctl_t *ctlHandle, char *buffer, size_t len);
+#define ALSA_CTL_UID(ctlHandle, buffer) AlsaDumpCtlUid(ctlHandle, buffer, sizeof(buffer))
+
+// alsa-core-ctl.c
+PUBLIC snd_ctl_card_info_t *AlsaCtlGetInfo (CtlSourceT *source, const char *devid);
+PUBLIC snd_ctl_t *AlsaCtlOpenCtl (CtlSourceT *source, const char *devid);
+PUBLIC int AlsaCtlSubscribe(CtlSourceT *source, snd_ctl_t *ctlDev);
+PUBLIC int AlsaCtlRegister(CtlSourceT *source, AlsaPcmInfoT *pcm, int numid);
+PUBLIC int AlsaCtlGetNumidValueI(CtlSourceT *source, snd_ctl_t* ctlDev, int numid, long* value);
+
+
-// alse-dmix.c
-PUBLIC snd_pcm_t* AlsaCreateDmix(CtlSourceT *source, const char *dmixName, const char *slaveName);
-PUBLIC snd_pcm_t* AlsaCreateCapture(CtlSourceT *source, const char* sndDevPath, unsigned int deviceIdx, unsigned int subdevIdx, unsigned int channelCount);
+PUBLIC int AlsaPcmConf(CtlSourceT *source, AlsaPcmInfoT *pcm, AlsaPcmHwInfoT *opts);
+PUBLIC int AlsaPcmCopy(CtlSourceT *source, AlsaPcmInfoT *pcmIn, AlsaPcmInfoT *pcmOut, AlsaPcmHwInfoT *opts);
+// _snd_pcm_PLUGIN_open_ see macro ALSA_PLUG_PROTO(plugin)
+PUBLIC AlsaPcmInfoT* AlsaCreateDmix(CtlSourceT *source, const char* pcmName, AlsaPcmInfoT *pcmSlave);
+PUBLIC AlsaPcmInfoT* AlsaCreateVol(CtlSourceT *source, const char *pcmName, AlsaPcmInfoT* ctlTarget, AlsaPcmInfoT* pcmSlave);
#endif \ No newline at end of file