Drawing on the oscilloscope is in XY mode, in which the voltage determines the coordinates of points on the screen. It is enough to vary them as a function of time to draw lines. At the same time, the rate of change should be left approximately the same, otherwise lines with different brightness will be obtained. According to the excellent leadership from Jed Margolin , special accuracy in determining the length of the line is not necessary. To draw a segment that is not related to the previous one, the beam must be quickly shifted, leaving no visible line.
First, in Processing, Pekka created a simple simulation of the XY mode of the oscilloscope. Youscope perfectly rendered after adding features of the phosphor.
')
For output, the computer’s audio output was used - a typical solution that was taken for the same Youscope.
Quake is a game of 1996, which is played very quickly on modern hardware. And the generation of signals is also best done fast. First, the choice fell on the ASIO SDK, but after a couple of evenings of attempts, Väänänen decided to use PortAudio , which was perfect for the task. However, the library without “dancing with a tambourine” was not compiled.
All of the available sound cards used a low pass filter, so bandwidth was limited. This means that it turns out to draw fewer lines than in Youscope, the creator of which had a sound card with the necessary characteristics. The increase in the frequency to the maximum available 96 kHz did not help too.
The generation process is divided into two parts: the Darkplaces game engine and the audio signal synthesizer, which “communicate” with each other through WinAPI called pipe.
The Darkplaces modification of the original Quake engine provides geometry details, in particular, the edges of the triangles were transmitted. Not all were taken, out of the total, only the visible and non-duplicates were filtered out.
The audio stream has a queue of lines for drawing, which are requested from the game engine. Then, at its own pace, the process works on the display of these lines, producing a 32-bit data stream at a frequency of 96 kHz.
On average, 1800 lines are transmitted per frame. If there is no new data, the previous frame will be drawn. For each line at the demonstration meets 5-20 samples. Image quality increases with slower rendering.
Generating an audio signal takes up the processor power, but most of it is spent on rasterizing the depth buffer of the game engine. Due to the selection of signal parameters, the final performance and the time lag allow you to comfortably play using the keyboard and mouse, and not just play the demo.
As Väänänen writes, performance still remained at an unsatisfactory level. The maximum is obtained at the same time draw less than 1000 lines. A larger amount requires more high frequency sound than the current audio output can provide.
Accelerating the drawing reduces the quality of the picture, and if you leave more time on each of the lines, the response will suffer.
Also, low-frequency noise appears, especially noticeable with fast movements when the entire screen is updated. This may be due to an increase in the bass level of the equalizer in the audio card, but the author of the project is not sure of his guess.