00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __JackAlsaDriver__
00022 #define __JackAlsaDriver__
00023
00024 #include "JackAudioDriver.h"
00025 #include "JackThreadedDriver.h"
00026 #include "JackTime.h"
00027 #include "alsa_driver.h"
00028
00029 namespace Jack
00030 {
00031
00036 class JackAlsaDriver : public JackAudioDriver
00037 {
00038
00039 private:
00040
00041 jack_driver_t* fDriver;
00042 int fReservedCaptureDevice;
00043 int fReservedPlaybackDevice;
00044
00045 public:
00046
00047 JackAlsaDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
00048 : JackAudioDriver(name, alias, engine, table),fDriver(NULL),fReservedCaptureDevice(-1),fReservedPlaybackDevice(-1)
00049 {}
00050 virtual ~JackAlsaDriver()
00051 {}
00052
00053 int Open(jack_nframes_t buffer_size,
00054 jack_nframes_t user_nperiods,
00055 jack_nframes_t samplerate,
00056 bool hw_monitoring,
00057 bool hw_metering,
00058 bool capturing,
00059 bool playing,
00060 DitherAlgorithm dither,
00061 bool soft_mode,
00062 bool monitor,
00063 int inchannels,
00064 int outchannels,
00065 bool shorts_first,
00066 const char* capture_driver_name,
00067 const char* playback_driver_name,
00068 jack_nframes_t capture_latency,
00069 jack_nframes_t playback_latency,
00070 const char* midi_driver_name);
00071
00072 int Close();
00073 int Attach();
00074 int Detach();
00075
00076 int Start();
00077 int Stop();
00078
00079 int Read();
00080 int Write();
00081
00082
00083 bool IsFixedBufferSize()
00084 {
00085 return false;
00086 }
00087
00088 int SetBufferSize(jack_nframes_t buffer_size);
00089
00090 void ReadInputAux(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nread);
00091 void MonitorInputAux();
00092 void ClearOutputAux();
00093 void WriteOutputAux(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nwritten);
00094 void SetTimetAux(jack_time_t time);
00095
00096
00097 int is_realtime() const;
00098 int create_thread(pthread_t *thread, int prio, int rt, void *(*start_func)(void*), void *arg);
00099
00100 jack_port_id_t port_register(const char *port_name, const char *port_type, unsigned long flags, unsigned long buffer_size);
00101 int port_unregister(jack_port_id_t port_index);
00102 void* port_get_buffer(int port, jack_nframes_t nframes);
00103 int port_set_alias(int port, const char* name);
00104
00105 jack_nframes_t get_sample_rate() const;
00106 jack_nframes_t frame_time() const;
00107 jack_nframes_t last_frame_time() const;
00108 };
00109
00110 }
00111
00112 #endif