mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 02:32:36 +01:00
Fixes audio buffering on non-windows platforms
This commit is contained in:
parent
6bb01066fb
commit
4832267307
@ -813,7 +813,7 @@ void cell_audio_thread::operator()()
|
|||||||
|
|
||||||
if (time_left > cfg.period_comparison_margin)
|
if (time_left > cfg.period_comparison_margin)
|
||||||
{
|
{
|
||||||
thread_ctrl::wait_for(get_thread_wait_delay(time_left));
|
thread_ctrl::wait_for(time_left - cfg.period_comparison_margin);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -886,7 +886,7 @@ void cell_audio_thread::operator()()
|
|||||||
const s64 time_left = m_dynamic_period - time_since_last_period;
|
const s64 time_left = m_dynamic_period - time_since_last_period;
|
||||||
if (time_left > cfg.period_comparison_margin)
|
if (time_left > cfg.period_comparison_margin)
|
||||||
{
|
{
|
||||||
thread_ctrl::wait_for(get_thread_wait_delay(time_left));
|
thread_ctrl::wait_for(time_left - cfg.period_comparison_margin);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +251,12 @@ struct cell_audio_config
|
|||||||
|
|
||||||
static constexpr f32 period_average_alpha = 0.02f; // alpha factor for the m_average_period rolling average
|
static constexpr f32 period_average_alpha = 0.02f; // alpha factor for the m_average_period rolling average
|
||||||
|
|
||||||
static constexpr s64 period_comparison_margin = 250; // when comparing the current period time with the desired period, if it is below this number of usecs we do not wait any longer
|
// when comparing the current period time with the desired period, if it is below this number of usecs we do not wait any longer(quantum dependent)
|
||||||
|
#ifdef _WIN32
|
||||||
|
static constexpr s64 period_comparison_margin = 250;
|
||||||
|
#else
|
||||||
|
static constexpr s64 period_comparison_margin = 5;
|
||||||
|
#endif
|
||||||
|
|
||||||
u64 fully_untouched_timeout = 0; // timeout if the game has not touched any audio buffer yet
|
u64 fully_untouched_timeout = 0; // timeout if the game has not touched any audio buffer yet
|
||||||
u64 partially_untouched_timeout = 0; // timeout if the game has not touched all audio buffers yet
|
u64 partially_untouched_timeout = 0; // timeout if the game has not touched all audio buffers yet
|
||||||
@ -373,11 +378,6 @@ private:
|
|||||||
void mix(float* out_buffer, s32 offset = 0);
|
void mix(float* out_buffer, s32 offset = 0);
|
||||||
void finish_port_volume_stepping();
|
void finish_port_volume_stepping();
|
||||||
|
|
||||||
constexpr static u64 get_thread_wait_delay(u64 time_left)
|
|
||||||
{
|
|
||||||
return (time_left > 350) ? time_left - 250 : 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
void update_config(bool backend_changed);
|
void update_config(bool backend_changed);
|
||||||
void reset_counters();
|
void reset_counters();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user