summaryrefslogtreecommitdiffhomepage
path: root/MIDIPlayer.h
blob: 8009029b8806ca0be8831e472e4fc8d15a6b5ebb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once

#include <string>
#include <vector>

#include <boost/process.hpp>
#include <alsa/asoundlib.h>

#include "config.h"

#include <filesystem>

class MIDIPlayer
{
public:
  MIDIPlayer(Config& config);

  void start();

  void stop();

  bool is_playing();

  void set_file(const std::string& filename);

  std::string get_file();

  std::vector<std::string> get_filelist();

  int get_midi_port();

private:
  void init_seq(void);
  void close_seq(void);
  void iterate_ports(void);

  Config& m_config;
  boost::process::child m_child;
  std::filesystem::path m_dir;
  std::string m_file;

  snd_seq_t* m_seq;
  int m_client;
};