MCPcopy Create free account
hub / github.com/VCVRack/Rack / setDriverId

Method setDriverId

src/audio.cpp:93–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void Port::setDriverId(int driverId) {
94 // Unset device and driver
95 setDeviceId(-1);
96 driver = NULL;
97 this->driverId = -1;
98
99 // Find driver by ID
100 driver = audio::getDriver(driverId);
101 if (driver) {
102 this->driverId = driverId;
103 }
104 else if (!drivers.empty()) {
105 // Set first driver as default
106 driver = drivers[0].second;
107 this->driverId = drivers[0].first;
108 }
109 else {
110 // No fallback drivers
111 return;
112 }
113
114 // Set default device if exists
115 try {
116 int defaultDeviceId = driver->getDefaultDeviceId();
117 if (defaultDeviceId >= 0)
118 setDeviceId(defaultDeviceId);
119 }
120 catch (Exception& e) {
121 WARN("Audio port could not get default device ID: %s", e.what());
122 }
123}
124
125std::string Port::getDriverName() {
126 if (!driver)

Callers

nothing calls this directly

Calls 4

whatMethod · 0.80
getDriverFunction · 0.70
emptyMethod · 0.45
getDefaultDeviceIdMethod · 0.45

Tested by

no test coverage detected