38 snd_output_close(log);
59 int open(
const char *device, snd_pcm_stream_t streamType,
const int block) {
60 std::cout<<
"opening the device "<<device<<std::endl;
61 int ret=snd_pcm_open(
getPCMP(), device, streamType, block);
63 std::cerr<<
"Couldn't open the device "<<snd_strerror(ret)<<std::endl;
75 ret=snd_pcm_close(
getPCM());
87 ret=snd_pcm_drop(
getPCM());
89 std::cout<<
"PCM::drop can't drop, not running"<<std::endl;
98 return snd_pcm_drain(
getPCM());
106 return snd_pcm_reset(
getPCM());
110 snd_output_stdio_attach(&log, stdout, 0);
117 printf(
"errorlogging not enabled, call enableLog first.\n");
124 snd_pcm_status_t *status;
125 snd_pcm_status_alloca(&status);
126 if ((err = snd_pcm_status(
getPCM(), status)) < 0)
127 printf(
"Stream status error: %s\n", snd_strerror(err));
129 snd_pcm_status_dump(status, log);
139 return snd_pcm_dump(
getPCM(), log);
147 return snd_pcm_dump_setup(
getPCM(), log);
155 return snd_pcm_dump_hw_setup(
getPCM(), log);
163 return snd_pcm_dump_sw_setup(
getPCM(), log);
168 return snd_pcm_start(
getPCM());
173 return snd_pcm_state(
getPCM());
178 return snd_pcm_state_name(
getState());
184 return getState()==SND_PCM_STATE_PREPARED;
191 return getState()==SND_PCM_STATE_OPEN;
198 return getState()==SND_PCM_STATE_SETUP;
205 return getState()==SND_PCM_STATE_RUNNING;
212 return getState()==SND_PCM_STATE_XRUN;
219 return getState()==SND_PCM_STATE_DRAINING;
226 return getState()==SND_PCM_STATE_PAUSED;
233 return getState()==SND_PCM_STATE_SUSPENDED;
240 return getState()==SND_PCM_STATE_DISCONNECTED;
#define PCM_NOT_OPEN_CHECK_STRING(pcm)
#define PCM_NOT_OPEN_CHECK_NO_PRINT(pcm, type)
virtual snd_pcm_t * getPCM()
const char * getStateName()
#define PCM_NOT_OPEN_CHECK(pcm)
int open(const char *device, snd_pcm_stream_t streamType, const int block)
snd_output_t * log
The log stream if enabled.
snd_pcm_t * handle
PCM handle.
snd_pcm_state_t getState()