Пример #1
0
 const FTPoint& Render(const FTPoint& pen, int renderMode)
 {
     FTGL_DOUBLE advancex, advancey;
     renderCallback(baseGlyph, data, pen.X(), pen.Y(), renderMode,
                    &advancex, &advancey);
     advance = FTPoint(advancex, advancey);
     return advance;
 }
	void Win32DirectSoundAudioDriver::renderSamples(short *buffer, int numSamples)
	{
		if (renderCallback && enabled)
		{
			int numFloatSamples = numSamples / 2;
			renderCallback(leftBuffer, rightBuffer, numFloatSamples, userData);
			for (int i = 0; i < numSamples; i++)
			{
				int sample = (int)((i & 1 ? rightBuffer : leftBuffer)[i / 2] * 32767.0f);
				if (sample < -32768) sample = -32768;
				if (sample > 32767) sample = 32767;
				buffer[i] = (short)sample;
			}
		}
		else
		{
			memset(buffer, 0, sizeof(short) * numSamples);
		}
	}