feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -294,19 +294,23 @@ void AudioServer::_driver_process(int p_frames, int32_t *p_buffer) {
|
|||
// The destination start for data will be the same in all cases.
|
||||
int32_t *dest = &p_buffer[from_buf * (cs * 2) + (k * 2)];
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (!debug_mute && master->channels[k].active) {
|
||||
#else
|
||||
if (master->channels[k].active) {
|
||||
#endif // DEBUG_ENABLED
|
||||
const AudioFrame *buf = master->channels[k].buffer.ptr();
|
||||
|
||||
for (int j = 0; j < to_copy; j++) {
|
||||
float l = CLAMP(buf[from + j].left, -1.0, 1.0);
|
||||
int32_t vl = l * ((1 << 20) - 1);
|
||||
int32_t vl2 = (vl < 0 ? -1 : 1) * (ABS(vl) << 11);
|
||||
int32_t vl2 = (vl < 0 ? -1 : 1) * (Math::abs(vl) << 11);
|
||||
*dest = vl2;
|
||||
dest++;
|
||||
|
||||
float r = CLAMP(buf[from + j].right, -1.0, 1.0);
|
||||
int32_t vr = r * ((1 << 20) - 1);
|
||||
int32_t vr2 = (vr < 0 ? -1 : 1) * (ABS(vr) << 11);
|
||||
int32_t vr2 = (vr < 0 ? -1 : 1) * (Math::abs(vr) << 11);
|
||||
*dest = vr2;
|
||||
dest += stride_minus_one;
|
||||
}
|
||||
|
|
@ -621,11 +625,11 @@ void AudioServer::_mix_step() {
|
|||
for (uint32_t j = 0; j < buffer_size; j++) {
|
||||
buf[j] *= volume;
|
||||
|
||||
float l = ABS(buf[j].left);
|
||||
float l = Math::abs(buf[j].left);
|
||||
if (l > peak.left) {
|
||||
peak.left = l;
|
||||
}
|
||||
float r = ABS(buf[j].right);
|
||||
float r = Math::abs(buf[j].right);
|
||||
if (r > peak.right) {
|
||||
peak.right = r;
|
||||
}
|
||||
|
|
@ -765,6 +769,16 @@ int AudioServer::thread_find_bus_index(const StringName &p_name) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
void AudioServer::set_debug_mute(bool p_mute) {
|
||||
debug_mute = p_mute;
|
||||
}
|
||||
|
||||
bool AudioServer::get_debug_mute() const {
|
||||
return debug_mute;
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
void AudioServer::set_bus_count(int p_count) {
|
||||
ERR_FAIL_COND(p_count < 1);
|
||||
ERR_FAIL_INDEX(p_count, 256);
|
||||
|
|
@ -1230,6 +1244,7 @@ void AudioServer::start_playback_stream(Ref<AudioStreamPlayback> p_playback, con
|
|||
int idx = 0;
|
||||
for (KeyValue<StringName, Vector<AudioFrame>> pair : p_bus_volumes) {
|
||||
if (pair.value.size() < channel_count || pair.value.size() != MAX_CHANNELS_PER_BUS) {
|
||||
delete playback_node;
|
||||
delete new_bus_details;
|
||||
ERR_FAIL();
|
||||
}
|
||||
|
|
@ -1322,8 +1337,10 @@ void AudioServer::set_playback_bus_volumes_linear(Ref<AudioStreamPlayback> p_pla
|
|||
if (idx >= MAX_BUSES_PER_PLAYBACK) {
|
||||
break;
|
||||
}
|
||||
ERR_FAIL_COND(pair.value.size() < channel_count);
|
||||
ERR_FAIL_COND(pair.value.size() != MAX_CHANNELS_PER_BUS);
|
||||
if (pair.value.size() < channel_count || pair.value.size() != MAX_CHANNELS_PER_BUS) {
|
||||
delete new_bus_details;
|
||||
ERR_FAIL();
|
||||
}
|
||||
|
||||
new_bus_details->bus_active[idx] = true;
|
||||
new_bus_details->bus[idx] = pair.key;
|
||||
|
|
@ -2044,14 +2061,14 @@ AudioServer::~AudioServer() {
|
|||
bool AudioBusLayout::_set(const StringName &p_name, const Variant &p_value) {
|
||||
String s = p_name;
|
||||
if (s.begins_with("bus/")) {
|
||||
int index = s.get_slice("/", 1).to_int();
|
||||
int index = s.get_slicec('/', 1).to_int();
|
||||
if (buses.size() <= index) {
|
||||
buses.resize(index + 1);
|
||||
}
|
||||
|
||||
Bus &bus = buses.write[index];
|
||||
|
||||
String what = s.get_slice("/", 2);
|
||||
String what = s.get_slicec('/', 2);
|
||||
|
||||
if (what == "name") {
|
||||
bus.name = p_value;
|
||||
|
|
@ -2066,14 +2083,14 @@ bool AudioBusLayout::_set(const StringName &p_name, const Variant &p_value) {
|
|||
} else if (what == "send") {
|
||||
bus.send = p_value;
|
||||
} else if (what == "effect") {
|
||||
int which = s.get_slice("/", 3).to_int();
|
||||
int which = s.get_slicec('/', 3).to_int();
|
||||
if (bus.effects.size() <= which) {
|
||||
bus.effects.resize(which + 1);
|
||||
}
|
||||
|
||||
Bus::Effect &fx = bus.effects.write[which];
|
||||
|
||||
String fxwhat = s.get_slice("/", 4);
|
||||
String fxwhat = s.get_slicec('/', 4);
|
||||
if (fxwhat == "effect") {
|
||||
fx.effect = p_value;
|
||||
} else if (fxwhat == "enabled") {
|
||||
|
|
@ -2096,14 +2113,14 @@ bool AudioBusLayout::_set(const StringName &p_name, const Variant &p_value) {
|
|||
bool AudioBusLayout::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
String s = p_name;
|
||||
if (s.begins_with("bus/")) {
|
||||
int index = s.get_slice("/", 1).to_int();
|
||||
int index = s.get_slicec('/', 1).to_int();
|
||||
if (index < 0 || index >= buses.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const Bus &bus = buses[index];
|
||||
|
||||
String what = s.get_slice("/", 2);
|
||||
String what = s.get_slicec('/', 2);
|
||||
|
||||
if (what == "name") {
|
||||
r_ret = bus.name;
|
||||
|
|
@ -2118,14 +2135,14 @@ bool AudioBusLayout::_get(const StringName &p_name, Variant &r_ret) const {
|
|||
} else if (what == "send") {
|
||||
r_ret = bus.send;
|
||||
} else if (what == "effect") {
|
||||
int which = s.get_slice("/", 3).to_int();
|
||||
int which = s.get_slicec('/', 3).to_int();
|
||||
if (which < 0 || which >= bus.effects.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const Bus::Effect &fx = bus.effects[which];
|
||||
|
||||
String fxwhat = s.get_slice("/", 4);
|
||||
String fxwhat = s.get_slicec('/', 4);
|
||||
if (fxwhat == "effect") {
|
||||
r_ret = fx.effect;
|
||||
} else if (fxwhat == "enabled") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue