]> git.sesse.net Git - nageru/blobdiff - nageru/alsa_output.cpp
IWYU-fix nageru/*.cpp.
[nageru] / nageru / alsa_output.cpp
index bc2c89c761ea5a13817054ffb10b4fab7a594279..21143e8fa4bd619f667f6b047fe34d4b95d69c41 100644 (file)
@@ -1,6 +1,8 @@
 #include "alsa_output.h"
 
 #include <alsa/asoundlib.h>
+#include <alsa/error.h>
+#include <alsa/pcm.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -34,12 +36,12 @@ ALSAOutput::ALSAOutput(int sample_rate, int num_channels)
        die_on_error("snd_pcm_hw_params_set_rate()", snd_pcm_hw_params_set_rate(pcm_handle, hw_params, sample_rate, 0));
        die_on_error("snd_pcm_hw_params_set_channels", snd_pcm_hw_params_set_channels(pcm_handle, hw_params, num_channels));
 
-       // Fragment size of 512 samples. (A frame at 60 fps/48 kHz is 800 samples.)
-       // We ask for 16 such periods (~170 ms buffer).
-       unsigned int num_periods = 16;
+       // Fragment size of 2048 samples. (A frame at 60 fps/48 kHz is 800 samples.)
+       // We ask for 4 such periods (~170 ms buffer).
+       unsigned int num_periods = 4;
        int dir = 0;
        die_on_error("snd_pcm_hw_params_set_periods_near()", snd_pcm_hw_params_set_periods_near(pcm_handle, hw_params, &num_periods, &dir));
-       period_size = 512;
+       period_size = 2048;
        dir = 0;
        die_on_error("snd_pcm_hw_params_set_period_size_near()", snd_pcm_hw_params_set_period_size_near(pcm_handle, hw_params, &period_size, &dir));
        die_on_error("snd_pcm_hw_params()", snd_pcm_hw_params(pcm_handle, hw_params));