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

#include "../api/AudioSource.h"

using namespace crepe;
using namespace std;

void AudioSystem::update() {
	ComponentManager & mgr = this->component_manager;
	vector<reference_wrapper<AudioSource>> components = mgr.get_components_by_type<AudioSource>();

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

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