Skip to content

Commit

Permalink
Allow setting the open file callback from cpp library
Browse files Browse the repository at this point in the history
  • Loading branch information
nonameentername committed Apr 28, 2024
1 parent 6d44ef0 commit 78850d7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
9 changes: 5 additions & 4 deletions include/csound.h
Original file line number Diff line number Diff line change
Expand Up @@ -1174,8 +1174,8 @@ extern "C" {

PUBLIC void csoundSetOpenSoundFileCallback(CSOUND *p,
void *(*openSoundFileCallback)(CSOUND*,
const char*,
int, void*));
const char*,
int, void*));

/**
* Sets an external callback for opening a file.
Expand All @@ -1188,8 +1188,9 @@ extern "C" {
* This callback is retained after a csoundReset() call.
*/
PUBLIC void csoundSetOpenFileCallback(CSOUND *p,
FILE *(*func)(CSOUND*, const char*,
const char*));
FILE *(*openFileCallback)(CSOUND*,
const char*,
const char*));

#if !defined(SWIG)
/**
Expand Down
19 changes: 17 additions & 2 deletions include/csound.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,24 @@ class PUBLIC Csound
virtual void SetMIDIOutput(const char *name){
csoundSetMIDIOutput(csound,name);
}
virtual void SetMIDIFileOutput(const char *name){
csoundSetMIDIFileOutput(csound,name);
virtual void SetMIDIFileOutput(const char *name){
csoundSetMIDIFileOutput(csound,name);
}

virtual void SetOpenSoundFileCallback(
void *(*openSoundFileCallback_)(CSOUND*, const char *name,
int flags, void *sf_info))
{
csoundSetOpenSoundFileCallback(csound, openSoundFileCallback_);
}

virtual void SetOpenFileCallback(
FILE *(*openFileCallback_)(CSOUND*, const char*,
const char*))
{
csoundSetOpenFileCallback(csound, openFileCallback_);
}

virtual TREE *ParseOrc(const char *str)
{
return csoundParseOrc(csound, str);
Expand Down

0 comments on commit 78850d7

Please sign in to comment.