envelope_t* envelope_parse (guchar *inbuf, guint inlen, GError **err) { unsigned char *start = (unsigned char *) strstr ((const char *) inbuf, "ENVELOPE"); int lendif; if (!start) return decode_envelope (&inbuf, inbuf + inlen, err); start += 8; lendif = (int) start - (int) inbuf; return decode_envelope (&start, (unsigned char *) ( start + (inlen - lendif) ), err); }
static void mono_decode(COOKContext *q, float* mlt_buffer) { int category_index[128]; int quant_index_table[102]; int category[128]; memset(&category, 0, 128*sizeof(int)); memset(&category_index, 0, 128*sizeof(int)); decode_envelope(q, quant_index_table); q->num_vectors = get_bits(&q->gb,q->log2_numvector_size); categorize(q, quant_index_table, category, category_index); expand_category(q, category, category_index); decode_vectors(q, category, quant_index_table, mlt_buffer); }
static int mono_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer) { int category_index[128] = { 0 }; int category[128] = { 0 }; int quant_index_table[102]; int res; if ((res = decode_envelope(q, p, quant_index_table)) < 0) return res; q->num_vectors = get_bits(&q->gb, p->log2_numvector_size); categorize(q, p, quant_index_table, category, category_index); expand_category(q, category, category_index); decode_vectors(q, p, category, quant_index_table, mlt_buffer); return 0; }
static int mono_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer) { int category_index[128] = { 0 }; int category[128] = { 0 }; int quant_index_table[102]; int res, i; if ((res = decode_envelope(q, p, quant_index_table)) < 0) return res; q->num_vectors = get_bits(&q->gb,p->log2_numvector_size); categorize(q, p, quant_index_table, category, category_index); expand_category(q, category, category_index); for (i=0; i<p->total_subbands; i++) { if (category[i] > 7) return AVERROR_INVALIDDATA; } decode_vectors(q, p, category, quant_index_table, mlt_buffer); return 0; }
void GuiUpdates::decode_updates(SynthEngine *synth, CommandBlock *getData) { unsigned char control = getData->data.control; unsigned char npart = getData->data.part; unsigned char kititem = getData->data.kit; unsigned char engine = getData->data.engine; unsigned char insert = getData->data.insert; unsigned char insertParam = getData->data.parameter; unsigned char insertPar2 = getData->data.par2; // cout << "Con " << int(control) << " Kit " << int(kititem) << " Eng " << int(engine) << " Ins " << int(insert) << endl; if (control == TOPLEVEL::control::errorMessage && insert != TOPLEVEL::insert::resonanceGraphInsert) // just show a message { synth->getGuiMaster()->words->copy_label(miscMsgPop(insertPar2).c_str()); synth->getGuiMaster()->cancel->hide(); synth->getGuiMaster()->message->show(); return; } if (npart == TOPLEVEL::section::scales) { synth->getGuiMaster()->microtonalui->returns_update(getData); return; } if (npart == TOPLEVEL::section::vector) { synth->getGuiMaster()->vectorui->returns_update(getData); return; } if (npart == TOPLEVEL::section::midiLearn && synth->getGuiMaster()->midilearnui != NULL) { synth->getGuiMaster()->midilearnui->returns_update(getData); return; } if (npart == TOPLEVEL::section::midiIn) // catch this early { synth->getGuiMaster()->returns_update(getData); return; } if (npart == TOPLEVEL::section::bank) { synth->getGuiMaster()->bankui->returns_update(getData); return; } Part *part = synth->part[npart]; if (kititem >= EFFECT::type::none && kititem != UNUSED) // effects { if (npart == TOPLEVEL::section::systemEffects) { if (engine != synth->getGuiMaster()->nsyseff) return; if (insert == TOPLEVEL::insert::filterGroup) // dynefilter filter insert synth->getGuiMaster()->syseffectui->fwin_filterui->returns_update(getData); else synth->getGuiMaster()->syseffectui->returns_update(getData); } else if (npart == TOPLEVEL::section::insertEffects) { if (engine != synth->getGuiMaster()->ninseff) return; if (insert == TOPLEVEL::insert::filterGroup) // dynefilter filter insert synth->getGuiMaster()->inseffectui->fwin_filterui->returns_update(getData); else synth->getGuiMaster()->inseffectui->returns_update(getData); } else if (npart < NUM_MIDI_PARTS) { if (engine != synth->getGuiMaster()->partui->ninseff) return; if (insert == TOPLEVEL::insert::filterGroup) // dynefilter filter insert synth->getGuiMaster()->partui->inseffectui->fwin_filterui->returns_update(getData); else synth->getGuiMaster()->partui->inseffectui->returns_update(getData); } return; } if (npart == TOPLEVEL::section::config) { synth->getGuiMaster()->configui->returns_update(getData); return; } if (npart == TOPLEVEL::section::main && control == MAIN::control::exportPadSynthSamples) // special case { npart = insertParam & 0x3f; getData->data.part = npart; } if (npart >= TOPLEVEL::section::main) // main / sys / ins { synth->getGuiMaster()->returns_update(getData); return; } if (npart >= NUM_MIDI_PARTS) return; // invalid part number if (kititem >= NUM_KIT_ITEMS && kititem != UNUSED) return; // invalid kit number if (kititem == UNUSED && engine == UNUSED && insert == UNUSED && control == PART::control::defaultInstrument) // special case for part clear { synth->getGuiMaster()->returns_update(getData); return; } if (insert != UNUSED || (control != PART::control::enable && control != PART::control::instrumentName)) { if (synth->getGuiMaster()->partui->partname == "Simple Sound") synth->getGuiMaster()->partui->checkEngines("No Title"); } if (kititem == UNUSED || insert == TOPLEVEL::insert::kitGroup) // part { if (control != PART::control::kitMode && kititem != UNUSED && part->Pkitmode == 0) return; // invalid access synth->getGuiMaster()->partui->returns_update(getData); return; } if (engine == PART::engine::padSynth) // padsynth { if(synth->getGuiMaster()->partui->padnoteui) { switch (insert) { case UNUSED: synth->getGuiMaster()->partui->padnoteui->returns_update(getData); break; case TOPLEVEL::insert::LFOgroup: switch(insertParam) { case TOPLEVEL::insertType::amplitude: if (synth->getGuiMaster()->partui->padnoteui->amplfo) synth->getGuiMaster()->partui->padnoteui->amplfo->returns_update(getData); break; case TOPLEVEL::insertType::frequency: if (synth->getGuiMaster()->partui->padnoteui->freqlfo) synth->getGuiMaster()->partui->padnoteui->freqlfo->returns_update(getData); break; case TOPLEVEL::insertType::filter: if (synth->getGuiMaster()->partui->padnoteui->filterlfo) synth->getGuiMaster()->partui->padnoteui->filterlfo->returns_update(getData); break; } break; case TOPLEVEL::insert::filterGroup: if (synth->getGuiMaster()->partui->padnoteui->filterui) synth->getGuiMaster()->partui->padnoteui->filterui->returns_update(getData); break; case TOPLEVEL::insert::envelopeGroup: case TOPLEVEL::insert::envelopePoints: case TOPLEVEL::insert::envelopePointChange: switch(insertParam) { case TOPLEVEL::insertType::amplitude: if (synth->getGuiMaster()->partui->padnoteui->ampenv) synth->getGuiMaster()->partui->padnoteui->ampenv->returns_update(getData); break; case TOPLEVEL::insertType::frequency: if (synth->getGuiMaster()->partui->padnoteui->freqenv) synth->getGuiMaster()->partui->padnoteui->freqenv->returns_update(getData); break; case TOPLEVEL::insertType::filter: if (synth->getGuiMaster()->partui->padnoteui->filterenv) synth->getGuiMaster()->partui->padnoteui->filterenv->returns_update(getData); break; } break; case TOPLEVEL::insert::oscillatorGroup: case TOPLEVEL::insert::harmonicAmplitude: case TOPLEVEL::insert::harmonicPhaseBandwidth: if(synth->getGuiMaster()->partui->padnoteui->oscui) synth->getGuiMaster()->partui->padnoteui->oscui->returns_update(getData); break; case TOPLEVEL::insert::resonanceGroup: case TOPLEVEL::insert::resonanceGraphInsert: if(synth->getGuiMaster()->partui->padnoteui->resui) synth->getGuiMaster()->partui->padnoteui->resui->returns_update(getData); break; } } else if(insertPar2 != NO_MSG) { miscMsgPop(insertPar2); // clear any text out. } return; } if (engine == PART::engine::subSynth) // subsynth { if (synth->getGuiMaster()->partui->subnoteui) switch (insert) { case TOPLEVEL::insert::filterGroup: if (synth->getGuiMaster()->partui->subnoteui->filterui) synth->getGuiMaster()->partui->subnoteui->filterui->returns_update(getData); break; case TOPLEVEL::insert::envelopeGroup: case TOPLEVEL::insert::envelopePoints: case TOPLEVEL::insert::envelopePointChange: switch(insertParam) { case TOPLEVEL::insertType::amplitude: if (synth->getGuiMaster()->partui->subnoteui->ampenv) synth->getGuiMaster()->partui->subnoteui->ampenv->returns_update(getData); break; case TOPLEVEL::insertType::frequency: if (synth->getGuiMaster()->partui->subnoteui->freqenvelopegroup) synth->getGuiMaster()->partui->subnoteui->freqenvelopegroup->returns_update(getData); break; case TOPLEVEL::insertType::filter: if (synth->getGuiMaster()->partui->subnoteui->filterenv) synth->getGuiMaster()->partui->subnoteui->filterenv->returns_update(getData); break; case TOPLEVEL::insertType::bandwidth: if (synth->getGuiMaster()->partui->subnoteui->bandwidthenvelopegroup) synth->getGuiMaster()->partui->subnoteui->bandwidthenvelopegroup->returns_update(getData); break; } break; case UNUSED: case TOPLEVEL::insert::harmonicAmplitude: case TOPLEVEL::insert::harmonicPhaseBandwidth: synth->getGuiMaster()->partui->subnoteui->returns_update(getData); break; } return; } if (engine >= PART::engine::addVoice1) // addsynth voice / modulator { if (synth->getGuiMaster()->partui->adnoteui) { if (synth->getGuiMaster()->partui->adnoteui->advoice) { switch (insert) { case UNUSED: synth->getGuiMaster()->partui->adnoteui->advoice->returns_update(getData); break; case TOPLEVEL::insert::LFOgroup: switch(insertParam) { case TOPLEVEL::insertType::amplitude: if (synth->getGuiMaster()->partui->adnoteui->advoice->voiceamplfogroup) synth->getGuiMaster()->partui->adnoteui->advoice->voiceamplfogroup->returns_update(getData); break; case TOPLEVEL::insertType::frequency: if (synth->getGuiMaster()->partui->adnoteui->advoice->voicefreqlfogroup) synth->getGuiMaster()->partui->adnoteui->advoice->voicefreqlfogroup->returns_update(getData); break; case TOPLEVEL::insertType::filter: if (synth->getGuiMaster()->partui->adnoteui->advoice->voicefilterlfogroup) synth->getGuiMaster()->partui->adnoteui->advoice->voicefilterlfogroup->returns_update(getData); break; } break; case TOPLEVEL::insert::filterGroup: if (synth->getGuiMaster()->partui->adnoteui->advoice->voicefilter) synth->getGuiMaster()->partui->adnoteui->advoice->voicefilter->returns_update(getData); break; case TOPLEVEL::insert::envelopeGroup: decode_envelope(synth, getData); break; case TOPLEVEL::insert::envelopePoints: decode_envelope(synth, getData); break; case TOPLEVEL::insert::envelopePointChange: decode_envelope(synth, getData); break; case TOPLEVEL::insert::oscillatorGroup: case TOPLEVEL::insert::harmonicAmplitude: case TOPLEVEL::insert::harmonicPhaseBandwidth: if (synth->getGuiMaster()->partui->adnoteui->advoice->oscedit) synth->getGuiMaster()->partui->adnoteui->advoice->oscedit->returns_update(getData); break; } } } return; } if (engine == PART::engine::addSynth) // addsynth base { if (synth->getGuiMaster()->partui->adnoteui) switch (insert) { case UNUSED: synth->getGuiMaster()->partui->adnoteui->returns_update(getData); break; case TOPLEVEL::insert::LFOgroup: switch(insertParam) { case TOPLEVEL::insertType::amplitude: if (synth->getGuiMaster()->partui->adnoteui->amplfo) synth->getGuiMaster()->partui->adnoteui->amplfo->returns_update(getData); break; case TOPLEVEL::insertType::frequency: if (synth->getGuiMaster()->partui->adnoteui->freqlfo) synth->getGuiMaster()->partui->adnoteui->freqlfo->returns_update(getData); break; case TOPLEVEL::insertType::filter: if (synth->getGuiMaster()->partui->adnoteui->filterlfo) synth->getGuiMaster()->partui->adnoteui->filterlfo->returns_update(getData); break; } break; case TOPLEVEL::insert::filterGroup: if (synth->getGuiMaster()->partui->adnoteui->filterui) synth->getGuiMaster()->partui->adnoteui->filterui->returns_update(getData); break; case TOPLEVEL::insert::envelopeGroup: case TOPLEVEL::insert::envelopePoints: case TOPLEVEL::insert::envelopePointChange: switch(insertParam) { case TOPLEVEL::insertType::amplitude: if (synth->getGuiMaster()->partui->adnoteui->ampenv) synth->getGuiMaster()->partui->adnoteui->ampenv->returns_update(getData); break; case TOPLEVEL::insertType::frequency: if (synth->getGuiMaster()->partui->adnoteui->freqenv) synth->getGuiMaster()->partui->adnoteui->freqenv->returns_update(getData); break; case TOPLEVEL::insertType::filter: if (synth->getGuiMaster()->partui->adnoteui->filterenv) synth->getGuiMaster()->partui->adnoteui->filterenv->returns_update(getData); break; } break; case TOPLEVEL::insert::resonanceGroup: case TOPLEVEL::insert::resonanceGraphInsert: if (synth->getGuiMaster()->partui->adnoteui->resui) synth->getGuiMaster()->partui->adnoteui->resui->returns_update(getData); break; } return; } }
static struct _bodystruct * bodystruct_part_decode (unsigned char **in, unsigned char *inend, bodystruct_t *parent, gint num, GError **err) { struct _bodystruct *part, *list, *tail, *n; unsigned char *inptr; inptr = *in; while (inptr < inend && *inptr == ' ') inptr++; if (inptr == inend || *inptr != '(') { *in = inptr; return NULL; } inptr++; /* My '(' */ part = bodystruct_new (); part->part_spec = NULL; part->parent = parent; if (parent) { if (parent->part_spec && *parent->part_spec) { if (!strcasecmp (parent->content.type, "message") && !strcasecmp (parent->content.subtype, "rfc822")) { part->part_spec = g_strdup (parent->part_spec); } else { part->part_spec = g_strdup_printf ("%s.%d", parent->part_spec, num); } } else { part->part_spec = g_strdup_printf ("%d", num); } } else { part->part_spec = g_strdup (""); } if (*inptr == '(') { gint cnt = 1; part->content.type = g_strdup ("MULTIPART"); list = NULL; tail = (struct _bodystruct *) &list; while ((n = bodystruct_part_decode (&inptr, inend, part, cnt, err)) != NULL) { tail->next = n; tail = n; cnt++; while (inptr < inend && *inptr == ' ') inptr++; if (*inptr == ')') break; } part->subparts = list; if (*inptr != ')') { part->content.subtype = decode_qstring (&inptr, inend, err); debug_printf ("contensubtype: %s\n", PRINT_NULL (part->content.subtype)); } if (*inptr != ')') { part->content.params = decode_params (&inptr, inend, err); print_params (part->content.params); } /* if (*inptr != ')') { * parse_something_unknown (&inptr, inend, err); * } */ if (*inptr != ')') { parse_content_disposition (&inptr, inend, &part->disposition, err); } if (*inptr != ')') { parse_lang (&inptr, inend, part, err); } if (*inptr != ')') { end_this_piece (&inptr, inend, err); } } else { part->next = NULL; part->content.type = decode_qstring (&inptr, inend, err); if (!part->content.type) part->content.type = g_strdup ("TEXT"); debug_printf ("contentype: %s\n", PRINT_NULL (part->content.type)); part->content.subtype = decode_qstring (&inptr, inend, err); if (!part->content.subtype) part->content.subtype = g_strdup ("PLAIN"); debug_printf ("contensubtype: %s\n", PRINT_NULL (part->content.subtype)); part->disposition.type = NULL; part->disposition.params = NULL; part->encoding = NULL; part->envelope = NULL; part->subparts = NULL; if (!strcasecmp (part->content.type, "message") && !strcasecmp (part->content.subtype, "rfc822")) { if (*inptr != ')') { part->content.params = decode_params (&inptr, inend, err); print_params (part->content.params); } if (*inptr != ')') { part->content.cid = decode_qstring (&inptr, inend, err); debug_printf ("content.cid: %s\n", PRINT_NULL (part->content.cid)); } if (*inptr != ')') { part->description = decode_qstring (&inptr, inend, err); debug_printf ("description: %s\n", PRINT_NULL (part->description)); } if (*inptr != ')') { part->encoding = decode_qstring (&inptr, inend, err); if (!part->encoding) part->encoding = g_strdup ("7BIT"); debug_printf ("encoding: %s\n", PRINT_NULL (part->encoding)); } if (*inptr != ')') { part->octets = decode_num (&inptr, inend, err); debug_printf ("octets: %d\n", part->octets); } if (*inptr != ')') { part->envelope = decode_envelope (&inptr, inend, err); } if (*inptr != ')') { part->subparts = bodystruct_part_decode (&inptr, inend, part, 1, err); } if (*inptr != ')') { part->lines = decode_num (&inptr, inend, err); debug_printf ("lines: %d\n", part->lines); } if (*inptr != ')') { read_unknown_qstring (&inptr, inend, err); } if (*inptr != ')') { parse_content_disposition (&inptr, inend, &part->disposition, err); } if (*inptr != ')') { parse_lang (&inptr, inend, part, err); } if (*inptr != ')') { end_this_piece (&inptr, inend, err); } } else if (!strcasecmp (part->content.type, "text")) { if (*inptr != ')') { part->content.params = decode_params (&inptr, inend, err); print_params (part->content.params); } if (*inptr != ')') { part->content.cid = decode_qstring (&inptr, inend, err); debug_printf ("content.cid: %s\n", PRINT_NULL (part->content.cid)); } if (*inptr != ')') { part->description = decode_qstring (&inptr, inend, err); debug_printf ("description: %s\n", PRINT_NULL (part->description)); } if (*inptr != ')') { part->encoding = decode_qstring (&inptr, inend, err); debug_printf ("encoding: %s\n", PRINT_NULL (part->encoding)); } if (*inptr != ')') { part->octets = decode_num (&inptr, inend, err); debug_printf ("octets: %d\n", part->octets); } if (*inptr != ')') { part->lines = decode_num (&inptr, inend, err); debug_printf ("lines: %d\n", part->lines); } if (*inptr != ')') { read_unknown_qstring (&inptr, inend, err); } if (*inptr != ')') { parse_content_disposition (&inptr, inend, &part->disposition, err); } if (*inptr != ')') { parse_lang (&inptr, inend, part, err); } if (*inptr != ')') { end_this_piece (&inptr, inend, err); } } else if (!strcasecmp (part->content.type, "APPLICATION")|| !strcasecmp (part->content.type, "IMAGE") || !strcasecmp (part->content.type, "VIDEO") || !strcasecmp (part->content.type, "AUDIO")) { if (*inptr != ')') { part->content.params = decode_params (&inptr, inend, err); print_params (part->content.params); } if (*inptr != ')') { part->content.cid = decode_qstring (&inptr, inend, err); debug_printf ("content.cid: %s\n", PRINT_NULL (part->content.cid)); } if (*inptr != ')') { part->description = decode_qstring (&inptr, inend, err); debug_printf ("description: %s\n", PRINT_NULL (part->description)); } if (*inptr != ')') { part->encoding = decode_qstring (&inptr, inend, err); debug_printf ("encoding: %s\n", PRINT_NULL (part->encoding)); } if (*inptr != ')') { part->octets = decode_num (&inptr, inend, err); debug_printf ("octets: %d\n", part->octets); } if (*inptr != ')') { read_unknown_qstring (&inptr, inend, err); } if (*inptr != ')') { parse_content_disposition (&inptr, inend, &part->disposition, err); } if (*inptr != ')') { parse_lang (&inptr, inend, part, err); } if (*inptr != ')') { end_this_piece (&inptr, inend, err); } } else { /* I don't know how it looks, so I just read it away */ end_this_piece (&inptr, inend, err); } } if (*inptr != ')') { *in = inptr; set_error (err, in); bodystruct_free (part); return NULL; } inptr++; /* My ')' */ *in = inptr; return part; }
static int ff_effect_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) { tprints(", "); struct_ff_effect ffe; if (umove_or_printaddr(tcp, arg, &ffe)) return 1; tprints("{type="); printxval(evdev_ff_types, ffe.type, "FF_???"); tprintf(", id=%" PRIu16 ", direction=%" PRIu16 ", ", ffe.id, ffe.direction); if (abbrev(tcp)) { tprints("...}"); return 1; } tprintf("trigger={button=%" PRIu16 ", interval=%" PRIu16 "}" ", replay={length=%" PRIu16 ", delay=%" PRIu16 "}", ffe.trigger.button, ffe.trigger.interval, ffe.replay.length, ffe.replay.delay); switch (ffe.type) { case FF_CONSTANT: tprintf(", constant={level=%" PRId16, ffe.u.constant.level); decode_envelope(&ffe.u.constant.envelope); tprints("}"); break; case FF_RAMP: tprintf(", ramp={start_level=%" PRId16 ", end_level=%" PRId16, ffe.u.ramp.start_level, ffe.u.ramp.end_level); decode_envelope(&ffe.u.ramp.envelope); tprints("}"); break; case FF_PERIODIC: tprintf(", periodic={waveform=%" PRIu16 ", period=%" PRIu16 ", magnitude=%" PRId16 ", offset=%" PRId16 ", phase=%" PRIu16, ffe.u.periodic.waveform, ffe.u.periodic.period, ffe.u.periodic.magnitude, ffe.u.periodic.offset, ffe.u.periodic.phase); decode_envelope(&ffe.u.periodic.envelope); tprintf(", custom_len=%u, custom_data=", ffe.u.periodic.custom_len); printaddr(ptr_to_kulong(ffe.u.periodic.custom_data)); tprints("}"); break; case FF_RUMBLE: tprintf(", rumble={strong_magnitude=%" PRIu16 ", weak_magnitude=%" PRIu16 "}", ffe.u.rumble.strong_magnitude, ffe.u.rumble.weak_magnitude); break; default: break; } tprints("}"); return 1; }