2#ifndef __ASE_DRIVER_HH__
3#define __ASE_DRIVER_HH__
11ASE_CLASS_DECLS (Driver);
12ASE_CLASS_DECLS (MidiDriver);
13ASE_CLASS_DECLS (PcmDriver);
24 bool readonly =
false;
25 bool writeonly =
false;
31 struct Flags {
enum { OPENED = 1, READABLE = 2, WRITABLE = 4, }; };
32 const String driver_, devid_;
41 SURROUND = 0x08 << 24,
43 RECORDER = 0x02 << 24,
44 MIDI_THRU = 0x01 << 24,
47 ALSA_USB = 0x2f << 24,
48 ALSA_KERN = 0x3f << 24,
51 ALSA_USER = 0x6f << 24,
59 enum IODir { READONLY = 1, WRITEONLY = 2, READWRITE = 3 };
61 bool opened ()
const {
return flags_ & Flags::OPENED; }
62 bool readable ()
const {
return flags_ & Flags::READABLE; }
63 bool writable ()
const {
return flags_ & Flags::WRITABLE; }
65 virtual void close () = 0;
68 using Entry = DriverEntry;
69 using EntryVec = DriverEntryS;
71using DriverP = Driver::DriverP;
81 virtual bool has_events () = 0;
83 static EntryVec list_drivers ();
94 uint block_length = 0;
106 virtual uint pcm_n_channels ()
const = 0;
107 virtual uint pcm_mix_freq ()
const = 0;
108 virtual uint pcm_block_length ()
const = 0;
109 virtual void pcm_latency (
uint *rlatency,
uint *wlatency)
const = 0;
110 virtual bool pcm_check_io (
int64 *timeoutp) = 0;
111 virtual size_t pcm_read (
size_t n,
float *values) = 0;
112 virtual void pcm_write (
size_t n,
const float *values) = 0;
113 static EntryVec list_drivers ();
Base class for a PCM and MIDI devices.
static String priority_string(uint priority)
Return string which represents the given priority mask.
String devid() const
Return a string which uniquely identifies this driver and device.
Base class for a MIDI devices.
A stream of writable MidiEvent structures.
Base class for a PCM devices.
The Anklang C++ API namespace.
int32_t int32
A 32-bit signed integer.
int64_t int64
A 64-bit unsigned integer, use PRI*64 in format strings.
Error
Enum representing Error states.
bool * register_driver_loader(const char *staticwhat, Error(*loader)())
Register loader callbacks at static constructor time.
std::string String
Convenience alias for std::string.
uint32_t uint
Provide 'uint' as convenience type.
void load_registered_drivers()
Load all registered drivers.
Driver information for PCM and MIDI handling.
PCM device configuration.
T shared_from_this(T... args)