From a21ab2d9260bd4cb1af1de0b8cd4cad9e9687861 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 8 Oct 2018 20:50:52 +0200 Subject: Move event.h and audiotypes.h into src and get rid of the obsolete include folder. --- src/Makefile.am | 3 ++- src/audiotypes.h | 35 +++++++++++++++++++++++++++++++++++ src/drumgizmo.cc | 4 ++-- src/event.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/inputprocessor.cc | 4 ++-- src/inputprocessor.h | 2 +- 6 files changed, 87 insertions(+), 6 deletions(-) create mode 100644 src/audiotypes.h create mode 100644 src/event.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 3ecdc76..16a952e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,6 @@ noinst_LTLIBRARIES = libdg.la libdg_la_CPPFLAGS = \ - -I$(top_srcdir)/include -I$(top_srcdir)/hugin \ -I$(top_srcdir)/hugin -I$(top_srcdir)/pugixml/src \ $(SSEFLAGS) \ $(ZITA_CPPFLAGS) $(SNDFILE_CFLAGS) $(PTHREAD_CFLAGS) @@ -47,6 +46,7 @@ EXTRA_DIST = \ $(nodist_libdg_la_SOURCES) \ atomic.h \ audio.h \ + audiotypes.h \ audiocache.h \ audiocacheeventhandler.h \ audiocachefile.h \ @@ -67,6 +67,7 @@ EXTRA_DIST = \ drumgizmo.h \ drumkit.h \ drumkitloader.h \ + event.h \ events.h \ inputfilter.h \ inputprocessor.h \ diff --git a/src/audiotypes.h b/src/audiotypes.h new file mode 100644 index 0000000..5add8cd --- /dev/null +++ b/src/audiotypes.h @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/*************************************************************************** + * sample.h + * + * Fri Jun 3 12:12:17 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 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 + +//typedef signed short int sample_t; +typedef float sample_t; + +typedef unsigned int channels_t; +typedef unsigned int channel_t; + +typedef float level_t; diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc index 2c543cd..0e374f2 100644 --- a/src/drumgizmo.cc +++ b/src/drumgizmo.cc @@ -139,7 +139,7 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples) resample_ratio = 1.0; } - if (settings_getter.audition_counter.hasChanged()) + if(settings_getter.audition_counter.hasChanged()) { settings_getter.audition_counter.getValue(); auto instrument_name = settings.audition_instrument.load(); @@ -154,7 +154,7 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples) } } - events.emplace_back(event_t{TYPE_ONSET, instrument_index, 0, velocity}); + events.push_back({EventType::OnSet, instrument_index, 0, velocity}); } bool active_events_left = diff --git a/src/event.h b/src/event.h new file mode 100644 index 0000000..2b10e44 --- /dev/null +++ b/src/event.h @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/*************************************************************************** + * event.h + * + * Fri Jun 3 12:10:50 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 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 + +#include + +//! Event types +enum class EventType +{ + OnSet, + Stop, +}; + +//! POD datatype for input event transport. +struct event_t +{ + EventType type; //!< The type of the event. + std::size_t instrument; //!< The instrument number. + std::size_t offset; //!< The offset position in the input buffer + float velocity; //!< The velocity if the type is a note on [0; 1] +}; diff --git a/src/inputprocessor.cc b/src/inputprocessor.cc index 0adc389..c004933 100644 --- a/src/inputprocessor.cc +++ b/src/inputprocessor.cc @@ -57,7 +57,7 @@ bool InputProcessor::process(std::vector& events, { for(auto& event: events) { - if(event.type == TYPE_ONSET) + if(event.type == EventType::OnSet) { if(!processOnset(event, pos, resample_ratio)) { @@ -181,7 +181,7 @@ bool InputProcessor::processOnset(event_t& event, bool InputProcessor::processStop(event_t& event) { - if(event.type == TYPE_STOP) + if(event.type == EventType::Stop) { is_stopping = true; } diff --git a/src/inputprocessor.h b/src/inputprocessor.h index 95fdfdb..794ca54 100644 --- a/src/inputprocessor.h +++ b/src/inputprocessor.h @@ -56,7 +56,7 @@ public: private: DrumKit& kit; std::list* activeevents; - bool is_stopping; ///< Is set to true when a TYPE_STOP event has been seen. + bool is_stopping; ///< Is set to true when a EventType::Stop event has been seen. bool processOnset(event_t& event, std::size_t pos, double resample_ratio); bool processStop(event_t& event); -- cgit v1.2.3