Mercurial > hg > silvet
comparison src/LiveInstruments.cpp @ 298:ebe5e0942bb8 livemode
More toward a possible live mode
author | Chris Cannam |
---|---|
date | Fri, 28 Nov 2014 10:18:22 +0000 |
parents | |
children | a4216826f01c |
comparison
equal
deleted
inserted
replaced
297:d6ab1b4918bd | 298:ebe5e0942bb8 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Silvet | |
5 | |
6 A Vamp plugin for note transcription. | |
7 Centre for Digital Music, Queen Mary University of London. | |
8 | |
9 This program is free software; you can redistribute it and/or | |
10 modify it under the terms of the GNU General Public License as | |
11 published by the Free Software Foundation; either version 2 of the | |
12 License, or (at your option) any later version. See the file | |
13 COPYING included with this distribution for more information. | |
14 */ | |
15 | |
16 #include "LiveInstruments.h" | |
17 | |
18 #include "data/include/templates.h" | |
19 | |
20 using namespace std; | |
21 | |
22 InstrumentPack | |
23 LiveAdapter::adapt(const InstrumentPack &original) | |
24 { | |
25 vector<InstrumentPack::Templates> templates; | |
26 | |
27 for (vector<InstrumentPack::Templates>::const_iterator i = | |
28 original.templates.begin(); | |
29 i != original.templates.end(); ++i) { | |
30 | |
31 InstrumentPack::Templates t; | |
32 t.lowestNote = i->lowestNote; | |
33 t.highestNote = i->highestNote; | |
34 t.data.resize(i->data.size()); | |
35 | |
36 for (int j = 0; j < int(i->data.size()); ++j) { | |
37 t.data[j].resize(SILVET_TEMPLATE_HEIGHT/5); | |
38 for (int k = 0; k < SILVET_TEMPLATE_HEIGHT/5; ++k) { | |
39 t.data[j][k] = i->data[j][k * 5 + 2 - SILVET_TEMPLATE_MAX_SHIFT]; | |
40 } | |
41 } | |
42 templates.push_back(t); | |
43 } | |
44 | |
45 InstrumentPack live(original.lowestNote, | |
46 original.highestNote, | |
47 original.name, | |
48 templates); | |
49 | |
50 live.templateHeight = SILVET_TEMPLATE_HEIGHT/5; | |
51 live.templateMaxShift = 0; | |
52 live.templateSize = live.templateHeight; | |
53 | |
54 live.maxPolyphony = original.maxPolyphony; | |
55 live.pitchSparsity = original.pitchSparsity; | |
56 live.sourceSparsity = original.sourceSparsity; | |
57 live.levelThreshold = original.levelThreshold; | |
58 | |
59 return live; | |
60 } | |
61 | |
62 vector<InstrumentPack> | |
63 LiveAdapter::adaptAll(const vector<InstrumentPack> &v) | |
64 { | |
65 vector<InstrumentPack> out; | |
66 for (int i = 0; i < (int)v.size(); ++i) { | |
67 InstrumentPack p(LiveAdapter::adapt(v[i])); | |
68 out.push_back(p); | |
69 } | |
70 return out; | |
71 } |