21 #include <alsa/pcm_external.h> 22 #include <alsa/pcm_plugin.h> 28 #define STATICFNNAME(name) name##_static 29 #define STATICFNDEF(retType, name) static retType STATICFNNAME(name) (snd_pcm_ioplug_t *io) 30 #define STATICFNBODY(name) {std::cout<<__func__<<std::endl; return static_cast<ALSAPlugin*>(io->private_data)->name();} 31 #define STATICFN(retType, name) STATICFNDEF(retType, name) STATICFNBODY(name) 42 static snd_pcm_sframes_t transfer_static(snd_pcm_ioplug_t *io, const snd_pcm_channel_area_t *
areas, snd_pcm_uframes_t
offset, snd_pcm_uframes_t
size){
43 std::cout<<__func__<<std::endl;
48 std::cout<<__func__<<std::endl;
54 virtual int HWParams(snd_pcm_hw_params_t *params){
55 std::cout<<__func__<<std::endl;
68 assert(
"not debugged");
69 std::cout<<__func__<<std::endl;
70 io.version = SND_PCM_IOPLUG_VERSION;
71 setName(
"ALSAPlugin default name");
80 ioplugCallback.transfer=transfer_static;
85 std::cout<<__func__<<std::endl;
91 virtual int parseConfig(
const char *name, snd_config_t *conf, snd_pcm_stream_t stream,
int mode){
102 if (snd_pcm_state(slave) == SND_PCM_STATE_RUNNING)
105 return snd_pcm_start(slave);
111 return snd_pcm_drop(slave);
115 virtual snd_pcm_sframes_t
pointer()=0;
119 int create(
const char *name, snd_pcm_stream_t stream,
int mode){
120 return snd_pcm_ioplug_create(&io, name, stream, mode);
131 std::cout<<
'\t'<<__func__<<
'\t'<<__LINE__<<std::endl;
143 #endif // ALSAPLUGIN_H void setName(const char *name)
The slave.
virtual snd_pcm_sframes_t transfer(const snd_pcm_channel_area_t *areas, snd_pcm_uframes_t offset, snd_pcm_uframes_t size)
virtual int stop()
stop method
virtual snd_pcm_sframes_t pointer()=0
virtual pointer method
stop const snd_pcm_channel_area_t * areas
stop const snd_pcm_channel_area_t snd_pcm_uframes_t offset
snd_pcm_ioplug_callback_t ioplugCallback
The ALSA plugin.
#define STATICFNNAME(name)
STATICFN(int, start) STATICFN(int
The callback functions.
virtual int parseConfig(const char *name, snd_config_t *conf, snd_pcm_stream_t stream, int mode)
virtual int start()
start method
virtual int HWParams(snd_pcm_hw_params_t *params)
stop const snd_pcm_channel_area_t snd_pcm_uframes_t snd_pcm_uframes_t size
virtual snd_pcm_t * getPCM()
int create(const char *name, snd_pcm_stream_t stream, int mode)
static int HWParams_static(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params)