summaryrefslogtreecommitdiff
path: root/servers/audio_server.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-11-25 00:07:54 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-11-25 00:09:40 -0300
commitbc2e8d99e5ae0dbd69e712cc71da3033f5f30139 (patch)
treed836011e3d5873e3ceea328ea3100f3c7719ab99 /servers/audio_server.cpp
parent7dfba3cda9f13427f9f10a6eefbec52aef62274c (diff)
Made Vector::ptrw explicit for writing, compiler was sometimes using the wrong function,
leading to unnecesary copy on writes and reduced performance.
Diffstat (limited to 'servers/audio_server.cpp')
-rw-r--r--servers/audio_server.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 6a10d7539d..a08733de87 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -191,7 +191,7 @@ void AudioServer::_driver_process(int p_frames, int32_t *p_buffer) {
if (master->channels[k].active) {
- AudioFrame *buf = master->channels[k].buffer.ptr();
+ const AudioFrame *buf = master->channels[k].buffer.ptr();
for (int j = 0; j < to_copy; j++) {
@@ -296,7 +296,7 @@ void AudioServer::_mix_step() {
if (bus->channels[k].active && !bus->channels[k].used) {
//buffer was not used, but it's still active, so it must be cleaned
- AudioFrame *buf = bus->channels[k].buffer.ptr();
+ AudioFrame *buf = bus->channels[k].buffer.ptrw();
for (uint32_t j = 0; j < buffer_size; j++) {
@@ -316,7 +316,7 @@ void AudioServer::_mix_step() {
if (!bus->channels[k].active)
continue;
- bus->channels[k].effect_instances[j]->process(bus->channels[k].buffer.ptr(), temp_buffer[k].ptr(), buffer_size);
+ bus->channels[k].effect_instances[j]->process(bus->channels[k].buffer.ptr(), temp_buffer[k].ptrw(), buffer_size);
}
//swap buffers, so internal buffer always has the right data
@@ -350,7 +350,7 @@ void AudioServer::_mix_step() {
if (!bus->channels[k].active)
continue;
- AudioFrame *buf = bus->channels[k].buffer.ptr();
+ AudioFrame *buf = bus->channels[k].buffer.ptrw();
AudioFrame peak = AudioFrame(0, 0);
@@ -414,7 +414,7 @@ AudioFrame *AudioServer::thread_get_channel_mix_buffer(int p_bus, int p_buffer)
ERR_FAIL_INDEX_V(p_bus, buses.size(), NULL);
ERR_FAIL_INDEX_V(p_buffer, buses[p_bus]->channels.size(), NULL);
- AudioFrame *data = buses[p_bus]->channels[p_buffer].buffer.ptr();
+ AudioFrame *data = buses[p_bus]->channels[p_buffer].buffer.ptrw();
if (!buses[p_bus]->channels[p_buffer].used) {
buses[p_bus]->channels[p_buffer].used = true;