GetSelectedProperties collects information about currently selected audio tracks
| 1335 | // GetSelectedProperties collects information about |
| 1336 | // currently selected audio tracks |
| 1337 | PropertiesOfSelected |
| 1338 | GetPropertiesOfSelected(const AudacityProject &proj) |
| 1339 | { |
| 1340 | double rateOfSelection{ RATE_NOT_SELECTED }; |
| 1341 | |
| 1342 | PropertiesOfSelected result; |
| 1343 | result.allSameRate = true; |
| 1344 | |
| 1345 | const auto selectedTracks{ |
| 1346 | TrackList::Get(proj).Selected<const WaveTrack>() }; |
| 1347 | |
| 1348 | for (const auto & track : selectedTracks) { |
| 1349 | if (rateOfSelection != RATE_NOT_SELECTED && |
| 1350 | track->GetRate() != rateOfSelection) |
| 1351 | result.allSameRate = false; |
| 1352 | else if (rateOfSelection == RATE_NOT_SELECTED) |
| 1353 | rateOfSelection = track->GetRate(); |
| 1354 | } |
| 1355 | |
| 1356 | result.anySelected = !selectedTracks.empty(); |
| 1357 | result.rateOfSelected = rateOfSelection; |
| 1358 | |
| 1359 | return result; |
| 1360 | } |
no test coverage detected