Allow AudioStreamPlayer(2D) to provide `pitch_scale` on playback
This commit is contained in:
parent
2a28df82d4
commit
39a90751dc
|
@ -68,7 +68,7 @@ void AudioStreamPlayer2D::_notification(int p_what) {
|
|||
active.set();
|
||||
Ref<AudioStreamPlayback> new_playback = stream->instance_playback();
|
||||
ERR_FAIL_COND_MSG(new_playback.is_null(), "Failed to instantiate playback.");
|
||||
AudioServer::get_singleton()->start_playback_stream(new_playback, _get_actual_bus(), volume_vector, setplay.get());
|
||||
AudioServer::get_singleton()->start_playback_stream(new_playback, _get_actual_bus(), volume_vector, setplay.get(), pitch_scale);
|
||||
stream_playbacks.push_back(new_playback);
|
||||
setplay.set(-1);
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
|
|||
ERR_FAIL_COND_MSG(new_playback.is_null(), "Failed to instantiate playback.");
|
||||
Map<StringName, Vector<AudioFrame>> bus_map;
|
||||
bus_map[_get_actual_bus()] = volume_vector;
|
||||
AudioServer::get_singleton()->start_playback_stream(new_playback, bus_map, setplay.get(), linear_attenuation, attenuation_filter_cutoff_hz, actual_pitch_scale);
|
||||
AudioServer::get_singleton()->start_playback_stream(new_playback, bus_map, setplay.get(), actual_pitch_scale, linear_attenuation, attenuation_filter_cutoff_hz);
|
||||
stream_playbacks.push_back(new_playback);
|
||||
setplay.set(-1);
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ void AudioStreamPlayer::play(float p_from_pos) {
|
|||
Ref<AudioStreamPlayback> stream_playback = stream->instance_playback();
|
||||
ERR_FAIL_COND_MSG(stream_playback.is_null(), "Failed to instantiate playback.");
|
||||
|
||||
AudioServer::get_singleton()->start_playback_stream(stream_playback, bus, _get_volume_vector(), p_from_pos);
|
||||
AudioServer::get_singleton()->start_playback_stream(stream_playback, bus, _get_volume_vector(), p_from_pos, pitch_scale);
|
||||
stream_playbacks.push_back(stream_playback);
|
||||
active.set();
|
||||
set_process_internal(true);
|
||||
|
|
|
@ -1112,16 +1112,16 @@ float AudioServer::get_playback_speed_scale() const {
|
|||
return playback_speed_scale;
|
||||
}
|
||||
|
||||
void AudioServer::start_playback_stream(Ref<AudioStreamPlayback> p_playback, StringName p_bus, Vector<AudioFrame> p_volume_db_vector, float p_start_time) {
|
||||
void AudioServer::start_playback_stream(Ref<AudioStreamPlayback> p_playback, StringName p_bus, Vector<AudioFrame> p_volume_db_vector, float p_start_time, float p_pitch_scale) {
|
||||
ERR_FAIL_COND(p_playback.is_null());
|
||||
|
||||
Map<StringName, Vector<AudioFrame>> map;
|
||||
map[p_bus] = p_volume_db_vector;
|
||||
|
||||
start_playback_stream(p_playback, map, p_start_time);
|
||||
start_playback_stream(p_playback, map, p_start_time, p_pitch_scale);
|
||||
}
|
||||
|
||||
void AudioServer::start_playback_stream(Ref<AudioStreamPlayback> p_playback, Map<StringName, Vector<AudioFrame>> p_bus_volumes, float p_start_time, float p_highshelf_gain, float p_attenuation_cutoff_hz, float p_pitch_scale) {
|
||||
void AudioServer::start_playback_stream(Ref<AudioStreamPlayback> p_playback, Map<StringName, Vector<AudioFrame>> p_bus_volumes, float p_start_time, float p_pitch_scale, float p_highshelf_gain, float p_attenuation_cutoff_hz) {
|
||||
ERR_FAIL_COND(p_playback.is_null());
|
||||
|
||||
AudioStreamPlaybackListNode *playback_node = new AudioStreamPlaybackListNode();
|
||||
|
|
|
@ -368,9 +368,9 @@ public:
|
|||
float get_playback_speed_scale() const;
|
||||
|
||||
// Convenience method.
|
||||
void start_playback_stream(Ref<AudioStreamPlayback> p_playback, StringName p_bus, Vector<AudioFrame> p_volume_db_vector, float p_start_time = 0);
|
||||
void start_playback_stream(Ref<AudioStreamPlayback> p_playback, StringName p_bus, Vector<AudioFrame> p_volume_db_vector, float p_start_time = 0, float p_pitch_scale = 1);
|
||||
// Expose all parameters.
|
||||
void start_playback_stream(Ref<AudioStreamPlayback> p_playback, Map<StringName, Vector<AudioFrame>> p_bus_volumes, float p_start_time = 0, float p_highshelf_gain = 0, float p_attenuation_cutoff_hz = 0, float p_pitch_scale = 1);
|
||||
void start_playback_stream(Ref<AudioStreamPlayback> p_playback, Map<StringName, Vector<AudioFrame>> p_bus_volumes, float p_start_time = 0, float p_pitch_scale = 1, float p_highshelf_gain = 0, float p_attenuation_cutoff_hz = 0);
|
||||
void stop_playback_stream(Ref<AudioStreamPlayback> p_playback);
|
||||
|
||||
void set_playback_bus_exclusive(Ref<AudioStreamPlayback> p_playback, StringName p_bus, Vector<AudioFrame> p_volumes);
|
||||
|
|
Loading…
Reference in New Issue