From 5f6dacd2acd612c3ec7d069c853f808cfe9e3d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Goran=20Meki=C4=87?= Date: Sun, 21 May 2017 11:28:12 +0200 Subject: Add OSS MIDI input --- drumgizmo/input/ossmidi.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 drumgizmo/input/ossmidi.h (limited to 'drumgizmo/input/ossmidi.h') diff --git a/drumgizmo/input/ossmidi.h b/drumgizmo/input/ossmidi.h new file mode 100644 index 0000000..a5f64b6 --- /dev/null +++ b/drumgizmo/input/ossmidi.h @@ -0,0 +1,27 @@ +/* -*- Mode: c++ -*- */ +/*************************************************************************** + * ossmidi.h + * + * Sun May 21 10:52:09 CEST 2017 + * Copyright 2017 Goran Mekić + * meka@tilda.center + ****************************************************************************/ + +/* + * This file is part of DrumGizmo. + * + * DrumGizmo is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DrumGizmo is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with DrumGizmo; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#pragma once -- cgit v1.2.3 From 476a82d1c431c26f71286a2d904144bfa5468101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Goran=20Meki=C4=87?= Date: Fri, 29 Dec 2017 21:52:17 +0100 Subject: Enable OSS midi in --- drumgizmo/input/ossmidi.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'drumgizmo/input/ossmidi.h') diff --git a/drumgizmo/input/ossmidi.h b/drumgizmo/input/ossmidi.h index a5f64b6..41cfb2b 100644 --- a/drumgizmo/input/ossmidi.h +++ b/drumgizmo/input/ossmidi.h @@ -25,3 +25,28 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #pragma once +#include + +class OSSInputEngine + : public AudioInputEngine +{ +public: + OSSInputEngine(); + ~OSSInputEngine(); + + // based on AudioInputEngine + bool init(const Instruments& instruments) override; + void setParm(const std::string& parm, const std::string& value) override; + bool start() override; + void stop() override; + void pre() override; + void run(size_t pos, size_t len, std::vector& events) override; + void post() override; + bool isFreewheeling() const override; + +private: + std::string dev; + int fd; + std::size_t pos; + std::vector events; +}; -- cgit v1.2.3 From a6343737453b34335a7a5494c8ac6b393d15604c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Goran=20Meki=C4=87?= Date: Fri, 29 Dec 2017 23:36:55 +0100 Subject: Open midi device in non-blocking mode --- drumgizmo/input/ossmidi.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drumgizmo/input/ossmidi.h') diff --git a/drumgizmo/input/ossmidi.h b/drumgizmo/input/ossmidi.h index 41cfb2b..c6abacd 100644 --- a/drumgizmo/input/ossmidi.h +++ b/drumgizmo/input/ossmidi.h @@ -25,10 +25,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #pragma once -#include +#include "audioinputenginemidi.h" + class OSSInputEngine - : public AudioInputEngine + : public AudioInputEngineMidi { public: OSSInputEngine(); @@ -45,8 +46,9 @@ public: bool isFreewheeling() const override; private: - std::string dev; int fd; + std::string dev; std::size_t pos; std::vector events; + std::string midimap_file; }; -- cgit v1.2.3