Setup configuration framework and test music for audio engine.
This commit is contained in:
parent
9d3be5395c
commit
bbc027609b
@ -8,6 +8,17 @@
|
|||||||
"."
|
"."
|
||||||
],
|
],
|
||||||
"propertyTypes": [
|
"propertyTypes": [
|
||||||
|
{
|
||||||
|
"id": 27,
|
||||||
|
"name": "BGM",
|
||||||
|
"storageType": "string",
|
||||||
|
"type": "enum",
|
||||||
|
"values": [
|
||||||
|
"None",
|
||||||
|
"foresty_1_1"
|
||||||
|
],
|
||||||
|
"valuesAsFlags": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"color": "#ff290aa4",
|
"color": "#ff290aa4",
|
||||||
"drawFill": true,
|
"drawFill": true,
|
||||||
@ -160,6 +171,12 @@
|
|||||||
"drawFill": true,
|
"drawFill": true,
|
||||||
"id": 19,
|
"id": 19,
|
||||||
"members": [
|
"members": [
|
||||||
|
{
|
||||||
|
"name": "Background Music",
|
||||||
|
"propertyType": "BGM",
|
||||||
|
"type": "string",
|
||||||
|
"value": "None"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Level Type",
|
"name": "Level Type",
|
||||||
"propertyType": "LevelType",
|
"propertyType": "LevelType",
|
||||||
|
@ -642,6 +642,8 @@
|
|||||||
<None Include="cpp.hint" />
|
<None Include="cpp.hint" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<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\Ranger.txt" />
|
||||||
<Text Include="assets\config\classes\Thief.txt" />
|
<Text Include="assets\config\classes\Thief.txt" />
|
||||||
<Text Include="assets\config\classes\Trapper.txt" />
|
<Text Include="assets\config\classes\Trapper.txt" />
|
||||||
|
@ -43,4 +43,18 @@ INCLUDE_game
|
|||||||
|
|
||||||
MiniAudio&Audio::Engine(){
|
MiniAudio&Audio::Engine(){
|
||||||
return game->audioEngine.audioEngine;
|
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 endregion
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "olcPGEX_MiniAudio.h"
|
#include "olcPGEX_MiniAudio.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
class Audio{
|
class Audio{
|
||||||
|
class BGM{
|
||||||
|
std::vector<int>channels;
|
||||||
|
public:
|
||||||
|
Load();
|
||||||
|
Unload();
|
||||||
|
};
|
||||||
MiniAudio audioEngine;
|
MiniAudio audioEngine;
|
||||||
public:
|
public:
|
||||||
static MiniAudio&Engine();
|
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 "VisualNovel.h"
|
||||||
#include "State_OverworldMap.h"
|
#include "State_OverworldMap.h"
|
||||||
#include "SaveFile.h"
|
#include "SaveFile.h"
|
||||||
|
#include "Audio.h"
|
||||||
|
|
||||||
INCLUDE_MONSTER_LIST
|
INCLUDE_MONSTER_LIST
|
||||||
INCLUDE_game
|
INCLUDE_game
|
||||||
@ -106,7 +107,7 @@ void State_OverworldMap::OnUserUpdate(AiL*game){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(game->GetKey(K1).bPressed){
|
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
|
#pragma region Handle Connection Point Clicking and Movement
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 1
|
#define VERSION_PATCH 1
|
||||||
#define VERSION_BUILD 5350
|
#define VERSION_BUILD 5353
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<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>
|
<properties>
|
||||||
|
<property name="Background Music" propertytype="BGM" value="foresty_1_1"/>
|
||||||
<property name="Level Type" propertytype="LevelType" value="Dungeon"/>
|
<property name="Level Type" propertytype="LevelType" value="Dungeon"/>
|
||||||
</properties>
|
</properties>
|
||||||
<tileset firstgid="1" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>
|
<tileset firstgid="1" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>
|
||||||
|
25
Adventures in Lestoria/assets/config/bgm/bgm.txt
Normal file
25
Adventures in Lestoria/assets/config/bgm/bgm.txt
Normal file
@ -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%
|
||||||
|
}
|
||||||
|
}
|
6
Adventures in Lestoria/assets/config/bgm/events.txt
Normal file
6
Adventures in Lestoria/assets/config/bgm/events.txt
Normal file
@ -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
|
# Path to bgm files
|
||||||
bgm_directory = assets/music/
|
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
|
# Path to character images
|
||||||
character_image_location = characters/
|
character_image_location = characters/
|
||||||
|
|
||||||
|
BIN
Adventures in Lestoria/assets/music/foresty1_1_1.mp3
Normal file
BIN
Adventures in Lestoria/assets/music/foresty1_1_1.mp3
Normal file
Binary file not shown.
BIN
Adventures in Lestoria/assets/music/foresty1_1_2.mp3
Normal file
BIN
Adventures in Lestoria/assets/music/foresty1_1_2.mp3
Normal file
Binary file not shown.
BIN
Adventures in Lestoria/assets/music/foresty1_1_alt1.mp3
Normal file
BIN
Adventures in Lestoria/assets/music/foresty1_1_alt1.mp3
Normal file
Binary file not shown.
BIN
Adventures in Lestoria/assets/music/foresty1_1_alt2.mp3
Normal file
BIN
Adventures in Lestoria/assets/music/foresty1_1_alt2.mp3
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user