Commit ce194bf1 authored by Georg Schäfer's avatar Georg Schäfer
Browse files

Play music in play mode.

parent 3dd75bbc
Pipeline #3352 failed with stage
in 3 minutes and 39 seconds
audio: = audio/*.ogg
music: = music/*.ogg
......@@ -85,18 +85,32 @@ namespace phase_shifter {
LOG(plog::info) << "Renderer Memory usage: " << msg.str();
}
});
_level_system->load("dummy");
auto bg_music = engine.assets().load<std::shared_ptr<eam::opus>>("music:pulse"_aid).get_blocking();
_music = engine.audio().generate_context_ptr(bg_music);
_music->get_object()->set_loops(-1);
_music->get_object()->set_position(engine.audio_latency()
/ _music->get_object()->get_length_in_sec());
}
Meta_system::~Meta_system()
{
_music->stop_fade(2.f);
_renderer->device().wait_idle();
_entities.clear();
}
void Meta_system::update(mirrage::util::Time dt)
{
if(_play_music) {
_play_music = false;
_music->play();
} else if(_first_frame) {
_play_music = true;
_first_frame = false;
}
_entities.process_queued_actions();
_beat_system->update(dt);
......
......@@ -4,6 +4,7 @@
#include <mirrage/gui/debug_ui.hpp>
#include <mirrage/utils/units.hpp>
#include <audio.hpp>
namespace mirrage {
namespace renderer {
......@@ -63,18 +64,21 @@ namespace phase_shifter {
std::unique_ptr<mirrage::renderer::Deferred_renderer> _renderer;
std::unique_ptr<mirrage::renderer::Loading_system> _model_loading;
std::unique_ptr<gameplay::Beat_system> _beat_system;
std::unique_ptr<level::Level_system> _level_system;
std::unique_ptr<gameplay::Movement_system> _movement_system;
std::unique_ptr<input::Input_system> _input_system;
std::unique_ptr<gameplay::Combat_system> _combat_system;
std::unique_ptr<helper::Attachment_system> _attachment_system;
std::unique_ptr<ui::Hud_system> _hud_system;
std::unique_ptr<gameplay::Camera_system> _camera_system;
std::unique_ptr<gameplay::Enemy_system> _enemy_system;
std::unique_ptr<gameplay::Dash_system> _dash_system;
std::unique_ptr<gameplay::Beat_system> _beat_system;
std::unique_ptr<level::Level_system> _level_system;
std::unique_ptr<gameplay::Movement_system> _movement_system;
std::unique_ptr<input::Input_system> _input_system;
std::unique_ptr<gameplay::Combat_system> _combat_system;
std::unique_ptr<helper::Attachment_system> _attachment_system;
std::unique_ptr<ui::Hud_system> _hud_system;
std::unique_ptr<gameplay::Camera_system> _camera_system;
std::unique_ptr<gameplay::Enemy_system> _enemy_system;
std::unique_ptr<gameplay::Dash_system> _dash_system;
std::unique_ptr<gameplay::Stationary_attack_system> _stationary_attack_system;
std::unique_ptr<ui::Effect_system> _effect_system;
std::unique_ptr<ui::Effect_system> _effect_system;
std::shared_ptr<eam::context> _music;
bool _first_frame = true;
bool _play_music = false;
mirrage::util::Console_command_container _commands;
};
......
......@@ -113,6 +113,8 @@ namespace phase_shifter {
/ 3.f;
static_cast<Game_engine&>(_engine).audio_latency(_audio_latency);
static_cast<Game_engine&>(_engine).video_latency(_video_latency);
LOG(plog::debug) << "audio latency: " << _audio_latency;
LOG(plog::debug) << "video latency: " << _video_latency;
_engine.screens().enter<Intro_screen>();
}
break;
......@@ -130,7 +132,8 @@ namespace phase_shifter {
case mode::audio_calibration:
_end = std::chrono::high_resolution_clock::now();
_audio_latencies.emplace_back(
std::chrono::duration_cast<std::chrono::seconds>(_end - _start).count());
std::chrono::duration_cast<std::chrono::milliseconds>(_end - _start).count()
/ 1000.f);
_start = std::chrono::high_resolution_clock::now();
break;
case mode::start_video_calibration:
......@@ -140,7 +143,8 @@ namespace phase_shifter {
case mode::video_calibration:
_end = std::chrono::high_resolution_clock::now();
_video_latencies.emplace_back(
std::chrono::duration_cast<std::chrono::seconds>(_end - _start).count());
std::chrono::duration_cast<std::chrono::milliseconds>(_end - _start).count()
/ 1000.f);
_start = std::chrono::high_resolution_clock::now();
break;
default: break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment