Skip to content
Snippets Groups Projects
Commit 1707884b authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

port from pd-l2ork git: commit 38e474c1c56027838edb1e767d30d2807f23f217

*fixed regression where audio properties misreported sampling rate
parent 8d587fbd
No related branches found
No related tags found
No related merge requests found
...@@ -119,6 +119,8 @@ void sys_get_audio_params( ...@@ -119,6 +119,8 @@ void sys_get_audio_params(
else paudiooutdev[i] = audio_audiooutdev[i]; else paudiooutdev[i] = audio_audiooutdev[i];
choutdev[i] = audio_audiochoutdev[i]; choutdev[i] = audio_audiochoutdev[i];
} }
if (audio_rate != sys_dacsr && sys_dacsr != 0)
audio_rate = sys_dacsr;
*prate = audio_rate; *prate = audio_rate;
*padvance = audio_advance; *padvance = audio_advance;
*pcallback = audio_callback; *pcallback = audio_callback;
...@@ -147,6 +149,7 @@ void sys_save_audio_params( ...@@ -147,6 +149,7 @@ void sys_save_audio_params(
sys_audiodevnumbertoname(1, audiooutdev[i], sys_audiodevnumbertoname(1, audiooutdev[i],
&audio_outdevnames[i * DEVDESCSIZE], DEVDESCSIZE); &audio_outdevnames[i * DEVDESCSIZE], DEVDESCSIZE);
} }
sys_dacsr = rate;
audio_rate = rate; audio_rate = rate;
audio_advance = advance; audio_advance = advance;
audio_callback = callback; audio_callback = callback;
...@@ -190,6 +193,7 @@ void sys_setchsr(int chin, int chout, int sr) ...@@ -190,6 +193,7 @@ void sys_setchsr(int chin, int chout, int sr)
sys_inchannels = chin; sys_inchannels = chin;
sys_outchannels = chout; sys_outchannels = chout;
sys_dacsr = sr; sys_dacsr = sr;
audio_rate = sr;
sys_advance_samples = (sys_schedadvance * sys_dacsr) / (1000000.); sys_advance_samples = (sys_schedadvance * sys_dacsr) / (1000000.);
if (sys_advance_samples < 3 * DEFDACBLKSIZE) if (sys_advance_samples < 3 * DEFDACBLKSIZE)
sys_advance_samples = 3 * DEFDACBLKSIZE; sys_advance_samples = 3 * DEFDACBLKSIZE;
...@@ -561,7 +565,7 @@ t_float sys_getsr(void) ...@@ -561,7 +565,7 @@ t_float sys_getsr(void)
{ {
// when starting with -nogui option, it is conceivable that sys_dacsr // when starting with -nogui option, it is conceivable that sys_dacsr
// is not initialized even though the audio_rate by this time has // is not initialized even though the audio_rate by this time has
// proper sample rate entered. Hence we check for this here and avoid // proper sample rate entered. Hence, we check for this here and avoid
// the -nogui nonsense where we have to do various workarounds to make // the -nogui nonsense where we have to do various workarounds to make
// sure that audio objects that depend on this call get the proper sr // sure that audio objects that depend on this call get the proper sr
if (sys_dacsr == 0 && audio_rate > 0) if (sys_dacsr == 0 && audio_rate > 0)
...@@ -740,6 +744,7 @@ void glob_audio_properties(t_pd *dummy, t_floatarg flongform) ...@@ -740,6 +744,7 @@ void glob_audio_properties(t_pd *dummy, t_floatarg flongform)
sys_get_audio_params(&naudioindev, audioindev, chindev, sys_get_audio_params(&naudioindev, audioindev, chindev,
&naudiooutdev, audiooutdev, choutdev, &rate, &advance, &callback, &naudiooutdev, audiooutdev, choutdev, &rate, &advance, &callback,
&blocksize); &blocksize);
//rate = (int)sys_getsr();
#ifdef USEAPI_JACK #ifdef USEAPI_JACK
if (sys_audioapiopened == API_JACK) if (sys_audioapiopened == API_JACK)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment