Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add open file callback #1754

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

nonameentername
Copy link

Add callback for open file and open file descriptor to allow extending csound api when opening files.

These changes could allow csound to open files that are not located in file system and instead add user defined code to open files from memory, zip files, etc.

@nonameentername
Copy link
Author

This is work in progress. I am looking into libsndfile open virtual and how to allow using that to open sound files.

http://www.mega-nerd.com/libsndfile/api.html#open_virtual

Maybe allow a user to set their own implementation of SF_VIRTUAL_IO and use that to open sound files.

@vlazzarini
Copy link
Member

Note that we don't use libsndfile directly (so Csound can be built without it). If you need to access libsndfile, you should do it via the interface in InOut/soundfile.c

@kunstmusik
Copy link
Member

@vlazzarini , @rorywalsh , @stekyne : Could you all take a look at this? This relates to godot-csound. @nonameentername mentioned on Discord:

An example on how to use the callback can be found here:
https://github.com/nonameentername/godot-csound/blob/main/src/csound_godot.cpp#L37
https://github.com/nonameentername/godot-csound/blob/main/src/csound_godot.cpp#L562

Also there seems to be build failures in Github Actions related to iOS and macOS+VCPKG.

@vlazzarini
Copy link
Member

Not exactly sure what godot-csound is, and I am not following discussions on Discord.

I did a first pass on this and I didn't spot any major issue but I have a few points to make:

  • this works crosses with various changes that are still in PRs and have not been merged. I'd like to see these outstanding PRs dealt with and merged and then do another review on how these changes fit.

  • I see the callback setting in the host API, but not in the module API. I suppose that's correct but need to check that modules won't need or want to do this.

  • I also see changes in mp3in.c, and I suppose they are ok as this is being moved to use the standard C library, but also note that this code is likely to be moved out to the plugins repo. I guess this is neither here not there, but it all needs to work as a plugin. It's already a plugin in develop.

  • The final point is that this should all compile without libsndfile. I don't see why it wouldn't but it needs to be checked.

Add callback for open file and open sound file to
allow extending csound api when opening files.

These changes could allow csound to open files that are
not located in file system and instead add user defined
code to open files from memory, zip files, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants