mirror of
https://gitlab.com/square-game-liberation-front/F.E.I.S.git
synced 2025-02-28 15:30:32 +01:00
Start adding the audio preview play button
This commit is contained in:
parent
dac05abe03
commit
07d409adf6
@ -1,5 +1,6 @@
|
||||
#include "editor_state.hpp"
|
||||
|
||||
#include <SFML/Audio/Music.hpp>
|
||||
#include <SFML/Audio/SoundSource.hpp>
|
||||
#include <SFML/Audio/SoundStream.hpp>
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
@ -72,6 +73,7 @@ EditorState::EditorState(
|
||||
history.mark_as_saved();
|
||||
reload_music();
|
||||
reload_jacket();
|
||||
reload_preview_audio();
|
||||
};
|
||||
|
||||
int EditorState::get_volume() const {
|
||||
@ -110,6 +112,19 @@ void EditorState::speed_down() {
|
||||
set_speed(speed - 1);
|
||||
}
|
||||
|
||||
void EditorState::play_music_preview() {
|
||||
if (song.metadata.use_preview_file) {
|
||||
if (preview_audio) {
|
||||
if (preview_audio->getStatus() == sf::Music::Playing) {
|
||||
preview_audio->stop();
|
||||
} else {
|
||||
preview_audio->stop();
|
||||
preview_audio->play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Interval<sf::Time>& EditorState::get_editable_range() {
|
||||
reload_editable_range();
|
||||
@ -530,6 +545,10 @@ void EditorState::display_file_properties() {
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("Preview");
|
||||
if (ImGui::ArrowButton("Play", ImGuiDir_Right)) {
|
||||
play_music_preview();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Checkbox("Use separate preview file", &song.metadata.use_preview_file)) {
|
||||
if (song.metadata.use_preview_file) {
|
||||
history.push(std::make_shared<ChangePreview>(song.metadata.preview_loop, song.metadata.preview_file));
|
||||
|
@ -72,6 +72,8 @@ public:
|
||||
|
||||
std::optional<sf::Music> preview_audio;
|
||||
|
||||
void play_music_preview();
|
||||
|
||||
Playfield playfield;
|
||||
LinearView linear_view;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user