You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Implement BPM support
Based on #62896, only implements the BPM support part. * Implements BPM support in the AudioStreamOGG/MP3 importers. * Can select BPM/Bar Size and total beats in a song file, as well as edit looping points. * Looping is now BPM aware * Added a special importer UI for configuring this. * Added a special preview showing the audio waveform as well as the playback position in the resource picker. * Renamed `AudioStream::instance` to `instantiate` for correctness.
This commit is contained in:
@@ -350,6 +350,10 @@ void AudioServer::_mix_step() {
|
||||
// Mix the audio stream
|
||||
unsigned int mixed_frames = playback->stream_playback->mix(&buf[LOOKAHEAD_BUFFER_SIZE], playback->pitch_scale.get(), buffer_size);
|
||||
|
||||
if (tag_used_audio_streams && playback->stream_playback->is_playing()) {
|
||||
playback->stream_playback->tag_used_streams();
|
||||
}
|
||||
|
||||
if (mixed_frames != buffer_size) {
|
||||
// We know we have at least the size of our lookahead buffer for fade-out purposes.
|
||||
|
||||
@@ -1312,6 +1316,10 @@ uint64_t AudioServer::get_mix_count() const {
|
||||
return mix_count;
|
||||
}
|
||||
|
||||
uint64_t AudioServer::get_mixed_frames() const {
|
||||
return mix_frames;
|
||||
}
|
||||
|
||||
void AudioServer::notify_listener_changed() {
|
||||
for (CallbackItem *ci : listener_changed_callback_list) {
|
||||
ci->callback(ci->userdata);
|
||||
@@ -1653,6 +1661,10 @@ void AudioServer::capture_set_device(const String &p_name) {
|
||||
AudioDriver::get_singleton()->capture_set_device(p_name);
|
||||
}
|
||||
|
||||
void AudioServer::set_enable_tagging_used_audio_streams(bool p_enable) {
|
||||
tag_used_audio_streams = p_enable;
|
||||
}
|
||||
|
||||
void AudioServer::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_bus_count", "amount"), &AudioServer::set_bus_count);
|
||||
ClassDB::bind_method(D_METHOD("get_bus_count"), &AudioServer::get_bus_count);
|
||||
@@ -1719,6 +1731,8 @@ void AudioServer::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_bus_layout", "bus_layout"), &AudioServer::set_bus_layout);
|
||||
ClassDB::bind_method(D_METHOD("generate_bus_layout"), &AudioServer::generate_bus_layout);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_enable_tagging_used_audio_streams", "enable"), &AudioServer::set_enable_tagging_used_audio_streams);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "bus_count"), "set_bus_count", "get_bus_count");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "device"), "set_device", "get_device");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "capture_device"), "capture_set_device", "capture_get_device");
|
||||
|
||||
Reference in New Issue
Block a user