Look for carrier recovery (carrier frequency and phase, FLL, PLL) and clock recovery (DLL). All those digital circuits work the same way, they basically track one property of an incoming signal by looking at a the (filtered) output of a discriminator function.
As mentioned in a comment, what you describe looks like a timing recovery algorithm for digital communications.
I can recommend two sources, an article and a chapter in a book, which give a nice introduction and overview of the topic in general:
L. R. Litwin, «Matched filtering and timing recovery in digital receivers», RF Design, pp. 32–48, Sep. 2001.
If the case with two sines is clear (sine wave modulation of a sine wave carrier) then consider expanding any other shape (such as the ramp) into its Fourier components and then superimposing the result of each.
Any waveform with sharp transitions (such as a ramp) requires an infinite number of frequency components, so better to work with smoothed waveforms ...