42 #include "EST_Option.h"
47 #include <pulse/simple.h>
48 #include <pulse/error.h>
50 int pulse_supported = TRUE;
51 const static char *err_prefix =
"Pulseaudio: ";
62 ss.format = PA_SAMPLE_S16NE;
66 waveform = inwave.values().
memory();
74 if (num_samples <= 0) {
79 s = pa_simple_new(NULL,
81 record ? PA_STREAM_RECORD : PA_STREAM_PLAYBACK,
83 record ?
"Record" :
"Speech",
90 cerr << err_prefix << pa_strerror(err) << endl;
95 pa_simple_read (s, waveform, num_samples*
sizeof(
short), &err) :
96 pa_simple_write(s, waveform, num_samples*sizeof(short), &err);
99 cerr << err_prefix << pa_strerror(err) << endl;
103 if (!record && pa_simple_drain(s, &err) < 0) {
104 cerr << err_prefix << pa_strerror(err) << endl;
117 return transfer_pulse_wave(inwave, al, 0);
122 return transfer_pulse_wave(inwave, al, 1);
126 int pulse_supported = FALSE;
132 cerr <<
"Audio: pulse not compiled in this version" << endl;
140 cerr <<
"Audio: pulse not compiled in this version" << endl;
A class for storing digital waveforms. The waveform is stored as an array of 16 bit shorts...
int num_samples() const
return the number of samples in the waveform
int sample_rate() const
return the sampling rate (frequency)