Contrary to my expectations, these 2 topics were not that complicated. So I decided that one article on them would be enough. Here's how it looks and sounds like:
Sound
Essentially, the topic came down to finding a suitable audio library/API.
I've checked a few, including OpenSL, OpenAL, irrKlang, SFML, FMOD, PortAudio, SDL2, etc. Many of them, despite their own claims, are not truly cross-platform (or I couldn't get them to run), some are not even "audio APIs" but multimedia device interfaces . And most of them are huge and heavy.
I continued searching and finally came across miniaudio.h by David Reid, which well deserves to be #1 in relevant Google searches (I lost too much time checking other useless or misleading options). A single h-file 2-level API. Nice, compact and convenient. Only the samples list confused me a bit. The correct sample to start with is "Engine Hello World", NOT a "Simple Playback".
On my side it's implemented in MySound class. Extra parameters in my calls allow to regulate volume and pitch of the sound.
Most sounds are from freesound.org/
Smoke
The standard approach is "particle system". Here it's basically the same, only the particles are bigger and animated. The classes involved are:
- subjs/Smoke
- subjs/Exhaust
- rr/ExhaustLoco
Source code
As usual, on GitHub: