[OT] - Possible Fantasy Computer Made With SDL2 - Some Questions


We might be making a new Fantasy Computer made with just SDL2 targeting both Windows and Linux.

We have some initial questions:
(1) What would be the best method to build an executable on both Windows and Linux?
(was looking at GCC, but could not get a simple Hello World app to build using GCC from command prompt)
(2) Graphics and input should be easy enough, but audio(sound effects and music) seem to be complicated.
(are there any good audio tutorials for plain SDL2 without using SDL2_Mixer)

Let us know, thanks!


Below are two examples of Fantasy Computers:

  1. I find it easier to use CMake for everything

  2. Curious for that too, you want to be able generate your own sounds like, tying together nodes, what’s the intended way to work? Icculus has SDL_Sound which can play some tracker formats in case you are going for tracker instead.


Thanks for the reply.

So CMake can build an SDL2 game executable on both Windows and Linux?

(1)We would have an IDE editor with C++ source code.
We would have a button to build game from IDE for either Windows or Linux.

(2) IDE would support sound effects and music creation, just wondering how to play the audio using SDL2 only.



Just on 1, I misunderstood your question. I don’t have any ideas then. So the idea is that your console “scripting” language will be C++? That’s very interesting, not sure then how to go about that.

You’ve asked the same question before, for example in December 2018 here and here. You said you got it working, so can’t you adapt the code you used then?

This is much more complicated:
Need 4 channel sound effects with 1 channel dedicated to music.

Also need to figure out how to translate sound effect and music editors into playing audio using plain SDL2

Mixing five sounds together is no more complicated than two, you simply need to repeat the operation (normally start with the music, then add each of the sound effects). You may need to be careful about the levels, because of course the more sources you mix the more you risk an overload and clipping.

Although in my games I am only ever adding ‘one’ sound effect at a time to the background music, those sound effects can easily overlap so I may in effect be mixing multiple sources.

Try for example this, which is fully SDL2.

Is there a small code example that shows mixing sound effects with music playing only using SDL2?

It’s in the replies to the question you asked in 2018, and which you said you had got working. I don’t understand why you are not simply using the same code again. :confused:

Sorry for the confusion…

That code played one WAV file sound effect on a single channel.
I do not know how to mix sound effects while playing music.

The IDE will eventually have an effects and music composer.
How would I feed effects and music composer data into SDL2 to play those effects and music?

No, the code which you said you had working mixes two sources: for example music and a sound effect. As I said previously, mixing more sources is only a case of applying this same code more than once. There is nothing new here, you have done it before. :roll_eyes:

Ok, finally understand - thanks for not screaming at me