diff options
Diffstat (limited to 'drumgizmo/input')
-rw-r--r-- | drumgizmo/input/inputdummy.cc | 36 | ||||
-rw-r--r-- | drumgizmo/input/inputdummy.h | 4 | ||||
-rw-r--r-- | drumgizmo/input/jackmidi.cc | 16 | ||||
-rw-r--r-- | drumgizmo/input/jackmidi.h | 10 | ||||
-rw-r--r-- | drumgizmo/input/midifile.cc | 44 | ||||
-rw-r--r-- | drumgizmo/input/midifile.h | 11 |
6 files changed, 81 insertions, 40 deletions
diff --git a/drumgizmo/input/inputdummy.cc b/drumgizmo/input/inputdummy.cc index f2d33b7..20ffd08 100644 --- a/drumgizmo/input/inputdummy.cc +++ b/drumgizmo/input/inputdummy.cc @@ -26,24 +26,42 @@ */ #include "inputdummy.h" -DummyInputEngine::DummyInputEngine() {} +DummyInputEngine::DummyInputEngine() +{ +} -DummyInputEngine::~DummyInputEngine() {} +DummyInputEngine::~DummyInputEngine() +{ +} -bool DummyInputEngine::init(Instruments &instruments) { return true; } +bool DummyInputEngine::init(Instruments& instruments) +{ + return true; +} -void DummyInputEngine::setParm(std::string parm, std::string value) {} +void DummyInputEngine::setParm(std::string parm, std::string value) +{ +} -bool DummyInputEngine::start() { return true; } +bool DummyInputEngine::start() +{ + return true; +} -void DummyInputEngine::stop() {} +void DummyInputEngine::stop() +{ +} -void DummyInputEngine::pre() {} +void DummyInputEngine::pre() +{ +} -event_t *DummyInputEngine::run(size_t pos, size_t len, size_t *nevents) +event_t* DummyInputEngine::run(size_t pos, size_t len, size_t* nevents) { nevents = 0u; return nullptr; } -void DummyInputEngine::post() {} +void DummyInputEngine::post() +{ +} diff --git a/drumgizmo/input/inputdummy.h b/drumgizmo/input/inputdummy.h index fb84443..30d0599 100644 --- a/drumgizmo/input/inputdummy.h +++ b/drumgizmo/input/inputdummy.h @@ -34,11 +34,11 @@ public: ~DummyInputEngine(); // based on AudioInputEngine - bool init(Instruments &instruments) override; + bool init(Instruments& instruments) override; void setParm(std::string parm, std::string value) override; bool start() override; void stop() override; void pre() override; - event_t *run(size_t pos, size_t len, size_t *nevents) override; + event_t* run(size_t pos, size_t len, size_t* nevents) override; void post() override; }; diff --git a/drumgizmo/input/jackmidi.cc b/drumgizmo/input/jackmidi.cc index 5ae6add..386adac 100644 --- a/drumgizmo/input/jackmidi.cc +++ b/drumgizmo/input/jackmidi.cc @@ -30,11 +30,18 @@ #include "cpp11fix.h" // required for c++11 #include "jackmidi.h" -int const NOTE_ON = 0x90; +static int const NOTE_ON = 0x90; JackMidiInputEngine::JackMidiInputEngine(JackClient &client) - : AudioInputEngine{}, JackProcess{}, client(client), port{nullptr}, - midimap{}, midi_mapper{}, pos{0u}, list{nullptr}, listsize{0u} + : AudioInputEngine{} + , JackProcess{} + , client(client) + , port{nullptr} + , midimap{} + , midi_mapper{} + , pos{0u} + , list{nullptr} + , listsize{0u} { client.add(*this); } @@ -96,8 +103,7 @@ event_t *JackMidiInputEngine::run(size_t pos, size_t len, size_t *nevents) { *nevents = listsize; event_t *l = list; - printf("Owning raw pointer at drumgizmo/input/jackmidi.cc - GET RID OF " - "THEM!\n"); + // todo: get rid of malloc list = (event_t *)malloc(sizeof(event_t) * 1000); listsize = 0; return l; diff --git a/drumgizmo/input/jackmidi.h b/drumgizmo/input/jackmidi.h index 41a3e55..e129071 100644 --- a/drumgizmo/input/jackmidi.h +++ b/drumgizmo/input/jackmidi.h @@ -34,7 +34,9 @@ #include "midimapparser.h" #include "../jackclient.h" -class JackMidiInputEngine : public AudioInputEngine, public JackProcess +class JackMidiInputEngine + : public AudioInputEngine + , public JackProcess { public: JackMidiInputEngine(JackClient &client); @@ -42,12 +44,12 @@ public: // based on AudioInputEngine bool isMidiEngine() override; - bool init(Instruments &instruments) override; + bool init(Instruments& instruments) override; void setParm(std::string parm, std::string value) override; bool start() override; void stop() override; void pre() override; - event_t *run(size_t pos, size_t len, size_t *nevents) override; + event_t* run(size_t pos, size_t len, size_t* nevents) override; void post() override; // based on JackProcess @@ -61,6 +63,6 @@ private: MidiMapper midi_mapper; std::size_t pos; - event_t *list; + event_t* list; size_t listsize; }; diff --git a/drumgizmo/input/midifile.cc b/drumgizmo/input/midifile.cc index 0cc9dea..4e36c9d 100644 --- a/drumgizmo/input/midifile.cc +++ b/drumgizmo/input/midifile.cc @@ -28,13 +28,17 @@ #include "midifile.h" -int const NOTE_ON = 0x90; +static int const NOTE_ON = 0x90; MidifileInputEngine::MidifileInputEngine() - : smf{nullptr}, current_event{nullptr}, file{}, midimap{}, speed{1.f}, - track{-1} // all tracks - , - loop{false}, offset{0.0} + : smf{nullptr} + , current_event{nullptr} + , file{} + , midimap{} + , speed{1.f} + , track{-1} // all tracks + , loop{false} + , offset{0.0} { } @@ -46,9 +50,12 @@ MidifileInputEngine::~MidifileInputEngine() } } -bool MidifileInputEngine::isMidiEngine() { return true; } +bool MidifileInputEngine::isMidiEngine() +{ + return true; +} -bool MidifileInputEngine::init(Instruments &instruments) +bool MidifileInputEngine::init(Instruments& instruments) { if (file == "") { @@ -119,11 +126,18 @@ void MidifileInputEngine::setParm(std::string parm, std::string value) } } -bool MidifileInputEngine::start() { return true; } +bool MidifileInputEngine::start() +{ + return true; +} -void MidifileInputEngine::stop() {} +void MidifileInputEngine::stop() +{ +} -void MidifileInputEngine::pre() {} +void MidifileInputEngine::pre() +{ +} event_t *MidifileInputEngine::run(size_t pos, size_t len, size_t *nevents) { @@ -151,8 +165,7 @@ event_t *MidifileInputEngine::run(size_t pos, size_t len, size_t *nevents) if (evs == nullptr) { - printf("Owning raw pointer at drumgizmo/input/midifile.cc - GET RID " - "OF THEM!\n"); + // todo: get rid of malloc evs = (event_t *)malloc(sizeof(event_t) * 1000); } @@ -193,8 +206,7 @@ event_t *MidifileInputEngine::run(size_t pos, size_t len, size_t *nevents) { if (evs == nullptr) { - printf("Owning raw pointer at drumgizmo/input/midifile.cc - GET RID OF " - "THEM!\n"); + // todo: get rid of malloc evs = (event_t *)malloc(sizeof(event_t) * 1000); } evs[num_events].type = TYPE_STOP; @@ -206,4 +218,6 @@ event_t *MidifileInputEngine::run(size_t pos, size_t len, size_t *nevents) return evs; } -void MidifileInputEngine::post() {} +void MidifileInputEngine::post() +{ +} diff --git a/drumgizmo/input/midifile.h b/drumgizmo/input/midifile.h index 5efcc72..a7e4cf0 100644 --- a/drumgizmo/input/midifile.h +++ b/drumgizmo/input/midifile.h @@ -34,7 +34,8 @@ #include "midimapper.h" #include "midimapparser.h" -class MidifileInputEngine : public AudioInputEngine +class MidifileInputEngine + : public AudioInputEngine { public: MidifileInputEngine(); @@ -42,17 +43,17 @@ public: // based on AudioInputEngine bool isMidiEngine() override; - bool init(Instruments &instruments) override; + bool init(Instruments& instruments) override; void setParm(std::string parm, std::string value) override; bool start() override; void stop() override; void pre() override; - event_t *run(size_t pos, size_t len, size_t *nevents) override; + event_t* run(size_t pos, size_t len, size_t* nevents) override; void post() override; private: - smf_t *smf; - smf_event_t *current_event; + smf_t* smf; + smf_event_t* current_event; MidiMapper midi_mapper; |