Setup configuration framework and test music for audio engine.

pull/28/head
sigonasr2 11 months ago
parent 9d3be5395c
commit bbc027609b
  1. 17
      Adventures in Lestoria/Adventures in Lestoria.tiled-project
  2. 2
      Adventures in Lestoria/Adventures in Lestoria.vcxproj
  3. 14
      Adventures in Lestoria/Audio.cpp
  4. 14
      Adventures in Lestoria/Audio.h
  5. 3
      Adventures in Lestoria/State_OverworldMap.cpp
  6. 2
      Adventures in Lestoria/Version.h
  7. 1
      Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx
  8. 25
      Adventures in Lestoria/assets/config/bgm/bgm.txt
  9. 6
      Adventures in Lestoria/assets/config/bgm/events.txt
  10. 6
      Adventures in Lestoria/assets/config/configuration.txt
  11. BIN
      Adventures in Lestoria/assets/music/foresty1_1_1.mp3
  12. BIN
      Adventures in Lestoria/assets/music/foresty1_1_2.mp3
  13. BIN
      Adventures in Lestoria/assets/music/foresty1_1_alt1.mp3
  14. BIN
      Adventures in Lestoria/assets/music/foresty1_1_alt2.mp3

@ -8,6 +8,17 @@
"."
],
"propertyTypes": [
{
"id": 27,
"name": "BGM",
"storageType": "string",
"type": "enum",
"values": [
"None",
"foresty_1_1"
],
"valuesAsFlags": false
},
{
"color": "#ff290aa4",
"drawFill": true,
@ -160,6 +171,12 @@
"drawFill": true,
"id": 19,
"members": [
{
"name": "Background Music",
"propertyType": "BGM",
"type": "string",
"value": "None"
},
{
"name": "Level Type",
"propertyType": "LevelType",

@ -642,6 +642,8 @@
<None Include="cpp.hint" />
</ItemGroup>
<ItemGroup>
<Text Include="assets\config\bgm\bgm.txt" />
<Text Include="assets\config\bgm\events.txt" />
<Text Include="assets\config\classes\Ranger.txt" />
<Text Include="assets\config\classes\Thief.txt" />
<Text Include="assets\config\classes\Trapper.txt" />

@ -43,4 +43,18 @@ INCLUDE_game
MiniAudio&Audio::Engine(){
return game->audioEngine.audioEngine;
}
void Audio::Play(const std::string_view sound){
Engine().Play(std::string(sound));
};
void Audio::PlayBGM(const std::string_view sound,const bool loop=true){
if(Engine().LoadS)
Engine().Play(std::string(sound));
};
std::string operator""_SFX(const char*key,size_t length){
return "sfx_directory"_S+std::string(key,length);
}
std::string operator""_BGM(const char*key,size_t length){
return "bgm_directory"_S+std::string(key,length);
}

@ -37,9 +37,21 @@ All rights reserved.
#pragma endregion
#pragma once
#include "olcPGEX_MiniAudio.h"
#include "config.h"
class Audio{
class BGM{
std::vector<int>channels;
public:
Load();
Unload();
};
MiniAudio audioEngine;
public:
static MiniAudio&Engine();
};
static void Play(const std::string_view sound);
static void PlayBGM(const std::string_view sound,const bool loop=true);
};
std::string operator""_SFX(const char*key,size_t length);
std::string operator""_BGM(const char*key,size_t length);

@ -47,6 +47,7 @@ All rights reserved.
#include "VisualNovel.h"
#include "State_OverworldMap.h"
#include "SaveFile.h"
#include "Audio.h"
INCLUDE_MONSTER_LIST
INCLUDE_game
@ -106,7 +107,7 @@ void State_OverworldMap::OnUserUpdate(AiL*game){
}
if(game->GetKey(K1).bPressed){
Audio::Engine().Play("sfx_directory"_S+"sfx100v2_loop_water_01.mp3");
Audio::Play("sfx100v2_loop_water_01.mp3"_SFX);
}
#pragma region Handle Connection Point Clicking and Movement

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 1
#define VERSION_BUILD 5350
#define VERSION_BUILD 5353
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" class="Map" orientation="orthogonal" renderorder="right-down" width="205" height="205" tilewidth="24" tileheight="24" infinite="0" backgroundcolor="#475500" nextlayerid="9" nextobjectid="164">
<properties>
<property name="Background Music" propertytype="BGM" value="foresty_1_1"/>
<property name="Level Type" propertytype="LevelType" value="Dungeon"/>
</properties>
<tileset firstgid="1" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>

@ -0,0 +1,25 @@
#Song title followed by filenames for individual parts
foresty1_1
{
# High
channel[0]=foresty1_1_1.mp3
# Low
channel[1]=foresty1_1_2.mp3
# Underwater High
channel[2]=foresty1_1_alt1.mp3
# Underwater Low
channel[3]=foresty1_1_alt2.mp3
Default Volume = 70%,50%,0%,0%
# Transition time between one phase to the next.
Fade Speed = 2.0
Events
{
LowHealth = 50%,60%,20%,20%
InCombat = 90%,100%,0%,0%
Underwater = 0%,0%,100%,100%
}
}

@ -0,0 +1,6 @@
Events
{
LowHealth = "Occurs when the player is low in health."
InCombat = "Occurs when the player is in combat."
Underwater = "Occurs when the player is in water."
}

@ -65,6 +65,12 @@ sfx_directory = assets/sounds/
# Path to bgm files
bgm_directory = assets/music/
# Path to bgm configuration
bgm_config = bgm.txt
# Path to bgm events configuration
event_config = events.txt
# Path to character images
character_image_location = characters/

Loading…
Cancel
Save