June 22, 201312 yr Moderator I have an urgent need to update my sound module to allow for increased flexibility by the users. I have been using a predefined path to the sim's ..\Sound folder such as the following: (GaugePlaySound)("sound\\LHC_X\\SND1.wav","",0) I already know how to use the "fifth parameter" of the gauge entry to include a relative path, such as the following: gauge00=LHC_X_Sound!SoundModule, 0,0,1,1,SimObjects\\Airplanes\\MyAirplane\\panel\\sound CHAR sound_Path[MAX_PATH] = ""; int params_read = 0; case PANEL_SERVICE_POST_INSTALL: if (pgauge->parameters && params_read == 0) { if ( strlen(pgauge->parameters) > 0 ) { strcpy(sound_Path,(PCHAR)(pgauge->parameters)); params_read = 1; } else if ( strlen(pgauge->parameters) == 0 ) { params_read = 1; } What I don't know however is the correct syntax for concantenating the char variable sound_Path so that it will replace the characters highlighted in red: (GaugePlaySound)("sound\\LHC_X\\SND1.wav","",0) Could it possibly be as simple as this: (GaugePlaySound)(strcat(sound_Path,\\SND1.wav),"",0) Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
June 22, 201312 yr Author Moderator strcat(sound_Path,"\\Snd1.wav") Hugo So, maybe I did guess correctly: (GaugePlaySound)(strcat(sound_Path,"\\Snd1.wav"),"",0) I have 200 such entries, so I want to be certain before I do any Search/Replace operation... :Drooling: Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
June 23, 201312 yr NO,NO,NO, strcat(Sound_path,\\SND1.wav) is NOT the same as strcat(Sound_path,"\\SND1.wav") . Sound_path is a variable containing a string, but \\SND1.wav in the first statement is meaningless and the compiler will generate an error for it. In the second statement "\\Snd1.wav" creates locally a new string and the address of this string will be the second parameter for the strcat routine with the wanted result.
June 23, 201312 yr Author Moderator Actually, I did have it correct, but this bloody POS forum editor kept stripping out the quote marks! It took three tries, but I finally coaxed the "code box" to behave itself and (re)edited my previous post... :sorry: Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
Create an account or sign in to comment