pre-emphasis with scaling?
The most glaring problem is that buffer.samples[0] is never filtered because the for loop goes from 1 to size-1.  This is an inherent problem in the implementation of FIR filters in software where you are dealing with buffers of data rather than an infinite stream. In the more general case, where your filter has N states you would need to store N-1 states so that they can be used on the next invocation of the filter. Since your filter only has two taps and the implementation is rather more simple than a general solution would be.

// state is a member variable of the class initialized to zero.
float alpha = -0.9375f;
buffer.samples[0] += state * alpha;
for (int i = 1; i &lt; buffer.size; i++) {
    buffer.samples[i] += buffer.samples[i - 1] * alpha;
}
state = buffer.samples[buffer.size-1]; // store for the next time.


Scaling

Your filter has close to 2x gain in the passband that might be causing you problems. I suspect samples need to stay in the range of -1 to 1. Imagine samples was a stream of [...,1,-1,1,-1,...] (this happens to be a sine wave at the sampleRate/2).  Your filter output is going to be [...,-1+1*-0.98,1+-1*-0.98,...] which is approximately [...,-2,2,-2,2,...]

The strategy of scaling each consecutive buffer by the filter gain for that buffer is a nice idea but it has the unfortunate property of producing a different scaling factor every time you call it. This would likely introduce a transient between each buffer.

It is better to analyze the filter and choose a constant at design time to scale by.

In your case the would be 1/2.

// state is a member variable of the class initialized to zero.
float alpha = -0.9375f;
buffer.samples[0] += state * alpha;
buffer.samples[0] *= 0.5;
for (int i = 1; i &lt; buffer.size; i++) {
    buffer.samples[i] += buffer.samples[i - 1] * alpha;
    buffer.samples[i] *= 0.5;
}
state = buffer.samples[buffer.size-1]; // store for the next time.


Of course if you wanted the gain then disregard this part.