MCPcopy Create free account
hub / github.com/audacity/audacity / Init

Method Init

src/export/ExportFilePanel.cpp:228–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228void 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);

Callers 1

ExportAudioDialogMethod · 0.45

Calls 13

GetFunction · 0.85
GetFullNameMethod · 0.80
GetPanMethod · 0.80
SetValueMethod · 0.45
GetPathMethod · 0.45
emptyMethod · 0.45
IsSameAsMethod · 0.45
GetFormatInfoMethod · 0.45
NChannelsMethod · 0.45
SetSelectionMethod · 0.45
SetParametersMethod · 0.45
EnableMethod · 0.45

Tested by

no test coverage detected