AlsaBridge.cpp
author František Kučera <franta-hg@frantovo.cz>
Mon, 04 Jan 2021 15:45:12 +0100
branchv_0
changeset 12 15d87fdd6e6c
parent 11 5b351628a377
child 13 334b727f7516
permissions -rw-r--r--
use Logger instead of messing with STDIO directly
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * DJM-Fix
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2020 František Kučera (Frantovo.cz, GlobalCode.info)
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
#include <iostream>
12
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    18
#include <sstream>
5
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    19
#include <stdexcept>
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    20
#include <thread>
9
ee976a1d1f0a lock in AlsaBridge
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
    21
#include <mutex>
5
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    22
#include <atomic>
11
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    23
#include <regex>
2
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
3
e238528eb19c link to ALSA (libasound)
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    25
#include <alsa/asoundlib.h>
e238528eb19c link to ALSA (libasound)
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    26
2
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
#include "AlsaBridge.h"
12
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    28
#include "Logger.h"
2
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
namespace djmfix {
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
namespace alsa {
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
12
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    33
using L = djmfix::logging::Level;
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    34
2
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
class AlsaBridgeImpl : public AlsaBridge, private djmfix::MidiSender {
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
private:
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
	djmfix::DJMFix* djmFix;
12
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    38
	djmfix::logging::Logger* logger;
5
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    39
	snd_rawmidi_t* input;
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    40
	snd_rawmidi_t* output;
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    41
	std::thread receivingThread;
9
ee976a1d1f0a lock in AlsaBridge
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
    42
	std::recursive_mutex midiMutex;
5
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    43
	std::atomic<bool> stopped{false};
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    44
11
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    45
	std::string findDeviceName(std::regex cardNamePattern) {
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    46
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    47
		std::vector<int> cardNumbers;
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    48
12
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    49
		logger->log(L::INFO, "Looking for available cards:");
11
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    50
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    51
		for (int card = -1; snd_card_next(&card) == 0 && card >= 0;) {
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    52
			char* longName = nullptr;
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    53
			snd_card_get_longname(card, &longName);
12
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    54
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    55
			std::stringstream logMessage;
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    56
			logMessage << " - card: #" << card << ": '" << longName << "'";
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    57
11
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    58
			if (std::regex_match(longName, cardNamePattern)) {
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    59
				cardNumbers.push_back(card);
12
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    60
				logMessage << " [matches]";
11
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    61
			}
12
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    62
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    63
			logger->log(L::INFO, logMessage.str());
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    64
11
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    65
			free(longName);
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    66
		}
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    67
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    68
		if (cardNumbers.size() == 1) {
12
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    69
			logger->log(L::INFO, "Going to fix card #" + std::to_string(cardNumbers[0]));
11
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    70
			return "hw:" + std::to_string(cardNumbers[0]);
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    71
		} else if (cardNumbers.empty()) {
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    72
			throw std::invalid_argument("No card with matching name found. Is the card connected? Maybe try to provide different name pattern.");
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    73
		} else {
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    74
			throw std::invalid_argument("Multiple cards with matching name found. Please provide a name pattern that matches only one card");
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    75
		}
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    76
	}
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    77
5
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    78
	void run() {
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    79
		while (!stopped) {
9
ee976a1d1f0a lock in AlsaBridge
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
    80
			{
ee976a1d1f0a lock in AlsaBridge
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
    81
				std::lock_guard<std::recursive_mutex> lock(midiMutex);
ee976a1d1f0a lock in AlsaBridge
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
    82
				// TODO: poll
ee976a1d1f0a lock in AlsaBridge
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
    83
				uint8_t buffer[256];
ee976a1d1f0a lock in AlsaBridge
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
    84
				ssize_t length = snd_rawmidi_read(input, buffer, sizeof (buffer));
ee976a1d1f0a lock in AlsaBridge
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
    85
				if (length > 0 && length <= sizeof (buffer)) {
ee976a1d1f0a lock in AlsaBridge
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
    86
					// TODO: multiple messages combined together?
ee976a1d1f0a lock in AlsaBridge
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
    87
					djmFix->receive(MidiMessage(buffer, buffer + length));
ee976a1d1f0a lock in AlsaBridge
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
    88
				}
5
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    89
			}
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    90
			std::this_thread::sleep_for(std::chrono::milliseconds(100));
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    91
		}
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    92
	}
2
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    93
public:
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    94
12
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    95
	AlsaBridgeImpl(djmfix::DJMFix* djmFix, const std::string& cardNamePattern, djmfix::logging::Logger* logger) : djmFix(djmFix), logger(logger ? logger : djmfix::logging::blackhole()) {
5
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    96
		if (djmFix == nullptr) throw std::invalid_argument("need a djmFix for AlsaBridge");
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    97
11
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    98
		std::string deviceName = findDeviceName(std::regex(cardNamePattern));
5b351628a377 Find card by a name pattern (regular expression) instead using hardcoded name.
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    99
5
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
   100
		int error = snd_rawmidi_open(&input, &output, deviceName.c_str(), SND_RAWMIDI_NONBLOCK);
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
   101
		if (error) throw std::invalid_argument("unable to open ALSA device");
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
   102
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
   103
2
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   104
		djmFix->setMidiSender(this);
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   105
	}
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   106
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   107
	virtual ~AlsaBridgeImpl() {
12
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
   108
		// TODO: do not use raw/exclusive access to the MIDI device
5
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
   109
		snd_rawmidi_close(input);
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
   110
		snd_rawmidi_close(output);
12
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
   111
		logger->log(L::FINE, "~AlsaBridgeImpl()");
2
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   112
	}
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   113
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   114
	virtual void start() override {
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   115
		djmFix->start();
5
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
   116
		receivingThread = std::thread(&AlsaBridgeImpl::run, this);
2
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   117
	}
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   118
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   119
	virtual void stop() override {
5
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
   120
		stopped = true;
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
   121
		receivingThread.join();
2
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   122
		djmFix->stop();
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   123
	}
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   124
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   125
	virtual void send(MidiMessage midiMessage) override {
9
ee976a1d1f0a lock in AlsaBridge
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
   126
		std::lock_guard<std::recursive_mutex> lock(midiMutex);
5
ef8f4023e32e sending and receiving MIDI messages through ALSA (the dirty way)
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
   127
		ssize_t length = snd_rawmidi_write(output, midiMessage.data(), midiMessage.size());
12
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
   128
		logger->log(L::INFO, "AlsaBridgeImpl::send(): length = " + std::to_string(length));
2
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   129
	}
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   130
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   131
};
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   132
12
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
   133
AlsaBridge* create(djmfix::DJMFix* djmFix, const std::string& deviceName, djmfix::logging::Logger* logger) {
15d87fdd6e6c use Logger instead of messing with STDIO directly
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
   134
	return new AlsaBridgeImpl(djmFix, deviceName, logger);
2
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   135
}
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   136
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   137
}
f34476ab597f background thread + AlsaBridge skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   138
}