| 339 | } |
| 340 | |
| 341 | void Port::fromJson(json_t* rootJ) { |
| 342 | setDriverId(-1); |
| 343 | |
| 344 | json_t* driverJ = json_object_get(rootJ, "driver"); |
| 345 | if (driverJ) |
| 346 | setDriverId(json_number_value(driverJ)); |
| 347 | |
| 348 | json_t* deviceNameJ = json_object_get(rootJ, "deviceName"); |
| 349 | if (deviceNameJ) { |
| 350 | std::string deviceName = json_string_value(deviceNameJ); |
| 351 | // Search for device ID with equal name |
| 352 | for (int deviceId : getDeviceIds()) { |
| 353 | std::string deviceNameCurr = getDeviceName(deviceId); |
| 354 | if (deviceNameCurr == "") |
| 355 | continue; |
| 356 | if (deviceNameCurr == deviceName) { |
| 357 | setDeviceId(deviceId); |
| 358 | break; |
| 359 | } |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | json_t* sampleRateJ = json_object_get(rootJ, "sampleRate"); |
| 364 | if (sampleRateJ) |
| 365 | setSampleRate(json_number_value(sampleRateJ)); |
| 366 | |
| 367 | json_t* blockSizeJ = json_object_get(rootJ, "blockSize"); |
| 368 | if (blockSizeJ) |
| 369 | setBlockSize(json_integer_value(blockSizeJ)); |
| 370 | |
| 371 | json_t* inputOffsetJ = json_object_get(rootJ, "inputOffset"); |
| 372 | if (inputOffsetJ) |
| 373 | inputOffset = json_integer_value(inputOffsetJ); |
| 374 | |
| 375 | json_t* outputOffsetJ = json_object_get(rootJ, "outputOffset"); |
| 376 | if (outputOffsetJ) |
| 377 | outputOffset = json_integer_value(outputOffsetJ); |
| 378 | } |
| 379 | |
| 380 | //////////////////// |
| 381 | // audio |
nothing calls this directly
no outgoing calls
no test coverage detected