AlsaBridge.cpp
branchv_0
changeset 2 f34476ab597f
child 3 e238528eb19c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/AlsaBridge.cpp	Fri Dec 18 23:19:32 2020 +0100
     1.3 @@ -0,0 +1,56 @@
     1.4 +/**
     1.5 + * DJM-Fix
     1.6 + * Copyright © 2020 František Kučera (Frantovo.cz, GlobalCode.info)
     1.7 + *
     1.8 + * This program is free software: you can redistribute it and/or modify
     1.9 + * it under the terms of the GNU General Public License as published by
    1.10 + * the Free Software Foundation, version 3 of the License.
    1.11 + *
    1.12 + * This program is distributed in the hope that it will be useful,
    1.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    1.15 + * GNU General Public License for more details.
    1.16 + *
    1.17 + * You should have received a copy of the GNU General Public License
    1.18 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    1.19 + */
    1.20 +#include <iostream>
    1.21 +
    1.22 +#include "AlsaBridge.h"
    1.23 +
    1.24 +namespace djmfix {
    1.25 +namespace alsa {
    1.26 +
    1.27 +class AlsaBridgeImpl : public AlsaBridge, private djmfix::MidiSender {
    1.28 +private:
    1.29 +	djmfix::DJMFix* djmFix;
    1.30 +public:
    1.31 +
    1.32 +	AlsaBridgeImpl(djmfix::DJMFix* djmFix) : djmFix(djmFix) {
    1.33 +		djmFix->setMidiSender(this);
    1.34 +	}
    1.35 +
    1.36 +	virtual ~AlsaBridgeImpl() {
    1.37 +		std::cerr << "~AlsaBridgeImpl()" << std::endl; // TODO: do not mess STDIO
    1.38 +	}
    1.39 +
    1.40 +	virtual void start() override {
    1.41 +		djmFix->start();
    1.42 +	}
    1.43 +
    1.44 +	virtual void stop() override {
    1.45 +		djmFix->stop();
    1.46 +	}
    1.47 +
    1.48 +	virtual void send(MidiMessage midiMessage) override {
    1.49 +		std::cerr << "AlsaBridgeImpl::send()" << std::endl; // TODO: do not mess STDIO
    1.50 +	}
    1.51 +
    1.52 +};
    1.53 +
    1.54 +AlsaBridge* create(djmfix::DJMFix* djmFix) {
    1.55 +	return new AlsaBridgeImpl(djmFix);
    1.56 +}
    1.57 +
    1.58 +}
    1.59 +}