X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=bmusb%2Ffake_capture.h;h=17982ea50e6d0ff3071f6d01f9240ede4e9ed993;hb=e0837a17b5a497476d67237c768836e51f8a4ce7;hp=48dca063ae7d6b18e21e3554478b4aa1532f1000;hpb=0d48ad939040ec561e67ab2329e3961843b3cf74;p=bmusb diff --git a/bmusb/fake_capture.h b/bmusb/fake_capture.h index 48dca06..17982ea 100644 --- a/bmusb/fake_capture.h +++ b/bmusb/fake_capture.h @@ -12,7 +12,7 @@ namespace bmusb { class FakeCapture : public CaptureInterface { public: - FakeCapture(unsigned width, unsigned height, unsigned fps, unsigned audio_frequency, int card_index); + FakeCapture(unsigned width, unsigned height, unsigned fps, unsigned audio_sample_frequency, int card_index, bool has_audio = false); ~FakeCapture(); // CaptureInterface. @@ -79,10 +79,17 @@ public: private: void producer_thread_func(); + void make_tone(int32_t *out, unsigned num_stereo_samples); - unsigned width, height, fps, audio_frequency; + unsigned width, height, fps, audio_sample_frequency; uint8_t y, cb, cr; + // sin(2 * pi * f / F) and similar for cos. Used for fast sine generation. + // Zero when no audio. + float audio_sin = 0.0f, audio_cos = 0.0f; + float audio_real = 0.0f, audio_imag = 0.0f; // Current state of the audio phaser. + float audio_ref_level; + bool has_dequeue_callbacks = false; std::function dequeue_init_callback = nullptr; std::function dequeue_cleanup_callback = nullptr;