All pastes #491858 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-05-16 21:48 UTC
rendered paste body
for (int i = size * mp->mChannels; i > 0; --i) {
						volatile double in = *input++;
						volatile double out;
						
						if (in <= -1.0) {
							out = -32768.0;
							qDebug("FromatConvertet toInt: double -> S16: input overflow %f", in);
						}
						else if (in >= 1.0) {
							out = 32767.0;
							qDebug("FromatConvertet toInt: double -> S16: input overflow %f", in);
						}
						else
							out = in * 32767.0;
						
						if (out > 32767.0 || out < -32768.0)
							qDebug("FromatConvertet toInt: double -> S16, overflow: %f -> %f, %u", in, out, mp->mDepth);
						
						*buffer++ = qToLittleEndian((qint16)floor(out));
					}