he virtual file is not a general concept
And it is also a concept that I will not use.
It seems to me something for hackers (you know those people who prefer to use their brain to steal vs to create).
uos_AddFromMemory(...) uses a array of float as memory stream.
Up to the user to create that input from what he want.
Fre;D
I am a bit flabbergasted by that response.
I'm sure it is all due to the language barrier but, for sure there isn't anything hackish about a library (such as libsndfile) offering functionality to implement a virtual backend that can be used to load and save data.
Libraries like libsndfile provide such feature in order to let their functionality integrated independent of the programming language being used.
That allows for better integration in the programming language, in case things can not be done using the 'normal' offered functions to accomplish the task.
In that regards it is nothing more then adding events to a form. If you don't implement the event then you do not use that functionality if you do use the event then you've added support for it. f.e. handling mouse-clicks.
FPC makes heavy use of streams, simply because it allows a simple more or less uniform way whether a user wishes to load something from a file, memory, the internet or whatever the stream retrieve it data from.
Components/classes like zipstream, structured storage and resource streams are a good example of allowing the user to store their data in whatever stream format and offer a uniform way to extract data from those streams.
uos_AddFromMemory(...) uses a array of float as memory stream.
While that is a good start, it still does not allow for the user to use what he/she likes the most about FPC: working with streams.
Besides that, in case the data is to be 'decoded' first, then the end-user is not allowed to just point to the memory location of the 'encoded' stream.
Therefor a function like uos_addFromMemory() will still not allow the end-user to use streams.
User would have to extract the data from the stream first, store it into memory and then offer it to this function (just as inefficient as the previous writeln exampe i showed).
btw: Yes, that might be an array of float (that is, in case the sound format expects to consist out of floats, otherwise it's another type).
The PM i sended Fred vS is a simple implementation of the virtual functions offered by libsndfile and uses FPC streams to load from and save to. libsndfile itself does not care where the data is actually coming from.
To Fred vS i would like to say:
UOS is your library and you are the maintainer. Either you would like to support FPC streams or not. No hard feelings either way.
The only thing i did is responding to TS question in which TS expressed his question if it was possible to load data from a Stream.
The virtual functions of libsndfile allows to do so. The only thing i do not know if UOS itself is able to make use of that (in theory it should be able to).