From 65a1f98c1bbb1837222e2eca4a457e66cf867b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Gl=C3=B6ckner?= Date: Mon, 25 Jan 2016 13:26:14 +0100 Subject: Removed outdated files --- drumgizmo/input/Makefile.am | 2 - drumgizmo/input/dummy/Makefile.am | 29 --- drumgizmo/input/dummy/dummy.cc | 185 -------------- drumgizmo/input/jackmidi/Makefile.am | 34 --- .../input/jackmidi/audioinputenginejackmidi.cc | 153 ------------ .../input/jackmidi/audioinputenginejackmidi.h | 61 ----- drumgizmo/input/jackmidi/jackmidi.cc | 252 ------------------- drumgizmo/input/midifile/Makefile.am | 36 --- .../input/midifile/audioinputenginemidifile.cc | 44 ---- .../input/midifile/audioinputenginemidifile.h | 41 ---- drumgizmo/input/midifile/midifile.cc | 271 --------------------- drumgizmo/input/test/Makefile.am | 29 --- drumgizmo/input/test/test.cc | 173 ------------- 13 files changed, 1310 deletions(-) delete mode 100644 drumgizmo/input/Makefile.am delete mode 100644 drumgizmo/input/dummy/Makefile.am delete mode 100644 drumgizmo/input/dummy/dummy.cc delete mode 100644 drumgizmo/input/jackmidi/Makefile.am delete mode 100644 drumgizmo/input/jackmidi/audioinputenginejackmidi.cc delete mode 100644 drumgizmo/input/jackmidi/audioinputenginejackmidi.h delete mode 100644 drumgizmo/input/jackmidi/jackmidi.cc delete mode 100644 drumgizmo/input/midifile/Makefile.am delete mode 100644 drumgizmo/input/midifile/audioinputenginemidifile.cc delete mode 100644 drumgizmo/input/midifile/audioinputenginemidifile.h delete mode 100644 drumgizmo/input/midifile/midifile.cc delete mode 100644 drumgizmo/input/test/Makefile.am delete mode 100644 drumgizmo/input/test/test.cc (limited to 'drumgizmo/input') diff --git a/drumgizmo/input/Makefile.am b/drumgizmo/input/Makefile.am deleted file mode 100644 index ee82f63..0000000 --- a/drumgizmo/input/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -DISTDIRS = midifile jackmidi dummy test -SUBDIRS = @INPUT_PLUGINS@ diff --git a/drumgizmo/input/dummy/Makefile.am b/drumgizmo/input/dummy/Makefile.am deleted file mode 100644 index dfe0a57..0000000 --- a/drumgizmo/input/dummy/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ - -dummysources = \ - dummy.cc - -if HAVE_INPUT_DUMMY - -dummyltlibs = dummy.la -dummybuildsources = $(dummysources) - -else - -dummyltlibs = -dummybuildsources = - -endif - -EXTRA_DIST = $(dummysources) - -lib_LTLIBRARIES = $(dummyltlibs) - -libdir = $(INPUT_PLUGIN_DIR) - -AM_CPPFLAGS = -I$(top_srcdir)/include -dummy_la_LDFLAGS = -module -avoid-version -shared -dummy_la_LIBADD = -dummy_la_SOURCES = $(dummybuildsources) - -install-exec-hook: - rm -f $(DESTDIR)$(libdir)/dummy.la diff --git a/drumgizmo/input/dummy/dummy.cc b/drumgizmo/input/dummy/dummy.cc deleted file mode 100644 index 4a570db..0000000 --- a/drumgizmo/input/dummy/dummy.cc +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * dummy.cc - * - * Sat Apr 30 21:11:54 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 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 General Public License for more details. - * - * You should have received a copy of the GNU 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. - */ -#include - -#include -#include - -class Dummy { -public: - Dummy() {} - ~Dummy() {} - - bool init(int instruments, char *inames[]); - - void setParm(std::string parm, std::string value); - - bool start(); - void stop(); - - void pre(); - event_t *run(size_t pos, size_t len, size_t *nevents); - void post(); -}; - -bool Dummy::init(int instruments, char *inames[]) -{ - return true; -} - -void Dummy::setParm(std::string parm, std::string value) -{ -} - -bool Dummy::start() -{ - return true; -} - -void Dummy::stop() -{ -} - -void Dummy::pre() -{ -} - -event_t *Dummy::run(size_t pos, size_t len, size_t *nevents) -{ - *nevents = 0; - return NULL; - /* - if(rand() % 10 != 0) return; - - Instrument *i = NULL; - int d = rand() % drumkit->instruments.size(); - Instruments::iterator it = drumkit->instruments.begin(); - while(d--) { - i = &(it->second); - it++; - } - - if(i == NULL) return; - - Sample *s = i->sample((double)rand()/(double)RAND_MAX); - - if(s == NULL) { - printf("Missing Sample.\n"); - // continue; - } - - Channels::iterator j = drumkit->channels.begin(); - while(j != drumkit->channels.end()) { - Channel &ch = *j; - AudioFile *af = s->getAudioFile(&ch); - if(af == NULL) { - printf("Missing AudioFile.\n"); - } else { - printf("Adding event.\n"); - Event *evt = new EventSample(ch.num, 1.0, af); - eventqueue->post(evt, pos); - } - j++; - } - */ -} - -void Dummy::post() -{ -} - -extern "C" { - void *create() - { - return new Dummy(); - } - - void destroy(void *h) - { - Dummy *dummy = (Dummy*)h; - delete dummy; - } - - bool init(void *h, int i, char *inames[]) - { - Dummy *dummy = (Dummy*)h; - return dummy->init(i, inames); - } - - void setparm(void *h, const char *parm, const char *value) - { - Dummy *dummy = (Dummy*)h; - dummy->setParm(parm, value); - } - - bool start(void *h) - { - Dummy *dummy = (Dummy*)h; - return dummy->start(); - } - - void stop(void *h) - { - Dummy *dummy = (Dummy*)h; - dummy->stop(); - } - - void pre(void *h) - { - Dummy *dummy = (Dummy*)h; - dummy->pre(); - } - - event_t *run(void *h, size_t pos, size_t len, size_t *nev) - { - Dummy *dummy = (Dummy*)h; - return dummy->run(pos, len, nev); - } - - void post(void *h) - { - Dummy *dummy = (Dummy*)h; - dummy->post(); - } -} - -#ifdef TEST_AUDIOINPUTENGINEDUMMY -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: -#include "test.h" - -TEST_BEGIN; - -// TODO: Put some testcode here (see test.h for usable macros). - -TEST_END; - -#endif/*TEST_AUDIOINPUTENGINEDUMMY*/ diff --git a/drumgizmo/input/jackmidi/Makefile.am b/drumgizmo/input/jackmidi/Makefile.am deleted file mode 100644 index d392f19..0000000 --- a/drumgizmo/input/jackmidi/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ - -jackmidisources = \ - jackmidi.cc \ - $(top_srcdir)/src/midimapper.cc \ - $(top_srcdir)/src/midimapparser.cc \ - $(top_srcdir)/src/saxparser.cc \ - $(top_srcdir)/hugin/hugin.c - -if HAVE_INPUT_JACKMIDI - -jackmidiltlibs = jackmidi.la -jackmidibuildsources = $(jackmidisources) - -else - -jackmidiltlibs = -jackmidibuildsources = - -endif - -EXTRA_DIST = $(jackmidisources) - -lib_LTLIBRARIES = $(jackmidiltlibs) - -libdir = $(INPUT_PLUGIN_DIR) - -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src -I$(top_srcdir)/hugin -jackmidi_la_LDFLAGS = -module -avoid-version -shared -jackmidi_la_LIBADD = $(EXPAT_LIBS) -jackmidi_la_CXXFLAGS = $(EXPAT_CFLAGS) -jackmidi_la_SOURCES = $(jackmidibuildsources) - -install-exec-hook: - rm -f $(DESTDIR)$(libdir)/jackmidi.la diff --git a/drumgizmo/input/jackmidi/audioinputenginejackmidi.cc b/drumgizmo/input/jackmidi/audioinputenginejackmidi.cc deleted file mode 100644 index 5e1fb85..0000000 --- a/drumgizmo/input/jackmidi/audioinputenginejackmidi.cc +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * audioinputenginejackmidi.cc - * - * Sun Feb 27 11:33:31 CET 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 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 General Public License for more details. - * - * You should have received a copy of the GNU 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. - */ -#include "audioinputenginejackmidi.h" - -#define NOTE_ON 0x90 - -AudioInputEngineJackMidi::AudioInputEngineJackMidi() -{ - jackclient = init_jack_client(); - - jackclient->addJackProcess(this); - - pos = 0; -} - -AudioInputEngineJackMidi::~AudioInputEngineJackMidi() -{ - jackclient->removeJackProcess(this); - close_jack_client(); -} - -void AudioInputEngineJackMidi::jack_process(jack_nframes_t nframes) -{ - void *midibuffer = jack_port_get_buffer(midi_port, nframes); - - jack_nframes_t midievents = jack_midi_get_event_count(midibuffer); - - for(jack_nframes_t i = 0; i < midievents; i++) { - jack_midi_event_t event; - jack_midi_event_get(&event, midibuffer, i); - - if(event.size != 3) continue; - if((event.buffer[0] & NOTE_ON) != NOTE_ON) continue; - - int key = event.buffer[1]; - int velocity = event.buffer[2]; - - printf("Event key:%d vel:%d\n", key, velocity); - /* - if(kit->midimap.find(key) == kit->midimap.end()) { - printf("Missing note %d in midimap.\n", key); - continue; - } - - std::string instr = kit->midimap[key]; - - if(kit->instruments.find(instr) == kit->instruments.end()) { - printf("Missing instrument %s.\n", instr.c_str()); - continue; - } - */ - - Instrument *i = NULL; - int d = key % kit->instruments.size(); - Instruments::iterator it = kit->instruments.begin(); - while(d--) { - i = &(it->second); - it++; - } - - if(i == NULL) { - continue; - } - - // Sample *s = i.sample((float)velocity/127.0); - Sample *s = i->sample(0.5); - - if(s == NULL) { - printf("Missing Sample.\n"); - continue; - } - - Channels::iterator j = kit->channels.begin(); - while(j != kit->channels.end()) { - Channel &ch = *j; - AudioFile *af = s->getAudioFile(&ch); - if(af == NULL) { - printf("Missing AudioFile.\n"); - } else { - printf("Adding event.\n"); - Event *evt = new EventSample(ch.num, 1.0, af); - eventqueue->post(evt, pos + event.time + nframes); - } - j++; - } - } - - jack_midi_clear_buffer(midibuffer); - - pos += nframes; -} - -bool AudioInputEngineJackMidi::init(EventQueue *e, DrumKit *dk) -{ - eventqueue = e; - kit = dk; - - midi_port = jack_port_register(jackclient->jack_client, - "drumgizmo_midiin", - JACK_DEFAULT_MIDI_TYPE, - JackPortIsInput,// | JackPortIsTerminal, - 0); - - return true; -} - - -bool AudioInputEngineJackMidi::activate() -{ - jackclient->activate(); - return true; -} - -#ifdef TEST_AUDIOINPUTENGINEJACKMIDI -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: -#include "test.h" - -TEST_BEGIN; - -// TODO: Put some testcode here (see test.h for usable macros). - -TEST_END; - -#endif/*TEST_AUDIOINPUTENGINEJACKMIDI*/ diff --git a/drumgizmo/input/jackmidi/audioinputenginejackmidi.h b/drumgizmo/input/jackmidi/audioinputenginejackmidi.h deleted file mode 100644 index e4c6e69..0000000 --- a/drumgizmo/input/jackmidi/audioinputenginejackmidi.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * audioinputenginejackmidi.h - * - * Sun Feb 27 11:33:31 CET 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 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 General Public License for more details. - * - * You should have received a copy of the GNU 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. - */ -#ifndef __DRUMGIZMO_AUDIOINPUTENGINEJACKMIDI_H__ -#define __DRUMGIZMO_AUDIOINPUTENGINEJACKMIDI_H__ - -#include -#include - -#include "audioinputengine.h" -#include "event.h" - -#include "jackclient.h" - -class AudioInputEngineJackMidi : public AudioInputEngine, public JackProcess { -public: - AudioInputEngineJackMidi(); - ~AudioInputEngineJackMidi(); - - bool init(EventQueue *e, DrumKit *drumkit); - bool activate(); - void run(size_t pos, size_t len) {} - - void thread_main(); - - void jack_process(jack_nframes_t nframes); - -private: - DrumKit *kit; - size_t pos; - EventQueue *eventqueue; - - JackClient *jackclient; - jack_port_t *midi_port; -}; - -#endif/*__DRUMGIZMO_AUDIOINPUTENGINEJACKMIDI_H__*/ - diff --git a/drumgizmo/input/jackmidi/jackmidi.cc b/drumgizmo/input/jackmidi/jackmidi.cc deleted file mode 100644 index e632484..0000000 --- a/drumgizmo/input/jackmidi/jackmidi.cc +++ /dev/null @@ -1,252 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * jackmidi.cc - * - * Sat Apr 30 21:11:54 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 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 General Public License for more details. - * - * You should have received a copy of the GNU 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. - */ -/* -#include - -#include -#include - -#include -#include -#include - -#define NOTE_ON 0x90 - -#include "../../jackclient.h" - -#include - -class JackMidi : public JackProcess { -public: - JackMidi(); - virtual ~JackMidi(); - - bool init(int instruments, char *inames[]); - - void setParm(std::string parm, std::string value); - - bool start(); - void stop(); - - void pre(); - event_t *run(size_t pos, size_t len, size_t *nevents); - void post(); - - void jack_process(jack_nframes_t nframes); - -private: - void loadMap(std::string map) {} - - JackClient *jackclient{nullptr}; - jack_port_t *midi_port{nullptr}; - - size_t pos; - - event_t *list; - size_t listsize; - - std::string midimapfile; - MidiMapper mmap; -}; - -JackMidi::JackMidi() -{ - pos = 0; - - list = (event_t *)malloc(sizeof(event_t) * 1000); - listsize = 0; -} - -JackMidi::~JackMidi() -{ -} - -bool JackMidi::init(int instruments, char *inames[]) -{ - midi_port = jack_port_register(jackclient->jack_client, - "drumgizmo_midiin", - JACK_DEFAULT_MIDI_TYPE, - JackPortIsInput,// | JackPortIsTerminal, - 0); - - MidiMapParser p(midimapfile); - if(p.parse()) return false; - mmap.midimap = p.midimap; - - for(int i = 0; i < instruments; i++) { - mmap.instrmap[inames[i]] = i; - } - - return true; -} - -void JackMidi::setParm(std::string parm, std::string value) -{ - if(parm == "midimap") midimapfile = value; - if(parm == "jack_client") { - sscanf(value.c_str(), "%p", &jackclient); - if(jackclient) jackclient->addJackProcess(this); - } -} - -bool JackMidi::start() -{ - // jackclient->activate(); - return true; -} - -void JackMidi::stop() -{ -} - -void JackMidi::pre() -{ -} - -event_t *JackMidi::run(size_t pos, size_t len, size_t *nevents) -{ - *nevents = listsize; - event_t *l = list; - list = (event_t *)malloc(sizeof(event_t) * 1000); - listsize = 0; - return l; -} - -void JackMidi::jack_process(jack_nframes_t nframes) -{ - // printf("i"); fflush(stdout); - - void *midibuffer = jack_port_get_buffer(midi_port, nframes); - - jack_nframes_t midievents = jack_midi_get_event_count(midibuffer); - - for(jack_nframes_t i = 0; i < midievents; i++) { - jack_midi_event_t event; - jack_midi_event_get(&event, midibuffer, i); - - if(event.size != 3) continue; - if((event.buffer[0] & NOTE_ON) != NOTE_ON) continue; - - int key = event.buffer[1]; - int velocity = event.buffer[2]; - - printf("Event key:%d vel:%d\n", key, velocity); - - int k = mmap.lookup(key); - if(k != -1) { - - if(velocity) { - list[listsize].type = TYPE_ONSET; - list[listsize].instrument = k; - list[listsize].velocity = velocity / 127.0; - list[listsize].offset = event.time; - listsize++; - } - } - } - - jack_midi_clear_buffer(midibuffer); - - pos += nframes; -} - -void JackMidi::post() -{ -} - -extern "C" { - void *create() - { - return new JackMidi(); - } - - void destroy(void *h) - { - JackMidi *jackmidi = (JackMidi*)h; - delete jackmidi; - } - - bool init(void *h, int i, char *inames[]) - { - JackMidi *jackmidi = (JackMidi*)h; - return jackmidi->init(i, inames); - } - - void setparm(void *h, const char *parm, const char *value) - { - JackMidi *jackmidi = (JackMidi*)h; - jackmidi->setParm(parm, value); - } - - bool start(void *h) - { - JackMidi *jackmidi = (JackMidi*)h; - return jackmidi->start(); - } - - void stop(void *h) - { - JackMidi *jackmidi = (JackMidi*)h; - jackmidi->stop(); - } - - void pre(void *h) - { - JackMidi *jackmidi = (JackMidi*)h; - jackmidi->pre(); - } - - event_t *run(void *h, size_t pos, size_t len, size_t *nev) - { - JackMidi *jackmidi = (JackMidi*)h; - return jackmidi->run(pos, len, nev); - } - - void post(void *h) - { - JackMidi *jackmidi = (JackMidi*)h; - jackmidi->post(); - } -} -*/ - -#ifdef TEST_AUDIOINPUTENGINEJACKMIDI -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: -#include "test.h" - -TEST_BEGIN; - -// TODO: Put some testcode here (see test.h for usable macros). - -TEST_END; - -#endif/*TEST_AUDIOINPUTENGINEJACKMIDI*/ diff --git a/drumgizmo/input/midifile/Makefile.am b/drumgizmo/input/midifile/Makefile.am deleted file mode 100644 index 9ade475..0000000 --- a/drumgizmo/input/midifile/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ - -midifilesources = \ - midifile.cc \ - $(top_srcdir)/src/midimapper.cc \ - $(top_srcdir)/src/midimapparser.cc \ - $(top_srcdir)/src/saxparser.cc \ - $(top_srcdir)/hugin/hugin.c - - -if HAVE_INPUT_MIDIFILE - -midifileltlibs = midifile.la -midifilebuildsources = $(midifilesources) - -else - -midifileltlibs = -midifilebuildsources = - -endif - -EXTRA_DIST = $(midifilesources) - -lib_LTLIBRARIES = $(midifileltlibs) - -libdir = $(INPUT_PLUGIN_DIR) - -AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include $(SMF_CFLAGS) \ - $(EXPAT_CFLAGS) -I$(top_srcdir)/hugin -DWITH_HUG_MUTEX -midifile_la_LDFLAGS = -module -avoid-version -shared -midifile_la_LIBADD = $(EXPAT_LIBS) $(SMF_LIBS) -midifile_la_CXXFLAGS =$(EXPAT_CFLAGS) -midifile_la_SOURCES = $(midifilebuildsources) - -install-exec-hook: - rm -f $(DESTDIR)$(libdir)/midifile.la diff --git a/drumgizmo/input/midifile/audioinputenginemidifile.cc b/drumgizmo/input/midifile/audioinputenginemidifile.cc deleted file mode 100644 index 878ca1b..0000000 --- a/drumgizmo/input/midifile/audioinputenginemidifile.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * audioinputenginemidifile.cc - * - * Sun Feb 27 11:43:32 CET 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 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 General Public License for more details. - * - * You should have received a copy of the GNU 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. - */ -#include "audioinputenginemidifile.h" - -#ifdef TEST_AUDIOINPUTENGINEMIDIFILE -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: -#include "test.h" - -TEST_BEGIN; - -// TODO: Put some testcode here (see test.h for usable macros). - -TEST_END; - -#endif/*TEST_AUDIOINPUTENGINEMIDIFILE*/ diff --git a/drumgizmo/input/midifile/audioinputenginemidifile.h b/drumgizmo/input/midifile/audioinputenginemidifile.h deleted file mode 100644 index 6bb9ff6..0000000 --- a/drumgizmo/input/midifile/audioinputenginemidifile.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * audioinputenginemidifile.h - * - * Sun Feb 27 11:43:32 CET 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 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 General Public License for more details. - * - * You should have received a copy of the GNU 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. - */ -#ifndef __DRUMGIZMO_AUDIOINPUTENGINEMIDIFILE_H__ -#define __DRUMGIZMO_AUDIOINPUTENGINEMIDIFILE_H__ - -#include "audioinputengine.h" - -class AudioInputEngineMidiFile : public AudioInputEngine { -public: - AudioInputEngineMidiFile() {} - ~AudioInputEngineMidiFile() {} - - bool init(EventQueue *eventqueue, DrumKit *drumkit) { return true; } - void run(size_t pos, size_t len) {} -}; - -#endif/*__DRUMGIZMO_AUDIOINPUTENGINEMIDIFILE_H__*/ diff --git a/drumgizmo/input/midifile/midifile.cc b/drumgizmo/input/midifile/midifile.cc deleted file mode 100644 index d73d382..0000000 --- a/drumgizmo/input/midifile/midifile.cc +++ /dev/null @@ -1,271 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * dummy.cc - * - * Sat Apr 30 21:11:54 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 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 General Public License for more details. - * - * You should have received a copy of the GNU 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. - */ -#include - -#include -#include - -#include - -#include -#include - -#define NOTE_ON 0x90 - -class MidiFile { -public: - MidiFile(); - ~MidiFile() {} - - bool init(int instruments, char *inames[]); - - void setParm(std::string parm, std::string value); - - bool start(); - void stop(); - - void pre(); - event_t *run(size_t pos, size_t len, size_t *nevents); - void post(); - -private: - smf_t *smf; - smf_event_t *cur_event; - - MidiMapper mmap; - - // Parameters - std::string filename; - float speed; - int track; - std::string midimapfile; - bool loop; - double offset; -}; - -MidiFile::MidiFile() -{ - cur_event = NULL; - smf = NULL; - - speed = 1.0; - track = -1; // -1 is OMNI/all tracks - loop = false; - offset = 0; -} - -bool MidiFile::init(int instruments, char *inames[]) -{ - if(filename == "") { - fprintf(stderr, "Missing midifile argument 'file'\n"); - return false; - } - - if(midimapfile == "") { - fprintf(stderr, "Missing midimapfile argument 'midimap'.\n"); - return false; - } - - smf = smf_load(filename.c_str()); - - if(!smf) { - fprintf(stderr, "Could not open midifile '%s'.\n", filename.c_str()); - return false; - } - - MidiMapParser p(midimapfile); - if(p.parse()) { - fprintf(stderr, "Could not parse midimapfile '%s'.\n", midimapfile.c_str()); - return false; - } - mmap.midimap = p.midimap; - - for(int i = 0; i < instruments; i++) { - mmap.instrmap[inames[i]] = i; - } - - return true; -} - -void MidiFile::setParm(std::string parm, std::string value) -{ - if(parm == "file") filename = value; - if(parm == "speed") speed = atof(value.c_str()); - if(parm == "track") track = atoi(value.c_str()); - if(parm == "midimap") midimapfile = value; - if(parm == "loop") loop = true; -} - -bool MidiFile::start() -{ - return true; -} - -void MidiFile::stop() -{ -} - -void MidiFile::pre() -{ -} - -event_t *MidiFile::run(size_t pos, size_t len, size_t *nevents) -{ - event_t *evs = NULL; - size_t nevs = 0; - - double cur_max_time = (double)(pos + len) / (44100.0 / speed); - cur_max_time -= offset; - // double cur_min_time = (double)(pos) / (44100.0 / speed); - - if(!cur_event) cur_event = smf_get_next_event(smf); - - while(cur_event && cur_event->time_seconds < cur_max_time) { - if(!smf_event_is_metadata(cur_event)) { - if( (cur_event->midi_buffer_length == 3) && - ((cur_event->midi_buffer[0] & NOTE_ON) == NOTE_ON) && - (track == -1 || cur_event->track_number == track) && - cur_event->midi_buffer[2] > 0) { - - if(evs == NULL) evs = (event_t *)malloc(sizeof(event_t) * 1000); - - int key = cur_event->midi_buffer[1]; - int velocity = cur_event->midi_buffer[2]; - - evs[nevs].type = TYPE_ONSET; - size_t evpos = cur_event->time_seconds * (44100.0 / speed); - evs[nevs].offset = evpos - pos; - - int i = mmap.lookup(key); - if(i != -1) { - evs[nevs].instrument = i; - evs[nevs].velocity = velocity / 127.0; - - nevs++; - if(nevs > 999) { - fprintf(stderr, "PANIC!\n"); - break; - } - } - } - } - - cur_event = smf_get_next_event(smf); - } - - if(!cur_event) { - if(loop) { - smf_rewind(smf); - offset += cur_max_time; - } else { - if(evs == NULL) evs = (event_t *)malloc(sizeof(event_t) * 1000); - evs[nevs].type = TYPE_STOP; - evs[nevs].offset = len - 1; - nevs++; - } - } - - *nevents = nevs; - - return evs; -} - -void MidiFile::post() -{ -} - -extern "C" { - void *create() - { - return new MidiFile(); - } - - void destroy(void *h) - { - MidiFile *midifile = (MidiFile*)h; - delete midifile; - } - - bool init(void *h, int i, char *inames[]) - { - MidiFile *midifile = (MidiFile*)h; - return midifile->init(i, inames); - } - - void setparm(void *h, const char *parm, const char *value) - { - MidiFile *midifile = (MidiFile*)h; - midifile->setParm(parm, value); - } - - bool start(void *h) - { - MidiFile *midifile = (MidiFile*)h; - return midifile->start(); - } - - void stop(void *h) - { - MidiFile *midifile = (MidiFile*)h; - midifile->stop(); - } - - void pre(void *h) - { - MidiFile *midifile = (MidiFile*)h; - midifile->pre(); - } - - event_t *run(void *h, size_t pos, size_t len, size_t *nev) - { - MidiFile *midifile = (MidiFile*)h; - return midifile->run(pos, len, nev); - } - - void post(void *h) - { - MidiFile *midifile = (MidiFile*)h; - midifile->post(); - } -} - -#ifdef TEST_AUDIOINPUTENGINEMIDIFILE -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: -#include "test.h" - -TEST_BEGIN; - -// TODO: Put some testcode here (see test.h for usable macros). - -TEST_END; - -#endif/*TEST_AUDIOINPUTENGINEMIDIFILE*/ diff --git a/drumgizmo/input/test/Makefile.am b/drumgizmo/input/test/Makefile.am deleted file mode 100644 index 35466ab..0000000 --- a/drumgizmo/input/test/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ - -testsources = \ - test.cc - -if HAVE_INPUT_TEST - -testltlibs = test.la -testbuildsources = $(testsources) - -else - -testltlibs = -testbuildsources = - -endif - -EXTRA_DIST = $(testsources) - -lib_LTLIBRARIES = $(testltlibs) - -libdir = $(INPUT_PLUGIN_DIR) - -AM_CPPFLAGS = -I$(top_srcdir)/include -test_la_LDFLAGS = -module -avoid-version -shared -test_la_LIBADD = -test_la_SOURCES = $(testbuildsources) - -install-exec-hook: - rm -f $(DESTDIR)$(libdir)/test.la diff --git a/drumgizmo/input/test/test.cc b/drumgizmo/input/test/test.cc deleted file mode 100644 index b7b4a7d..0000000 --- a/drumgizmo/input/test/test.cc +++ /dev/null @@ -1,173 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * audioinputenginedummy.cc - * - * Sat Apr 30 21:11:54 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 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 General Public License for more details. - * - * You should have received a copy of the GNU 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. - */ -#include - -#include -#include - -class Test { -public: - Test() { p = 0.1; instr = -1; len = -1; } - ~Test() {} - - bool init(int instruments, char *inames[]); - - void setParm(std::string parm, std::string value); - - bool start(); - void stop(); - - void pre(); - event_t *run(size_t pos, size_t len, size_t *nevents); - void post(); - -private: - float p; - int instr; - int len; -}; - -bool Test::init(int instruments, char *inames[]) -{ - return true; -} - -void Test::setParm(std::string parm, std::string value) -{ - if(parm == "p") p = atof(value.c_str()); - if(parm == "instr") instr = atoi(value.c_str()); - if(parm == "len") len = atoi(value.c_str()); -} - -bool Test::start() -{ - return true; -} - -void Test::stop() -{ -} - -void Test::pre() -{ -} - -event_t *Test::run(size_t pos, size_t nsamples, size_t *nevents) -{ - if((float)rand() / (float)RAND_MAX > p) { - *nevents = 0; - return NULL; - } - - *nevents = 1; - event_t *evs = (event_t *)malloc(sizeof(event_t)); - evs[0].type = TYPE_ONSET; - if(len != -1 && (int)pos > len * 44100) evs[0].type = TYPE_STOP; - - if(instr != -1) evs[0].instrument = instr; - else evs[0].instrument = rand() % 32; - - evs[0].velocity = (float)rand()/(float)RAND_MAX; - evs[0].offset = nsamples?rand()%nsamples:0; - return evs; -} - -void Test::post() -{ -} - -extern "C" { - void *create() - { - return new Test(); - } - - void destroy(void *h) - { - Test *test = (Test*)h; - delete test; - } - - bool init(void *h, int i, char *inames[]) - { - Test *test = (Test*)h; - return test->init(i, inames); - } - - void setparm(void *h, const char *parm, const char *value) - { - Test *test = (Test*)h; - test->setParm(parm, value); - } - - bool start(void *h) - { - Test *test = (Test*)h; - return test->start(); - } - - void stop(void *h) - { - Test *test = (Test*)h; - test->stop(); - } - - void pre(void *h) - { - Test *test = (Test*)h; - test->pre(); - } - - event_t *run(void *h, size_t pos, size_t len, size_t *nev) - { - Test *test = (Test*)h; - return test->run(pos, len, nev); - } - - void post(void *h) - { - Test *test = (Test*)h; - test->post(); - } -} - -#ifdef TEST_AUDIOINPUTENGINETEST -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: -#include "test.h" - -TEST_BEGIN; - -// TODO: Put some testcode here (see test.h for usable macros). - -TEST_END; - -#endif/*TEST_AUDIOINPUTENGINETEST*/ -- cgit v1.2.3