00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef PULSE_AUDIO_DRIVER_H
00023 #define PULSE_AUDIO_DRIVER_H
00024
00025 #include "Driver.h"
00026 #include "defines.h"
00027 #include <pulse/pulseaudio.h>
00028
00029 class PulseAudioDriver : public Driver
00030 {
00031 public:
00032 PulseAudioDriver(AudioDevice* dev, int rate, nframes_t bufferSize);
00033 ~PulseAudioDriver();
00034
00035 int process_callback (nframes_t nframes);
00036 int _read(nframes_t nframes);
00037 int _write(nframes_t nframes);
00038 int _run_cycle();
00039 int setup(bool capture=true, bool playback=true, const QString& cardDevice="hw:0");
00040 int attach();
00041 int start();
00042 int stop();
00043
00044 QString get_device_name();
00045 QString get_device_longname();
00046
00047 float get_cpu_load();
00048
00049 void update_config();
00050
00051 private:
00053 pa_mainloop* mainloop;
00054 pa_context *context;
00055 pa_stream *stream;
00056 pa_mainloop_api *mainloop_api;
00057 pa_volume_t volume;
00058 pa_sample_spec sample_spec;
00059 pa_channel_map channel_map;
00060 int channel_map_set;
00061
00062 static void context_state_callback(pa_context *c, void *userdata);
00063 static void stream_state_callback(pa_stream *s, void *userdata);
00064 static void stream_write_callback(pa_stream *s, size_t length, void *userdata);
00065 };
00066
00067
00068 #endif
00069
00070
00071
00072