MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / OnLoadSound

Method OnLoadSound

editor/WorldSoundsDialog.cpp:450–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448}
449
450void CWorldSoundsDialog::OnLoadSound() {
451 char filename[255];
452 int raw_handle;
453 int sound_handle;
454 int c = 1, finding_name = 1;
455
456 // Get the filename of the representing image
457
458 CString filter = "Descent III files (*.wav)|*.wav||";
459
460 if (!OpenFileDialog(this, (LPCSTR)filter, filename, Current_sounds_dir, sizeof(Current_sounds_dir)))
461 return;
462
463 sound_handle = D3EditState.current_sound;
464
465 // Okay, we selected a file. Lets do what needs to be done here.
466 raw_handle = LoadSoundFile(filename, Sounds[sound_handle].import_volume, true);
467
468 if (raw_handle < 0) {
469 OutrageMessageBox("Invalid sound file.");
470 return;
471 }
472
473 Sounds[sound_handle].sample_index = raw_handle;
474
475 // Finally, save a local copy of the raw
476
477 std::filesystem::path curname = LocalSoundsDir / SoundFiles[Sounds[sound_handle].sample_index].name;
478 cf_CopyFile(curname, filename);
479
480 UpdateDialog();
481}
482
483void CWorldSoundsDialog::OnNextSound() {
484 D3EditState.current_sound = GetNextSound(D3EditState.current_sound);

Callers

nothing calls this directly

Calls 4

OpenFileDialogFunction · 0.85
LoadSoundFileFunction · 0.85
OutrageMessageBoxFunction · 0.85
cf_CopyFileFunction · 0.85

Tested by

no test coverage detected