22 std::string audiodev_id;
25 virtio_sound_pci(
const sc_core::sc_module_name& name, sc_core::sc_object* o, sc_core::sc_object* t)
26 : virtio_sound_pci(name, *(
dynamic_cast<QemuInstance*
>(o)), (
dynamic_cast<qemu_gpex*
>(t)))
30 virtio_sound_pci(
const sc_core::sc_module_name& name,
QemuInstance& inst, qemu_gpex* gpex,
31 const std::string& driver =
"alsa")
34 , audiodev_id(std::string(sc_core::sc_module::name()) +
"-id")
36 std::stringstream opts;
37 opts << driver <<
",id=" << audiodev_id;
39 m_inst.add_arg(
"-audiodev");
40 m_inst.add_arg(opts.str().c_str());
42 gpex->add_device(*
this);
45 void before_end_of_elaboration()
override
47 qemu_gpex::Device::before_end_of_elaboration();
49 m_dev.set_prop_str(
"audiodev", audiodev_id.c_str());