• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

P3D v5 Replacing default sound files

DragonflightDesign

Resource contributor
Messages
1,096
Country
northernireland
I want to temporarily replace a default sound file during a check routine; specifically the autopilot disconnect sound. I have a suspicion that the default files may be locked while the sim is active because I don't seem to be able to do it. The absolute paths in the code are created at load time using GetModuleFilename to locate where the sim is running.
Code:
                // Silence the autopilot disconnect
                memset(ap_name, 0, 256);
                memset(ap_replace, 0, 256);
                strncpy(ap_name, globalSounds, strlen(globalSounds));   // globalSounds is the absolute path to the sim's \sound folder
                strncat(ap_name, "caapdis.wav\0", 12);
                strncpy(ap_replace, soundPath, strlen(soundPath));      // soundPath is the absolute path to the simobject's \sound folder
                strncat(ap_replace, "caapdis_s.wav\0", 14);
                if (findFile(ap_name) == TRUE)                          // findFile checks that the file does actually exist
                {
                    if (findFile(ap_replace) == TRUE)
                    {
                       // Both if these return -1 (failure)
                        chd = remove(ap_name);
                        chd = rename(ap_name,ap_replace);
                    }
                }

Yes, I am aware that this could cause a problem if there is a CTD while caapdis.wav has been replaced.
 
Messages
2,079
Country
us-ohio
Is this for FS2020? If so, just one more reason to not develop for that mess... Yeesh!
 

DragonflightDesign

Resource contributor
Messages
1,096
Country
northernireland
Confirmed the files are locked. Just tried moving the caapdis.wav file when P3D was running and got 'The action cannot be completed because the file is open in Prepar3d exe'.
 
Last edited:
Messages
2,079
Country
us-ohio
In the sound.cfg file there is an entry named AP_DISENGAGE_SOUND and you can add flags=1 to disable the sound so that your own disconnect sound is the only one that plays. This assumes you are developing for a specific aircraft.
 

DragonflightDesign

Resource contributor
Messages
1,096
Country
northernireland
Many, many thanks Ed. I know nothing about the sound.cfg file, so now that's one more thing on the list to learn.
 
Top