mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Add 64-bit versions of core power of 2 functions
This commit is contained in:
@@ -153,9 +153,9 @@ Error AudioDriverCoreAudio::init() {
|
||||
result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kOutputBus, &strdesc, sizeof(strdesc));
|
||||
ERR_FAIL_COND_V(result != noErr, FAILED);
|
||||
|
||||
int latency = Engine::get_singleton()->get_audio_output_latency();
|
||||
uint32_t latency = Engine::get_singleton()->get_audio_output_latency();
|
||||
// Sample rate is independent of channels (ref: https://stackoverflow.com/questions/11048825/audio-sample-frequency-rely-on-channels)
|
||||
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
|
||||
buffer_frames = closest_power_of_2(latency * (uint32_t)mix_rate / (uint32_t)1000);
|
||||
|
||||
#ifdef MACOS_ENABLED
|
||||
result = AudioUnitSetProperty(audio_unit, kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Global, kOutputBus, &buffer_frames, sizeof(UInt32));
|
||||
@@ -456,9 +456,9 @@ Error AudioDriverCoreAudio::init_input_device() {
|
||||
result = AudioUnitSetProperty(input_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kInputBus, &strdesc, sizeof(strdesc));
|
||||
ERR_FAIL_COND_V(result != noErr, FAILED);
|
||||
|
||||
int latency = Engine::get_singleton()->get_audio_output_latency();
|
||||
uint32_t latency = Engine::get_singleton()->get_audio_output_latency();
|
||||
// Sample rate is independent of channels (ref: https://stackoverflow.com/questions/11048825/audio-sample-frequency-rely-on-channels)
|
||||
capture_buffer_frames = closest_power_of_2(latency * capture_mix_rate / 1000);
|
||||
capture_buffer_frames = closest_power_of_2(latency * (uint32_t)capture_mix_rate / (uint32_t)1000);
|
||||
|
||||
unsigned int buffer_size = capture_buffer_frames * capture_channels;
|
||||
input_buf.resize(buffer_size);
|
||||
|
||||
Reference in New Issue
Block a user