~ubuntu-branches/ubuntu/precise/lmms/precise-updates

« back to all changes in this revision

Viewing changes to plugins/ladspa_effect/calf/src/giface.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Артём Попов
  • Date: 2011-02-14 20:58:36 UTC
  • mfrom: (1.1.10 upstream) (3.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110214205836-2u41xus1d2mj8nfz
Tags: 0.4.10-1ubuntu1
* Merge from debian unstable (LP: #718801).  Remaining changes:
  - Replace build-dep on libwine-dev with wine1.2-dev to build
    against the newer Wine.

Show diffs side-by-side

added added

removed removed

Lines of Context:
150
150
    }
151
151
    switch(flags & PF_TYPEMASK)
152
152
    {
153
 
    case PF_STRING:
154
 
        return "N/A";
155
153
    case PF_INT:
156
154
    case PF_BOOL:
157
155
    case PF_ENUM:
190
188
 
191
189
void calf_plugins::plugin_ctl_iface::clear_preset() {
192
190
    int param_count = get_metadata_iface()->get_param_count();
193
 
    for (int i=0; i < param_count; i++)
 
191
    for (int i = 0; i < param_count; i++)
194
192
    {
195
193
        const parameter_properties &pp = *get_metadata_iface()->get_param_props(i);
196
 
        if ((pp.flags & PF_TYPEMASK) == PF_STRING)
197
 
        {
198
 
            configure(pp.short_name, pp.choices ? pp.choices[0] : "");
199
 
        }
200
 
        else
201
 
            set_param_value(i, pp.def_value);
 
194
        set_param_value(i, pp.def_value);
 
195
    }
 
196
    const char *const *vars = get_metadata_iface()->get_configure_vars();
 
197
    if (vars)
 
198
    {
 
199
        for (int i = 0; vars[i]; i++)
 
200
            configure(vars[i], NULL);
202
201
    }
203
202
}
204
203
 
215
214
    }
216
215
}
217
216
 
218
 
bool calf_plugins::check_for_message_context_ports(const parameter_properties *parameters, int count)
219
 
{
220
 
    for (int i = count - 1; i >= 0; i--)
221
 
    {
222
 
        if (parameters[i].flags & PF_PROP_MSGCONTEXT)
223
 
            return true;
224
 
    }
225
 
    return false;
226
 
}
227
 
 
228
 
bool calf_plugins::check_for_string_ports(const parameter_properties *parameters, int count)
229
 
{
230
 
    for (int i = count - 1; i >= 0; i--)
231
 
    {
232
 
        if ((parameters[i].flags & PF_TYPEMASK) == PF_STRING)
233
 
            return true;
234
 
        if ((parameters[i].flags & PF_TYPEMASK) < PF_STRING)
235
 
            return false;
236
 
    }
237
 
    return false;
238
 
}
239
 
 
240
 
bool calf_plugins::get_freq_gridline(int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context, bool use_frequencies)
 
217
bool calf_plugins::get_freq_gridline(int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context, bool use_frequencies, float res, float ofs)
241
218
{
242
219
    if (subindex < 0 )
243
220
        return false;
270
247
    if (subindex >= 32)
271
248
        return false;
272
249
    float gain = 16.0 / (1 << subindex);
273
 
    pos = dB_grid(gain);
 
250
    pos = dB_grid(gain, res, ofs);
274
251
    if (pos < -1)
275
252
        return false;
276
253
    if (subindex != 4)
342
319
    }
343
320
    return NULL;
344
321
}
345
 
///////////////////////////////////////////////////////////////////////////////////////
346
 
 
347
 
std::string table_edit_iface::get_cell(int param, int row, int column) const
348
 
{
349
 
    return calf_utils::i2s(row)+":"+calf_utils::i2s(column);
 
322
 
 
323
///////////////////////////////////////////////////////////////////////////////////////
 
324
 
 
325
bool calf_plugins::parse_table_key(const char *key, const char *prefix, bool &is_rows, int &row, int &column)
 
326
{
 
327
    is_rows = false;
 
328
    row = -1;
 
329
    column = -1;
 
330
    if (0 != strncmp(key, prefix, strlen(prefix)))
 
331
        return false;
 
332
    
 
333
    key += strlen(prefix);
 
334
    
 
335
    if (!strcmp(key, "rows"))
 
336
    {
 
337
        is_rows = true;
 
338
        return true;
 
339
    }
 
340
    
 
341
    const char *comma = strchr(key, ',');
 
342
    if (comma)
 
343
    {
 
344
        row = atoi(string(key, comma - key).c_str());
 
345
        column = atoi(comma + 1);
 
346
        return true;
 
347
    }
 
348
    
 
349
    printf("Unknown key %s under prefix %s", key, prefix);
 
350
    
 
351
    return false;
 
352
}
 
353
 
 
354
///////////////////////////////////////////////////////////////////////////////////////
 
355
 
 
356
const char *mod_mapping_names[] = { "0..1", "-1..1", "-1..0", "x^2", "2x^2-1", "ASqr", "ASqrBip", "Para", NULL };
 
357
 
 
358
mod_matrix_metadata::mod_matrix_metadata(unsigned int _rows, const char **_src_names, const char **_dest_names)
 
359
: mod_src_names(_src_names)
 
360
, mod_dest_names(_dest_names)
 
361
, matrix_rows(_rows)
 
362
{
 
363
    table_column_info tci[6] = {
 
364
        { "Source", TCT_ENUM, 0, 0, 0, mod_src_names },
 
365
        { "Mapping", TCT_ENUM, 0, 0, 0, mod_mapping_names },
 
366
        { "Modulator", TCT_ENUM, 0, 0, 0, mod_src_names },
 
367
        { "Amount", TCT_FLOAT, 0, 1, 1, NULL},
 
368
        { "Destination", TCT_ENUM, 0, 0, 0, mod_dest_names  },
 
369
        { NULL }
 
370
    };
 
371
    assert(sizeof(table_columns) == sizeof(tci));
 
372
    memcpy(table_columns, tci, sizeof(table_columns));
 
373
}
 
374
 
 
375
const table_column_info *mod_matrix_metadata::get_table_columns() const
 
376
{
 
377
    return table_columns;
 
378
}
 
379
 
 
380
uint32_t mod_matrix_metadata::get_table_rows() const
 
381
{
 
382
    return matrix_rows;
350
383
}
351
384
 
352
385
///////////////////////////////////////////////////////////////////////////////////////
453
486
        delete client;
454
487
}
455
488
 
 
489
table_via_configure::table_via_configure()
 
490
{
 
491
    rows = 0;
 
492
}
 
493
 
 
494
table_via_configure::~table_via_configure()
 
495
{
 
496
}
 
497
 
456
498
#endif