13
0

Refactor parts of PortAudioIO class into new method

This commit is contained in:
Tim Mayberry 2015-08-23 20:36:23 +10:00
parent c857008b93
commit e42f9d649b
2 changed files with 14 additions and 10 deletions

View File

@ -528,6 +528,16 @@ PortAudioIO::discover()
add_devices ();
}
void
PortAudioIO::reset_stream_dependents ()
{
_capture_channels = 0;
_playback_channels = 0;
_cur_sample_rate = 0;
_cur_input_latency = 0;
_cur_output_latency = 0;
}
void
PortAudioIO::pcm_stop ()
{
@ -536,11 +546,7 @@ PortAudioIO::pcm_stop ()
}
_stream = NULL;
_capture_channels = 0;
_playback_channels = 0;
_cur_sample_rate = 0;
_cur_input_latency = 0;
_cur_output_latency = 0;
reset_stream_dependents();
free (_input_buffer); _input_buffer = NULL;
free (_output_buffer); _output_buffer = NULL;
@ -689,11 +695,7 @@ PortAudioIO::pcm_setup (
return -1;
}
_capture_channels = 0;
_playback_channels = 0;
_cur_sample_rate = 0;
_cur_input_latency = 0;
_cur_output_latency = 0;
reset_stream_dependents ();
DEBUG_AUDIO (string_compose (
"PortAudio Device IDs: i:%1 o:%2\n", device_input, device_output));

View File

@ -114,6 +114,8 @@ private: // Methods
bool set_sample_rate_and_latency_from_stream();
bool allocate_buffers_for_blocking_api (uint32_t samples_per_period);
void reset_stream_dependents ();
static void get_default_sample_rates(std::vector<float>&);
static void get_default_buffer_sizes(std::vector<uint32_t>&);