1 /************************************************************************************ 2 3 AstroMenace 4 Hardcore 3D space scroll-shooter with spaceship upgrade possibilities. 5 Copyright (c) 2006-2019 Mikhail Kurinnoi, Viewizard 6 7 8 AstroMenace is free software: you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation, either version 3 of the License, or 11 (at your option) any later version. 12 13 AstroMenace is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with AstroMenace. If not, see <https://www.gnu.org/licenses/>. 20 21 22 Website: https://viewizard.com/ 23 Project: https://github.com/viewizard/astromenace 24 E-mail: viewizard@viewizard.com 25 26 *************************************************************************************/ 27 28 #ifndef ASSETS_AUDIO_H 29 #define ASSETS_AUDIO_H 30 31 #include "../core/base.h" 32 33 // NOTE switch to nested namespace definition (namespace A::B::C { ... }) (since C++17) 34 namespace viewizard { 35 namespace astromenace { 36 37 // menu sfx 38 enum class eMenuSFX { 39 OverSmallButton, 40 OverBigButton, 41 Click, 42 SwitchToAnotherMenu, 43 TapingClick, 44 OverLine, 45 SelectLine, 46 CanNotClick, 47 DragError, 48 DragUninstallFromSlot, 49 DragInstallToSlot, 50 DragRelease, 51 MissionShowMenu, // game sfx (2D), keep it here, since this is UI sfx 52 MissionHideMenu, // game sfx (2D), keep it here, since this is UI sfx 53 WarningLowLife // game sfx (2D), keep it here, since this is UI sfx 54 }; 55 56 // game sfx 57 enum class eGameSFX { 58 none, // note, 'none' should be the first element, since variables would be value initialized to 0 59 WeaponMalfunction_Kinetic, // Kinetic 60 WeaponMalfunction_Particle, // Ion, Plasma 61 WeaponMalfunction_Beam, // Maser, Laser 62 WeaponMalfunction_Energy, // Antimatter, Gauss 63 WeaponMalfunction_Launcher, // Missile, Torpedo, Bomb 64 Explosion_Small, // Asteroid 65 Explosion_Medium, // Missiles 66 Explosion_Big, // Torpedo, Alien Ship 67 Explosion_Big_Energy, // Bomb, Ground Object, Earth Fighter, Pirate Ship 68 WeaponFire_Kinetic1, 69 WeaponFire_Kinetic2, 70 WeaponFire_Kinetic3, 71 WeaponFire_Kinetic4, 72 WeaponFire_Ion1, 73 WeaponFire_Ion2, 74 WeaponFire_Ion3, 75 WeaponFire_Plasma1, 76 WeaponFire_Plasma2, 77 WeaponFire_Plasma3, 78 WeaponFire_Maser1, 79 WeaponFire_Maser2, 80 WeaponFire_Antimatter, 81 WeaponFire_Laser, 82 WeaponFire_Gauss, 83 WeaponFire_SmallMissile, 84 WeaponFire_NormalMissile, 85 WeaponFire_Torpedo, 86 WeaponFire_Bomb, 87 Hit_Kinetic, 88 Hit_Ion, 89 Hit_Plasma, 90 Hit_Antimatter, 91 Hit_Gauss 92 }; 93 94 // voice 95 enum class eVoicePhrase { 96 Attention, 97 EngineMalfunction, 98 MissileDetected, 99 PowerSupplyReestablished, 100 PrepareForAction, 101 ReactorMalfunction, 102 Warning, 103 WeaponDamaged, 104 WeaponDestroyed, 105 WeaponMalfunction 106 }; 107 108 // music themes 109 enum class eMusicTheme { 110 NONE, // note, 'NONE' should be the first element, since variables would be value initialized to 0 111 MENU, 112 GAME, 113 BOSS, 114 FAILED, 115 CREDITS 116 }; 117 118 119 // Get all audio assets load value. 120 unsigned GetAudioAssetsLoadValue(); 121 // Cycle with function callback on each audio asset load. 122 void ForEachAudioAssetLoad(std::function<void (unsigned AssetValue)> function); 123 // Reload voice assets for new language. 124 void ReloadVoiceAssets(); 125 // Play menu sfx (2D). 126 unsigned int PlayMenuSFX(eMenuSFX SoundID, float LocalVolume); 127 // Play game sfx (3D). 128 unsigned int PlayGameSFX(eGameSFX GameSFX, float LocalVolume, const sVECTOR3D &Location, int AtType = 1); 129 // Play voice phrase. 130 unsigned int PlayVoicePhrase(eVoicePhrase VoicePhrase, float LocalVolume); 131 // Play music theme with fade-in and fade-out previous music theme (if need). 132 void PlayMusicTheme(eMusicTheme MusicTheme, uint32_t FadeInTicks, uint32_t FadeOutTicks); 133 // Change "global" volume for menu sfx (2D). 134 void ChangeMenuSFXGlobalVolume(float NewGlobalVolume); 135 // Change "global" volume for voice. 136 void ChangeVoiceGlobalVolume(float NewGlobalVolume); 137 // Main audio loop. 138 void AudioLoop(); 139 140 } // astromenace namespace 141 } // viewizard namespace 142 143 #endif // ASSETS_AUDIO_H 144