From 68ee7799a4eeb4148cd4628113ebf9ea3f94a211 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 7 Oct 2017 10:31:04 +0200 Subject: Make all inputs use the same interface --- src/JackInput.h | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'src/JackInput.h') diff --git a/src/JackInput.h b/src/JackInput.h index 23fd4b6..8cbda45 100644 --- a/src/JackInput.h +++ b/src/JackInput.h @@ -1,6 +1,6 @@ /* ------------------------------------------------------------------ * Copyright (C) 2011 Martin Storsjo - * Copyright (C) 2016 Matthias P. Braendli + * Copyright (C) 2017 Matthias P. Braendli * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,8 @@ * compensation, because there is no blocking way to read from JACK. */ -#ifndef __JACK_INPUT_H -#define __JACK_INPUT_H +#pragma once + #include "config.h" #include #include @@ -35,14 +35,15 @@ extern "C" { } #include "SampleQueue.h" +#include "InputInterface.h" // 16 bits per sample is fine for now #define BYTES_PER_SAMPLE 2 -class JackInput +class JackInput : public InputInterface { public: - JackInput(const char* jack_name, + JackInput(const std::string& jack_name, unsigned int channels, unsigned int samplerate, SampleQueue& queue) : @@ -52,26 +53,19 @@ class JackInput m_rate(samplerate), m_queue(queue) { } - ~JackInput() { - if (m_client) { - jack_client_close(m_client); - } - } + JackInput(const JackInput& other) = delete; + JackInput& operator=(const JackInput& other) = delete; - /*! Prepare the audio input - * - * \return 0 on success - */ - int prepare(); + virtual ~JackInput(); - private: - JackInput(const JackInput& other); + virtual void prepare() override; + private: jack_client_t *m_client; std::vector m_input_ports; - const char* m_jack_name; + std::string m_jack_name; unsigned int m_channels; unsigned int m_rate; @@ -105,5 +99,3 @@ class JackInput #endif // HAVE_JACK -#endif - -- cgit v1.2.3