It seems that GDevelop does not have audio recording up to this moment, so I am attempting to do so through Code Event extension.
I looked into GDevelop’s file system , and saw that there were in the SFML folders the audio.hpp file and the sfml-audio-2.dll library file.
My question is, does it sound like the right way to go
I researched more and found that utilizing sfml-audio-2.dll through C++ Code Event can be prone to problems - from what I found on internet, having a distinctive copy of SFML dll run may well conflict with another copy of it run by the central GDevelop engine.
So, another route?
I did find this file: Audio.hpp (\GDevelop\CppPlatform\include\SFML\include\SFML\Audio.hpp), more particularly its header:
Much of the hpp(s) has been, without surprise, implemented in GDevelop, for example SoundManager.cpp and its .h file ; Sound.cpp and its .h file.
However, implementation of <SFML/Audio/SoundRecorder.hpp> , which is to be achieved here eventually in this post, is no where to be seen, yet.
I know almost nothing about C++, but I can try to write something up. If I can (with aid from e.g. codementor.io), I may implement it as spontaneous C++ code event, or I can eventually create a pull request on the present GDevelop code base.
So, you can help by throwing some light based on the <SFML/Audio/SoundBufferRecorder.hpp> and <SFML/Audio/SoundRecorder.hpp>.
Or, I am also ok to post this request with some bounty on bountysource.com. Yes, I want this feature enough.
Thank you for your time and attention.
Hey, a long time eh? I’ve noticed this post right now, and having some free time here… investigating a bit I managed to get it to work (somehow):
RecordAudioC++.gdg (18.1 KB)
The problem is the C++ static typing, it’s a blessing and a curse… everything has to be in the same C++ event, because I can’t save a SoundBufferRecording object/pointer in any place, because no GD object has this type of member, and I can’t convert the pointer to a number or string to save them in a variable (I think). Also I’m pretty sure the objects created in the event will be deleted when the C++ event finishes.
As all the code has to be in the same event, I have to do something to launch the event to stop recording some time after the event to start recording, so I have to wait inside the C++ event (a while loop), but the scene has to continue running, so I have to manually call the RenderAndStep() pipeline function
Not sure, but maybe @victor knows a trick or two
All that was a mess, I know. In summary, the condition to stop recording has to be written in C++, inside the while loop, in my example the condition is the time from scene start. But you can add a variable condition (in C++), and modify this variable in a GD event to stop recording.
The good think is that it works pretty well, it even works in preview mode