Help reading obscure (to me) piece of code

I'm trying to debug a C++ program that I use (but didn't write). I can read plain C reasonably well but the C++ syntax below has me stumped:

 
pbuf [ j ].min *= gain;


i is an int, gain is a float and min is part of std::min. The part I'm not familiar with is the array subscript operator immediately followed by the '.' operator, ie. '[ j ].min'. If someone could explain what that means I'd appreciate it.

If more context is required, the full file is here:
https://github.com/original-male/non/blob/master/timeline/src/Waveform.C
The above code appears at line 50.
pbuf is a pointer to an array of objects of type Peak.
min and max here are member variables of the Peak class/struct. Most likely they are of type float.

Those two float variables have their existing value multiplied by the scale factor gain.

The for-loop at line 48 to 52 does that same scaling for all the objects in the array.

In the context of a WAV file, it seems the array contains a series of min and max peak values (indicating the top and bottom of the waveform).

In that particular part of the code it does not seem that std::min has any relevance. To get the context of min and max, you'd need to view the header which contains the definition of Peak.
https://github.com/original-male/non/blob/master/timeline/src/Engine/Peak.H
The definition of pbuf (class Peak) is in Engine/Peak.h. The pbuf[ j ].min is syntax pointing to the "jth" offset of the array of Peak objects. In particular:

1
2
3
4

pbuf[ j ].min *= gain;



is multiplying the min variable of the "jth" object by gain and assigning the result back to min.

Does that help?
Thanks for the replies. They answer my question perfectly. (Now feeling a little stupid as I should have realised 'min' had nothing to do with std::min).
Topic archived. No new replies allowed.