aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/AudioSystem.cpp
blob: 97cf9663f8f0f175e786c2bbdd703bf82d794c90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "AudioSystem.h"

#include "../api/AudioSource.h"
#include "../manager/ComponentManager.h"
#include "../manager/ResourceManager.h"
#include "../types.h"

using namespace crepe;
using namespace std;

void AudioSystem::update() {
	ComponentManager & component_manager = this->mediator.component_manager;
	ResourceManager & resource_manager = this->mediator.resource_manager;
	RefVector<AudioSource> components = component_manager.get_components_by_type<AudioSource>();

	for (auto component_ref : components) {
		AudioSource & component = component_ref.get();
		if (!component.active) continue;

		Sound & sound = resource_manager.get<Sound>(component.source);
		// TODO: lots of state diffing
	}
}