Skip to content

Commit

Permalink
Merge pull request #244 from BlueTheKing/stethoscopeVolume
Browse files Browse the repository at this point in the history
Stethoscope sound volume CBA setting
  • Loading branch information
Tomcat-SG authored Feb 5, 2023
2 parents 79dc8cc + 915eed9 commit 37a3e3a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 32 deletions.
4 changes: 2 additions & 2 deletions addons/breathing/CfgSounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ class CfgSounds
name = "clear_lungs";

// filename, volume, pitch, distance (optional)
sound[] = { QPATHTOF(audio\Clear_Lung_Sounds.ogg), 2, 1, 3 }; // Yethe: First number should be changed so it can be adjusted in cba settings.
sound[] = { QPATHTOF(audio\Clear_Lung_Sounds.ogg), 2, 1, 3 };
titles[] = {};
};
class tensionpneumothorax {
class tensionpneumothoraxbreathing {
name = "tension_lungs";

// filename, volume, pitch, distance (optional)
Expand Down
26 changes: 14 additions & 12 deletions addons/breathing/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -309,18 +309,6 @@ PREP_RECOMPILE_END;
true
] call CBA_Settings_fnc_init;

// sound volume for Stethoscope
/*
[
QGVAR(StethoscopeSoundVolume),
"SLIDER",
[LLSTRING(SETTING_StethoscopeSoundVolume), LLSTRING(DESCRIPTION_StethoscopeSoundVolume)],
CBA_SETTINGS_CAT,
[1, 4, 1, 0],
true
] call CBA_Settings_fnc_init;
*/

//Enables White Flashing on Below 90% SPO2
[
QGVAR(enableSPO2Flashing),
Expand Down Expand Up @@ -351,4 +339,18 @@ PREP_RECOMPILE_END;
true
] call CBA_Settings_fnc_init;

// Sets sound volume of stethoscope
[
QGVAR(stethoscopeSoundVolume),
"SLIDER",
[LLSTRING(SETTING_stethoscopeSoundVolume), LLSTRING(SETTING_stethoscopeSoundVolume_DESC)],
[CBA_SETTINGS_CAT, LSTRING(SubCategory_Basic)],
[0, 4, 2, 1],
2,
{
player setVariable [QGVAR(stethoscopeSoundVolume), _this, true];
},
false
] call CBA_Settings_fnc_init;

ADDON = true;
32 changes: 17 additions & 15 deletions addons/breathing/functions/fnc_listenLungs.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "script_component.hpp"
/*
* Author: Battlekeeper, modified by YetheSamartaka and Tomcat
* Handles listeting to Lungs.
* Handles listening to lungs.
*
* Arguments:
* 0: Medic <OBJECT>
Expand All @@ -22,44 +22,46 @@ params ["_medic","_patient"];

if ((_patient getVariable [QACEGVAR(medical,heartRate), 80]) isEqualTo 0) exitWith {};

private _volume = GVAR(stethoscopeSoundVolume);

_random = round random 1;

if (_patient getVariable [QGVAR(pneumothorax), false]) exitWith {
if (_random >= 0.5) then {
playSound "tensionpneumothorax";
playSoundUI ["tensionpneumothoraxbreathing", _volume, 1];
sleep 7;
playSound "normalbreathing";
playSoundUI ["normalbreathing", _volume, 1];
} else {
playSound "normalbreathing";
playSoundUI ["normalbreathing", _volume, 1];
sleep 7;
playSound "tensionpneumothorax";
playSoundUI ["tensionpneumothoraxbreathing", _volume, 1];
};
};

if (_patient getVariable [QGVAR(hemopneumothorax), false]) exitWith {
if (_random >= 0.5) then {
playSound "hemothoraxbreathing";
playSoundUI ["hemothoraxbreathing", _volume, 1];
sleep 7;
playSound "normalbreathing";
playSoundUI ["normalbreathing", _volume, 1];
} else {
playSound "normalbreathing";
playSoundUI ["normalbreathing", _volume ,1];
sleep 7;
playSound "hemothoraxbreathing";
playSoundUI ["hemothoraxbreathing", _volume, 1];
};
};

if (_patient getVariable [QGVAR(tensionpneumothorax), false]) exitWith {
if (_random >= 0.5) then {
playSound "tensionpneumothorax";
playSoundUI ["tensionpneumothoraxbreathing", _volume, 1];
sleep 7;
playSound "normalbreathing";
playSoundUI ["normalbreathing", _volume, 1];
} else {
playSound "normalbreathing";
playSoundUI ["normalbreathing", _volume, 1];
sleep 7;
playSound "tensionpneumothorax";
playSoundUI ["tensionpneumothoraxbreathing", _volume, 1];
};
};

playSound "normalbreathing";
playSoundUI ["normalbreathing", _volume, 1];
sleep 7;
playSound "normalbreathing";
playSoundUI ["normalbreathing", _volume, 1];
6 changes: 3 additions & 3 deletions addons/breathing/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@
<Russian>Прослушивание</Russian>
<Japanese>聴診中</Japanese>
</Key>
<Key ID="STR_kat_breathing_SETTING_StethoscopeSoundVolume">
<Key ID="STR_kat_breathing_SETTING_stethoscopeSoundVolume">
<English>Stethoscope Sound Volume</English>
<Polish>Głośność Stetoskopu</Polish>
<German>Stethoskop Lautstärke</German>
Expand All @@ -767,8 +767,8 @@
<Russian>Громкость звука стетоскопа</Russian>
<Japanese>聴診器の音量</Japanese>
</Key>
<Key ID="STR_kat_breathing_DESCRIPTION_StethoscopeSoundVolume">
<English>Determines how loud the thorax sounds are when using Stethoscope</English>
<Key ID="STR_kat_breathing_SETTING_stethoscopeSoundVolume_DESC">
<English>Determines how loud the breathing sounds are when using the stethoscope</English>
<Polish>Określa jak głośne są dźwięki klatki piersiowej podczas używania Stetoskopu</Polish>
<German>Bestimmt, wie laut die Thoraxgeräusche bei der Verwendung des Stethoskops sind</German>
<Spanish>Determina qué tan fuertes son los sonidos del tórax cuando se usa el estetoscopio</Spanish>
Expand Down

0 comments on commit 37a3e3a

Please sign in to comment.