SoundService & SoundInstance

Basic implementation. More work needs to be done.
This commit is contained in:
Modnark
2022-10-11 21:16:14 -04:00
parent d2f3e718a7
commit d269b360ce
9 changed files with 225 additions and 8 deletions

View File

@@ -1,12 +1,17 @@
#pragma once
// Instances
#include "WorkspaceInstance.h"
#include "LevelInstance.h"
#include "PartInstance.h"
#include "ThumbnailGeneratorInstance.h"
#include "SelectionService.h"
#include "rapidxml/rapidxml.hpp"
#include "GuiRootInstance.h"
#include "ThumbnailGeneratorInstance.h"
#include "XplicitNgine/XplicitNgine.h"
#include "SoundService.h"
// Libraries
#include "rapidxml/rapidxml.hpp"
class GuiRootInstance;
@@ -25,10 +30,12 @@ public:
bool readXMLFileStream(std::ifstream* file);
void drawMessage(RenderDevice*);
// Instance getters
WorkspaceInstance* getWorkspace();
LevelInstance* getLevel();
XplicitNgine* getEngine();
ThumbnailGeneratorInstance* getThumbnailGenerator();
SoundService* getSoundService();
std::string message;
std::string _loadedFileName;
@@ -53,11 +60,16 @@ private:
std::string _errMsg;
bool _legacyLoad;
float _modY;
// Instances
WorkspaceInstance* workspace;
LevelInstance* level;
GuiRootInstance* guiRoot;
SelectionService* selectionService;
ThumbnailGeneratorInstance * thumbnailGenerator;
ThumbnailGeneratorInstance* thumbnailGenerator;
XplicitNgine* xplicitNgine;
SoundService* soundService;
bool running;
XplicitNgine * xplicitNgine;
};

View File

@@ -2,7 +2,6 @@
#include <G3DAll.h>
#include "propertyGrid.h"
#include "map"
//#include "Properties/BoolProperty.h"
class Instance
{

View File

@@ -0,0 +1,30 @@
#pragma once
#include "Instance.h"
class SoundInstance :
public Instance
{
public:
SoundInstance(void);
~SoundInstance(void);
// Getters
float getSoundVolume();
std::string getSoundId();
bool isPlayedOnRemove();
bool isLooped();
// Setters
void setSoundVolume(float newVolume);
void setSoundId(std::string newSoundId);
void setIsPlayedOnRemove(bool isPlayed);
void setIsLooped(bool isLooped);
// Functions
void play();
private:
float soundVolume;
std::string soundId;
bool playOnRemove;
bool looped;
};

View File

@@ -0,0 +1,16 @@
#pragma once
#include "Instance.h"
#include "SoundInstance.h"
class SoundService :
public Instance
{
public:
SoundService(void);
~SoundService(void);
float getMusicVolume();
void playSound(SoundInstance* sound);
private:
float musicVolume;
};