diff options
author | Robert Jonsson <spamatica@gmail.com> | 2011-09-15 12:14:55 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2011-09-15 12:14:55 +0000 |
commit | b0546e5e7f7044019892543c6c82029db8d564a7 (patch) | |
tree | 1b96a6260900f3fbf3513fb48a5a72aa89052dc8 /attic/muse_qt4_evolution/midiplugins/metronom/metronom.cpp | |
parent | 583c73d1a07154d3d2672d65d8cce6495f490454 (diff) |
moved attic to a branch of it's own
Diffstat (limited to 'attic/muse_qt4_evolution/midiplugins/metronom/metronom.cpp')
-rw-r--r-- | attic/muse_qt4_evolution/midiplugins/metronom/metronom.cpp | 167 |
1 files changed, 0 insertions, 167 deletions
diff --git a/attic/muse_qt4_evolution/midiplugins/metronom/metronom.cpp b/attic/muse_qt4_evolution/midiplugins/metronom/metronom.cpp deleted file mode 100644 index ece1e466..00000000 --- a/attic/muse_qt4_evolution/midiplugins/metronom/metronom.cpp +++ /dev/null @@ -1,167 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: metronom.cpp,v 1.3 2005/11/16 17:55:59 wschweer Exp $ -// -// metronom - midi metronom -// -// (C) Copyright 2005 Werner Schweer (ws@seh.de) -//========================================================= - -#include "metronomgui.h" -#include "metronom.h" -#include "midi.h" -#include "midievent.h" - -//--------------------------------------------------------- -// Metronom -//--------------------------------------------------------- - -Metronom::Metronom(const char* name, const MempiHost* h) - : Mempi(name, h) - { - gui = 0; - } - -//--------------------------------------------------------- -// Metronom -//--------------------------------------------------------- - -Metronom::~Metronom() - { - if (gui) - delete gui; - } - -//--------------------------------------------------------- -// init -//--------------------------------------------------------- - -bool Metronom::init() - { - nextTick = 0; - lastTo = 0; - data.measureNote = 63; - data.measureVelo = 127; - data.beatNote = 63; - data.beatVelo = 70; - - gui = new MetronomGui(this, 0); - gui->hide(); - gui->setWindowTitle(QString(name())); - - return false; - } - -//--------------------------------------------------------- -// getGeometry -//--------------------------------------------------------- - -void Metronom::getGeometry(int* x, int* y, int* w, int* h) const - { - QPoint pos(gui->pos()); - QSize size(gui->size()); - *x = pos.x(); - *y = pos.y(); - *w = size.width(); - *h = size.height(); - } - -//--------------------------------------------------------- -// setGeometry -//--------------------------------------------------------- - -void Metronom::setGeometry(int x, int y, int w, int h) - { - gui->resize(QSize(w, h)); - gui->move(QPoint(x, y)); - } - -//--------------------------------------------------------- -// process -//--------------------------------------------------------- - -void Metronom::process(unsigned from, unsigned to, MidiEventList* /*il*/, MidiEventList* ol) - { - if (from == to) { - nextTick = 0; - return; - } - if (lastTo != from) { // seek? -// printf(" seek? %d-%d\n", lastTo, from); - nextTick = 0; - } - lastTo = to; - if (nextTick > to) - return; - while (nextTick < to) { - int bar, beat; - unsigned tick; - if (nextTick < from) { - host->bar(from, &bar, &beat, &tick); - if (tick) - nextTick = host->bar2tick(bar, beat+1, 0); - else - nextTick = from; - } - host->bar(nextTick, &bar, &beat, &tick); - bool isMeasure = beat == 0; - - MidiEvent ev(nextTick, 0, ME_NOTEON, data.beatNote, data.beatVelo); - if (isMeasure) { - ev.setA(data.measureNote); - ev.setB(data.measureVelo); - } - ol->insert(ev); // insert note on - ev.setB(0); - ev.setTime(nextTick + 10); - ev.setB(0); - ol->insert(ev); // insert note off - - nextTick = host->bar2tick(bar, beat+1, 0); - } - } - -//--------------------------------------------------------- -// getInitData -//--------------------------------------------------------- - -void Metronom::getInitData(int* n, const unsigned char** p) const - { - *n = sizeof(data); - *p = (unsigned char*)&data; - } - -//--------------------------------------------------------- -// setInitData -//--------------------------------------------------------- - -void Metronom::setInitData(int n, const unsigned char* p) - { - memcpy((void*)&data, p, n); - if (gui) - gui->init(); - } - -//--------------------------------------------------------- -// inst -//--------------------------------------------------------- - -static Mempi* instantiate(const char* name, const MempiHost* h) - { - return new Metronom(name, h); - } - -extern "C" { - static MEMPI descriptor = { - "Metronom", - "MusE Simple Midi Metronom", - "0.1", // version string - MEMPI_GENERATOR, - MEMPI_MAJOR_VERSION, MEMPI_MINOR_VERSION, - instantiate - }; - - const MEMPI* mempi_descriptor() { return &descriptor; } - } - |