]> git.sesse.net Git - nageru/blobdiff - mixer.cpp
Move some muxing parameters out into defs.h.
[nageru] / mixer.cpp
index 0e362f069395874c837dac1bf732c9e1d32d25a0..6ea3be3d0d2822edccaed984a3b56c8a98dc5485 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -66,7 +66,7 @@ void convert_fixed24_to_fp32(float *dst, size_t out_channels, const uint8_t *src
 }  // namespace
 
 Mixer::Mixer(const QSurfaceFormat &format, unsigned num_cards)
-       : httpd("test.ts", WIDTH, HEIGHT),
+       : httpd(LOCAL_DUMP_FILE_NAME, WIDTH, HEIGHT),
          num_cards(num_cards),
          mixer_surface(create_surface(format)),
          h264_encoder_surface(create_surface(format)),
@@ -157,6 +157,8 @@ Mixer::Mixer(const QSurfaceFormat &format, unsigned num_cards)
        // hlen=16 is pretty low quality, but we use quite a bit of CPU otherwise,
        // and there's a limit to how important the peak meter is.
        peak_resampler.setup(OUTPUT_FREQUENCY, OUTPUT_FREQUENCY * 4, /*num_channels=*/2, /*hlen=*/16);
+
+       alsa.reset(new ALSAOutput(OUTPUT_FREQUENCY, /*num_channels=*/2));
 }
 
 Mixer::~Mixer()
@@ -623,7 +625,12 @@ void Mixer::process_audio_one_frame()
        float *ptrs[] = { left.data(), right.data() };
        r128.process(left.size(), ptrs);
 
-       // Actually add the samples to the output.
+       // Send the samples to the sound card.
+       if (alsa) {
+               alsa->write(samples_out);
+       }
+
+       // And finally add them to the output.
        h264_encoder->add_audio(pts_int, move(samples_out));
 }