Skip to content

Commit 42c83ac

Browse files
committed
Improved code style
1 parent f956b8c commit 42c83ac

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

src/main/plug/plugin_template.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ namespace lsp
9898

9999
for (size_t i=0; i < nChannels; ++i)
100100
{
101-
channel_t *c = &vChannels[i];
101+
channel_t * const c = &vChannels[i];
102102

103103
// Construct in-place DSP processors
104104
c->sLine.construct();
@@ -136,11 +136,11 @@ namespace lsp
136136
// Bind ports for audio processing channels
137137
for (size_t i=0; i<nChannels; ++i)
138138
{
139-
channel_t *c = &vChannels[i];
139+
channel_t * const c = &vChannels[i];
140140

141141
if (i > 0)
142142
{
143-
channel_t *pc = &vChannels[0];
143+
channel_t * const pc = &vChannels[0];
144144

145145
// Share some controls across all channels
146146
c->pDelay = pc->pDelay;
@@ -163,11 +163,11 @@ namespace lsp
163163
// Bind output meters
164164
for (size_t i=0; i<nChannels; ++i)
165165
{
166-
channel_t *c = &vChannels[i];
166+
channel_t * const c = &vChannels[i];
167167

168168
if (i > 0)
169169
{
170-
channel_t *pc = &vChannels[0];
170+
channel_t * const pc = &vChannels[0];
171171
// Share some meters across all channels
172172
c->pOutDelay = pc->pOutDelay;
173173
}
@@ -192,7 +192,7 @@ namespace lsp
192192
{
193193
for (size_t i=0; i<nChannels; ++i)
194194
{
195-
channel_t *c = &vChannels[i];
195+
channel_t * const c = &vChannels[i];
196196
c->sBypass.destroy();
197197
c->sLine.destroy();
198198
}
@@ -214,20 +214,20 @@ namespace lsp
214214
// Update sample rate for the bypass processors
215215
for (size_t i=0; i<nChannels; ++i)
216216
{
217-
channel_t *c = &vChannels[i];
217+
channel_t * const c = &vChannels[i];
218218
c->sLine.init(dspu::millis_to_samples(sr, meta::plugin_template::DELAY_OUT_MAX_TIME));
219219
c->sBypass.init(sr);
220220
}
221221
}
222222

223223
void plugin_template::update_settings()
224224
{
225-
float out_gain = pGainOut->value();
226-
bool bypass = pBypass->value() >= 0.5f;
225+
const float out_gain = pGainOut->value();
226+
const bool bypass = pBypass->value() >= 0.5f;
227227

228228
for (size_t i=0; i<nChannels; ++i)
229229
{
230-
channel_t *c = &vChannels[i];
230+
channel_t * const c = &vChannels[i];
231231

232232
// Store the parameters for each processor
233233
c->fDryGain = c->pDry->value() * out_gain;
@@ -305,7 +305,7 @@ namespace lsp
305305
c->pOutLevel->set_value(out_gain);
306306

307307
// Output the delay value in milliseconds
308-
float millis = dspu::samples_to_millis(fSampleRate, c->nDelay);
308+
const float millis = dspu::samples_to_millis(fSampleRate, c->nDelay);
309309
c->pOutDelay->set_value(millis);
310310
}
311311
}
@@ -319,7 +319,7 @@ namespace lsp
319319
v->begin_array("vChannels", vChannels, nChannels);
320320
for (size_t i=0; i<nChannels; ++i)
321321
{
322-
channel_t *c = &vChannels[i];
322+
channel_t * const c = &vChannels[i];
323323

324324
v->begin_object(c, sizeof(channel_t));
325325
{
@@ -348,6 +348,7 @@ namespace lsp
348348

349349
v->write("pBypass", pBypass);
350350
v->write("pGainOut", pGainOut);
351+
v->write("pComment", pComment);
351352

352353
v->write("pData", pData);
353354
}

0 commit comments

Comments
 (0)