#include "timebase.h"
class ALSAPool;
+class DeviceSpecProto;
class ALSAInput {
public:
// at any given time as a result of an error or hotplug event;
// a card that is held will go to the DEAD state instead.
bool held = false;
+
+ std::string display_name() const { return name + " (" + info + ")"; }
};
void init();
// EMPTY or DEAD state. Only for ALSAInput and for internal use.
void free_card(unsigned index);
- // TODO: Add accessors and/or callbacks about changed state, so that
- // the UI actually stands a chance in using that information.
+ // Create a new card, mark it immediately as DEAD and hold it.
+ // Returns the new index.
+ unsigned create_dead_card(const std::string &name, const std::string &info, unsigned num_channels);
+
+ // Make a protobuf representation of the given card, so that it can be
+ // matched against at a later stage. For AudioMixer only.
+ // The given card must be held.
+ void serialize_device(unsigned index, DeviceSpecProto *serialized);
private:
mutable std::mutex mu;
};
ProbeResult probe_device_once(unsigned card_index, unsigned dev_index);
+ void unplug_device(unsigned card_index, unsigned dev_index);
+
// Must be called with <mu> held. Will allocate a new entry if needed.
// The returned entry will be set to READY state.
- unsigned find_free_device_index();
+ unsigned find_free_device_index(const std::string &name,
+ const std::string &info,
+ unsigned num_channels,
+ const std::string &address);
friend class ALSAInput;
};