diff options
author | Goran Mekić <meka@tilda.center> | 2017-12-29 21:52:17 +0100 |
---|---|---|
committer | Goran Mekić <meka@tilda.center> | 2017-12-30 15:18:26 +0100 |
commit | 476a82d1c431c26f71286a2d904144bfa5468101 (patch) | |
tree | d778a71c05b9b19ac1038450bc0a680b1fbd5660 | |
parent | 5f293e314659f86e53870cf8666cda27512ba18e (diff) |
Enable OSS midi in
-rw-r--r-- | configure.ac | 41 | ||||
-rw-r--r-- | drumgizmo/input/ossmidi.cc | 50 | ||||
-rw-r--r-- | drumgizmo/input/ossmidi.h | 25 |
3 files changed, 114 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 7d67a22..f323db2 100644 --- a/configure.ac +++ b/configure.ac @@ -359,7 +359,44 @@ AS_IF( have_input_midifile=no] ) - INPUT_PLUGINS="midifile jackmidi dummy test" + dnl *** oss + case $host_os in + freebsd*) + enable_oss_midi_value=yes + ;; + *) + enable_oss_midi_value=no + ;; + esac + AC_ARG_ENABLE([input_oss], + AS_HELP_STRING( + [--disable-input-oss], + [Disable input oss plugin [enabled by default on FreeBSD, disabled otherwise]]),, + [enable_input_ossmidi=$enable_oss_midi_value] + ) + + AS_IF( + [test "x$enable_input_ossmidi" = "xyes"], + [AC_MSG_CHECKING(for OSS in) + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([[ + #include <sys/soundcard.h> + #ifndef AFMT_S32_NE + # error no oss + #endif + ]])], + [ + have_input_ossmidi=yes + AC_MSG_RESULT(yes) + ], + [AC_MSG_FAILURE([no OSS headers found])] + )], + + [AC_MSG_RESULT([*** input ossmidi plugin disabled per user request ***]) + have_input_ossmidi=no] + ) + + INPUT_PLUGINS="midifile jackmidi dummy test ossmidi" AC_SUBST(INPUT_PLUGINS) dnl *** @@ -441,7 +478,7 @@ AS_IF( AS_IF( [test "x$enable_output_oss" = "xyes"], - [AC_MSG_CHECKING(for OSS) + [AC_MSG_CHECKING(for OSS out) AC_COMPILE_IFELSE( [AC_LANG_SOURCE([[ #include <sys/soundcard.h> diff --git a/drumgizmo/input/ossmidi.cc b/drumgizmo/input/ossmidi.cc index 16c2e2d..024415e 100644 --- a/drumgizmo/input/ossmidi.cc +++ b/drumgizmo/input/ossmidi.cc @@ -25,4 +25,54 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include "ossmidi.h" +#include <iostream> + + +OSSInputEngine::OSSInputEngine() +{ +} + +OSSInputEngine::~OSSInputEngine() +{ +} + +bool OSSInputEngine::init(const Instruments& instruments) +{ + return true; +} + +void OSSInputEngine::setParm(const std::string& parm, const std::string& value) +{ + if(parm == "dev") + { + dev = value; + std::cout << "dev = " << dev << std::endl; + } +} + +bool OSSInputEngine::start() +{ + return true; +} + +void OSSInputEngine::stop() +{ +} + +void OSSInputEngine::pre() +{ +} + +void OSSInputEngine::run(size_t pos, size_t len, std::vector<event_t>& events) +{ +} + +void OSSInputEngine::post() +{ +} + +bool OSSInputEngine::isFreewheeling() const +{ + return false; +} 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 <audioinputengine.h> + +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<event_t>& events) override; + void post() override; + bool isFreewheeling() const override; + +private: + std::string dev; + int fd; + std::size_t pos; + std::vector<event_t> events; +}; |