]> git.sesse.net Git - nageru/blobdiff - alsa_input.h
Save another ~1% on the audio benchmark, by dealing with the std::deque more efficien...
[nageru] / alsa_input.h
index d485a3b74e18b1ce823c5dbf9d5ea7df08ad1ce2..84e46b0887707dd6b273419d29cf2fada00c43d7 100644 (file)
@@ -22,7 +22,7 @@
 
 class ALSAInput {
 public:
-       typedef std::function<void(const uint8_t *data, unsigned num_samples, bmusb::AudioFormat audio_format, int64_t frame_length)> audio_callback_t;
+       typedef std::function<bool(const uint8_t *data, unsigned num_samples, bmusb::AudioFormat audio_format, int64_t frame_length)> audio_callback_t;
 
        ALSAInput(const char *device, unsigned sample_rate, unsigned num_channels, audio_callback_t audio_callback);
        ~ALSAInput();
@@ -46,6 +46,7 @@ private:
        void capture_thread_func();
        int64_t frames_to_pts(uint64_t n) const;
        void die_on_error(const char *func_name, int err);
+       static bool set_base_params(const char *device, snd_pcm_t *pcm_handle, snd_pcm_hw_params_t *hw_params, unsigned *sample_rate);
 
        std::string device;
        unsigned sample_rate, num_channels, num_periods;