Audio mixer window

This commit is contained in:
Antoine Pilote
2023-04-03 00:37:40 -04:00
parent 1532724a5d
commit 6b018aeb32
6 changed files with 65 additions and 11 deletions

View File

@@ -0,0 +1,36 @@
#pragma once
#include "imgui/imgui.h"
class AudioWindow
{
public:
AudioWindow() = default;
~AudioWindow() = default;
float dummyVolume = 1.0f;
void Draw()
{
constexpr int numBus = 6;
if(ImGui::Begin("Audio mixer"))
{
for (int i = 0; i < numBus; i++)
{
const std::string busName = "Bus " + std::to_string(i);
ImGui::BeginTable(busName.c_str(), 1, 0, ImVec2(300, ImGui::GetContentRegionAvail().y));
ImGui::TableSetupColumn(busName.c_str(), 0, 1.0f);
ImGui::TableNextColumn ();
ImGui::TableHeader(busName.c_str());
ImGui::TableNextColumn();
const float height = ImGui::GetContentRegionAvail().y - 50;
const std::string id = "##Volume" + std::to_string(i);
ImGui::VSliderFloat(id.c_str(), ImVec2(50, height), &dummyVolume, -60.0f, 6.0f, "%.3dB", ImGuiSliderFlags_Logarithmic);
ImGui::TableNextColumn();
ImGui::EndTable();
}
}
ImGui::End();
}
};

View File

@@ -55,7 +55,7 @@ namespace Nuake {
{
filesystem = new FileSystemUI(this);
_WelcomeWindow = new WelcomeWindow(this);
_audioWindow = new AudioWindow();
m_EntitySelectionFramebuffer = CreateRef<FrameBuffer>(false, Vector2(1280, 720));
}
@@ -1463,6 +1463,8 @@ namespace Nuake {
pInterface.m_CurrentProject = Engine::GetProject();
_audioWindow->Draw();
DrawMenuBar();
pInterface.DrawEntitySettings();

View File

@@ -4,13 +4,17 @@
#include <src/Vendors/imgui/ImGuizmo.h>
#include "src/Core/FileSystem.h"
#include "../Actions/EditorSelection.h"
#include "EditorSelectionPanel.h"
#include "WelcomeWindow.h"
#include "AudioWindow.h"
namespace Nuake {
namespace Nuake
{
class Material;
class FileSystemUI;
class EditorInterface
{
private:
@@ -32,6 +36,7 @@ namespace Nuake {
bool m_IsMaterialSelected = false;
public:
WelcomeWindow* _WelcomeWindow;
AudioWindow* _audioWindow;
FileSystemUI* filesystem;
EditorSelection Selection;
EditorSelectionPanel SelectionPanel;

View File

@@ -22,20 +22,14 @@ namespace Nuake
void AudioManager::PlayTTS(const std::string& text)
{
SoLoud::Speech speech;
speech.setText(text.c_str());
_soloud->play(speech);
// Wait until sounds have finished
while (_soloud->getActiveVoiceCount() > 0)
{
// Still going, sleep for a bit
SoLoud::Thread::sleep(100);
}
}
void AudioManager::AudioThreadLoop()
{
SoLoud::Speech speech;
speech.setText("Nuake");
_soloud->play(speech);
while(_audioThreadRunning)
{

View File

@@ -7,6 +7,7 @@
namespace SoLoud
{
class Soloud;
class AudioSource;
}
namespace Nuake
@@ -21,6 +22,7 @@ namespace Nuake
std::thread _audioThread;
std::mutex _audioMutex;
const int MAX_VOICE_COUNT = 32;
public:
AudioManager() = default;
~AudioManager() = default;

View File

@@ -0,0 +1,15 @@
#pragma once
namespace Nuake
{
class AudioSource
{
private:
public:
AudioSource() = default;
~AudioSource() = default;
};
}