MCPcopy Create free account
hub / github.com/Yaafe/Yaafe / processBlock

Method processBlock

src_cpp/yaafe-components/audio/NormalizeMaxAll.cpp:47–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47void NormalizeMaxAll::processBlock(InputBuffer* in, OutputBuffer* out, int nbFrames)
48{
49 if (nbFrames<=0)
50 return;
51 assert(in->hasTokens(nbFrames));
52 assert(in->info().size==out->info().size);
53 const int size = in->info().size;
54 double maxvalue = *(in->readToken());
55 for (int i=0;i<nbFrames;i++) {
56 Map<ArrayXd> inData(in->token(i),size);
57 double m = inData.maxCoeff();
58 if (m>maxvalue)
59 maxvalue = m;
60 }
61 for (int i=0;i<nbFrames;i++) {
62 Map<ArrayXd> inData(in->readToken(),size);
63 Map<ArrayXd> outData(out->writeToken(),size);
64 outData = inData / maxvalue;
65 in->consumeToken();
66 }
67}
68
69bool NormalizeMaxAll::process(Ports<InputBuffer*>& inp, Ports<OutputBuffer*>& outp)
70{

Callers

nothing calls this directly

Calls 5

hasTokensMethod · 0.80
readTokenMethod · 0.80
tokenMethod · 0.80
writeTokenMethod · 0.80
consumeTokenMethod · 0.80

Tested by

no test coverage detected