| 226 | } |
| 227 | |
| 228 | void ExportFilePanel::Init(const wxFileName& filename, |
| 229 | int sampleRate, |
| 230 | const wxString& format, |
| 231 | int channels, |
| 232 | const ExportProcessor::Parameters& parameters, |
| 233 | const MixerOptions::Downmix* mixerSpec) |
| 234 | { |
| 235 | mFolder->SetValue(filename.GetPath()); |
| 236 | mFullName->SetValue(filename.GetFullName()); |
| 237 | mSampleRate = sampleRate; |
| 238 | |
| 239 | auto selectedFormatIndex = 0; |
| 240 | if(!format.empty()) |
| 241 | { |
| 242 | auto counter = 0; |
| 243 | for(auto [plugin, formatIndex] : ExportPluginRegistry::Get()) |
| 244 | { |
| 245 | if(plugin->GetFormatInfo(formatIndex).format.IsSameAs(format)) |
| 246 | { |
| 247 | selectedFormatIndex = counter; |
| 248 | break; |
| 249 | } |
| 250 | ++counter; |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | if(mixerSpec != nullptr) |
| 255 | { |
| 256 | assert(!mMonoStereoMode); |
| 257 | *mMixerSpec = *mixerSpec; |
| 258 | mCustomMapping->SetValue(true); |
| 259 | } |
| 260 | else |
| 261 | { |
| 262 | int numChannels = channels; |
| 263 | if(numChannels == 0) |
| 264 | { |
| 265 | numChannels = 1; |
| 266 | const auto waveTracks = |
| 267 | ExportUtils::FindExportWaveTracks( |
| 268 | TrackList::Get(mProject), |
| 269 | false); |
| 270 | for(const auto track : waveTracks) |
| 271 | { |
| 272 | if(track->NChannels() >= 2 || track->GetPan() != .0f) |
| 273 | { |
| 274 | numChannels = 2; |
| 275 | break; |
| 276 | } |
| 277 | } |
| 278 | } |
| 279 | if(numChannels == 1) |
| 280 | mMono->SetValue(true); |
| 281 | else |
| 282 | mStereo->SetValue(true); |
| 283 | } |
| 284 | |
| 285 | mFormat->SetSelection(selectedFormatIndex); |
no test coverage detected