1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /***************************************************************************
3  *            lv2_test_host.h
4  *
5  *  Wed Feb 11 23:11:20 CET 2015
6  *  Copyright 2015 Bent Bisballe Nyeng
7  *  deva@aasimon.org
8  ****************************************************************************/
9 
10 /*
11  *  This file is part of DrumGizmo.
12  *
13  *  DrumGizmo is free software; you can redistribute it and/or modify
14  *  it under the terms of the GNU Lesser General Public License as published by
15  *  the Free Software Foundation; either version 3 of the License, or
16  *  (at your option) any later version.
17  *
18  *  DrumGizmo is distributed in the hope that it will be useful,
19  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  *  GNU Lesser General Public License for more details.
22  *
23  *  You should have received a copy of the GNU Lesser General Public License
24  *  along with DrumGizmo; if not, write to the Free Software
25  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
26  */
27 #pragma once
28 
29 #include <lilv/lilv.h>
30 #include <lv2/lv2plug.in/ns/ext/atom/atom.h>
31 
32 class LV2TestHost {
33 public:
34 	class Sequence {
35 	public:
36 		Sequence(void *buffer, size_t buffer_size);
37 		void clear();
38 		void addMidiNote(uint64_t pos, uint8_t key, int8_t velocity);
39 		void *data();
40 
41 	private:
42 		void *buffer;
43 		size_t buffer_size;
44 		LV2_Atom_Sequence *seq;
45 	};
46 
47 	LV2TestHost(const char *lv2_path);
48 	~LV2TestHost();
49 
50 	int open(const char *plugin_uri);
51 	int close();
52 
53 	int verify();
54 
55 	//void getMetadata();
56 	//int getPorts();
57 
58 	int createInstance(size_t samplerate);
59 	int destroyInstance();
60 
61 	int connectPort(int port, void *portdata);
62 
63 	int activate();
64 	int deactivate();
65 
66 	int loadConfig(const char *config, size_t size);
67 	int run(int num_samples);
68 
69 private:
70 	LilvWorld* world;
71 	const LilvPlugins* plugins;
72 	LilvNode* uri;
73 	const LilvPlugin* plugin;
74 
75 	LilvInstance* instance;
76 };
77