Mercurial > hg > svapp
comparison audioio/AudioGenerator.cpp @ 10:b6dc944128da
* Add basics of MIDI file import. Doesn't actually create the model yet.
* Add rewind to start / ffwd to end.
* Make zoom constraint default to sqrt(2) type if no constraint set
author | Chris Cannam |
---|---|
date | Thu, 09 Feb 2006 18:01:52 +0000 |
parents | 24b500216029 |
children | 8dc0ae8fccdd |
comparison
equal
deleted
inserted
replaced
9:e71385792d9d | 10:b6dc944128da |
---|---|
36 | 36 |
37 AudioGenerator::~AudioGenerator() | 37 AudioGenerator::~AudioGenerator() |
38 { | 38 { |
39 } | 39 } |
40 | 40 |
41 void | 41 bool |
42 AudioGenerator::addModel(Model *model) | 42 AudioGenerator::addModel(Model *model) |
43 { | 43 { |
44 if (m_sourceSampleRate == 0) { | 44 if (m_sourceSampleRate == 0) { |
45 | 45 |
46 m_sourceSampleRate = model->getSampleRate(); | 46 m_sourceSampleRate = model->getSampleRate(); |
50 DenseTimeValueModel *dtvm = | 50 DenseTimeValueModel *dtvm = |
51 dynamic_cast<DenseTimeValueModel *>(model); | 51 dynamic_cast<DenseTimeValueModel *>(model); |
52 | 52 |
53 if (dtvm) { | 53 if (dtvm) { |
54 m_sourceSampleRate = model->getSampleRate(); | 54 m_sourceSampleRate = model->getSampleRate(); |
55 return true; | |
55 } | 56 } |
56 } | 57 } |
57 | 58 |
58 SparseOneDimensionalModel *sodm = | 59 SparseOneDimensionalModel *sodm = |
59 dynamic_cast<SparseOneDimensionalModel *>(model); | 60 dynamic_cast<SparseOneDimensionalModel *>(model); |
60 if (!sodm) return; // nothing else to initialise | 61 if (!sodm) return false; // nothing else to initialise |
61 | 62 |
62 // QString pluginId = "dssi:/usr/lib/dssi/dssi-vst.so:FEARkILLERrev1.dll"; | 63 // QString pluginId = "dssi:/usr/lib/dssi/dssi-vst.so:FEARkILLERrev1.dll"; |
63 // QString pluginId = "dssi:/usr/lib/dssi/hexter.so:hexter"; | 64 // QString pluginId = "dssi:/usr/lib/dssi/hexter.so:hexter"; |
64 // QString pluginId = "dssi:/usr/lib/dssi/sineshaper.so:sineshaper"; | 65 // QString pluginId = "dssi:/usr/lib/dssi/sineshaper.so:sineshaper"; |
65 // QString pluginId = "dssi:/usr/local/lib/dssi/xsynth-dssi.so:Xsynth"; | 66 // QString pluginId = "dssi:/usr/local/lib/dssi/xsynth-dssi.so:Xsynth"; |
69 RealTimePluginFactory *factory = | 70 RealTimePluginFactory *factory = |
70 RealTimePluginFactory::instanceFor(pluginId); | 71 RealTimePluginFactory::instanceFor(pluginId); |
71 | 72 |
72 if (!factory) { | 73 if (!factory) { |
73 std::cerr << "Failed to get plugin factory" << std::endl; | 74 std::cerr << "Failed to get plugin factory" << std::endl; |
74 return; | 75 return false; |
75 } | 76 } |
76 | 77 |
77 RealTimePluginInstance *instance = | 78 RealTimePluginInstance *instance = |
78 factory->instantiatePlugin | 79 factory->instantiatePlugin |
79 (pluginId, 0, 0, m_sourceSampleRate, m_pluginBlockSize, m_targetChannelCount); | 80 (pluginId, 0, 0, m_sourceSampleRate, m_pluginBlockSize, m_targetChannelCount); |
91 } | 92 } |
92 instance->selectProgram("cowbell"); //!!! | 93 instance->selectProgram("cowbell"); //!!! |
93 instance->setIdealChannelCount(m_targetChannelCount); // reset! | 94 instance->setIdealChannelCount(m_targetChannelCount); // reset! |
94 } else { | 95 } else { |
95 std::cerr << "Failed to instantiate plugin" << std::endl; | 96 std::cerr << "Failed to instantiate plugin" << std::endl; |
96 } | 97 return false; |
98 } | |
99 | |
100 return true; | |
97 } | 101 } |
98 | 102 |
99 void | 103 void |
100 AudioGenerator::removeModel(Model *model) | 104 AudioGenerator::removeModel(Model *model) |
101 { | 105 { |