comparison transform/RealTimeEffectModelTransformer.cpp @ 1752:6d09d68165a4 by-id

Further review of ById: make IDs only available when adding a model to the ById store, not by querying the item directly. This means any id encountered in the wild must have been added to the store at some point (even if later released), which simplifies reasoning about lifecycles
author Chris Cannam
date Fri, 05 Jul 2019 15:28:07 +0100
parents fe3f7f8df3a3
children fd7f127ecd89
comparison
equal deleted inserted replaced
1751:77543124651b 1752:6d09d68165a4
91 } 91 }
92 92
93 auto model = std::make_shared<WritableWaveFileModel> 93 auto model = std::make_shared<WritableWaveFileModel>
94 (input->getSampleRate(), outputChannels); 94 (input->getSampleRate(), outputChannels);
95 95
96 ModelById::add(model); 96 m_outputs.push_back(ModelById::add(model));
97 m_outputs.push_back(model->getId());
98 97
99 } else { 98 } else {
100 99
101 auto model = std::make_shared<SparseTimeValueModel> 100 auto model = std::make_shared<SparseTimeValueModel>
102 (input->getSampleRate(), transform.getBlockSize(), 101 (input->getSampleRate(), transform.getBlockSize(),
103 0.0, 0.0, false); 102 0.0, 0.0, false);
104 if (m_units != "") model->setScaleUnits(m_units); 103 if (m_units != "") model->setScaleUnits(m_units);
105 104
106 ModelById::add(model); 105 m_outputs.push_back(ModelById::add(model));
107 m_outputs.push_back(model->getId());
108 } 106 }
109 } 107 }
110 108
111 RealTimeEffectModelTransformer::~RealTimeEffectModelTransformer() 109 RealTimeEffectModelTransformer::~RealTimeEffectModelTransformer()
112 { 110 {