comparison transform/PluginTransform.cpp @ 182:21a76c9ed5c3

* Merge transform directory from sv-match-alignment branch (the previous comment included notes for this stuff, but I missed it in the actual merge) * Fix crash when a transform fails to create an output model and the thread that created the transform then deletes its input model thinking it's no longer needed, even though the transform run thread is still using it -- fix is to wait() on the transform before returning the null output model
author Chris Cannam
date Fri, 28 Sep 2007 16:15:06 +0000
parents a65a01870d8c
children 1ded52c7f31c
comparison
equal deleted inserted replaced
181:a65a01870d8c 182:21a76c9ed5c3
28 PluginTransform::ExecutionContext::ExecutionContext(int _c, size_t _bs) : 28 PluginTransform::ExecutionContext::ExecutionContext(int _c, size_t _bs) :
29 channel(_c), 29 channel(_c),
30 domain(Vamp::Plugin::TimeDomain), 30 domain(Vamp::Plugin::TimeDomain),
31 stepSize(_bs ? _bs : 1024), 31 stepSize(_bs ? _bs : 1024),
32 blockSize(_bs ? _bs : 1024), 32 blockSize(_bs ? _bs : 1024),
33 windowType(HanningWindow) 33 windowType(HanningWindow),
34 startFrame(0),
35 duration(0),
36 sampleRate(0)
34 { 37 {
35 } 38 }
36 39
37 PluginTransform::ExecutionContext::ExecutionContext(int _c, size_t _ss, 40 PluginTransform::ExecutionContext::ExecutionContext(int _c, size_t _ss,
38 size_t _bs, WindowType _wt) : 41 size_t _bs, WindowType _wt) :
39 channel(_c), 42 channel(_c),
40 domain(Vamp::Plugin::FrequencyDomain), 43 domain(Vamp::Plugin::FrequencyDomain),
41 stepSize(_ss ? _ss : (_bs ? _bs / 2 : 512)), 44 stepSize(_ss ? _ss : (_bs ? _bs / 2 : 512)),
42 blockSize(_bs ? _bs : 1024), 45 blockSize(_bs ? _bs : 1024),
43 windowType(_wt) 46 windowType(_wt),
47 startFrame(0),
48 duration(0),
49 sampleRate(0)
44 { 50 {
45 } 51 }
46 52
47 PluginTransform::ExecutionContext::ExecutionContext(int _c, 53 PluginTransform::ExecutionContext::ExecutionContext(int _c,
48 const Vamp::PluginBase *_plugin) : 54 const Vamp::PluginBase *_plugin) :
49 channel(_c), 55 channel(_c),
50 domain(Vamp::Plugin::TimeDomain), 56 domain(Vamp::Plugin::TimeDomain),
51 stepSize(0), 57 stepSize(0),
52 blockSize(0), 58 blockSize(0),
53 windowType(HanningWindow) 59 windowType(HanningWindow),
60 startFrame(0),
61 duration(0),
62 sampleRate(0)
54 { 63 {
55 makeConsistentWithPlugin(_plugin); 64 makeConsistentWithPlugin(_plugin);
56 } 65 }
57 66
58 bool 67 bool
60 { 69 {
61 return (c.channel == channel && 70 return (c.channel == channel &&
62 c.domain == domain && 71 c.domain == domain &&
63 c.stepSize == stepSize && 72 c.stepSize == stepSize &&
64 c.blockSize == blockSize && 73 c.blockSize == blockSize &&
65 c.windowType == windowType); 74 c.windowType == windowType &&
75 c.startFrame == startFrame &&
76 c.duration == duration &&
77 c.sampleRate == sampleRate);
66 } 78 }
67 79
68 void 80 void
69 PluginTransform::ExecutionContext::makeConsistentWithPlugin(const Vamp::PluginBase *_plugin) 81 PluginTransform::ExecutionContext::makeConsistentWithPlugin(const Vamp::PluginBase *_plugin)
70 { 82 {