Csound Csound-dev Csound-tekno Search About

[Cs-dev] FileOpen callback

Date2006-10-28 18:24
FromAnthony Kozar
Subject[Cs-dev] FileOpen callback
Hi all, 

One thing that I have been struggling with since Csound 5 is making files
that Csound creates have appropriate Mac files types on OS 9.  Under Csound
4, this was (partially) handled by Mac-only code mixed in with Csound.  Now,
my front end finds the output soundfile when Csound is done and sets its
type, but all other files -- sorted score, soundfiles created by opcodes,
analysis files, etc. -- do not get set and it would be impossible to do so
from my front end alone without parsing the orchestra and score and even
"performing" it in some cases.

I have considered solutions including a custom version of libsndfile and a
special "Mac-only" API for Csound, but even these will not catch every file.
So just this morning I had an idea that I think will work better and not
require any platform-specific code in Csound or libsndfile.

Istvan has nicely abstracted nearly all file opening in Csound into a single
interface: csoundFileOpen() (or csound->FileOpen for plugins).  If we added
a way to set a callback called from csoundFileOpen() whenever a file is
opened by Csound, then I think I could do everything that I need.  The
callback would have to provide the host with the full pathname, the type of
file being opened, and whether it is reading or writing the file.

I can see this callback being useful for many other purposes as well.  I
would also like to add dependency tracking to my front end and provide an
interface for easily finding and opening all files in a Csound project.
This callback interface would be great for these and I am sure other
creative purposes as well.

I think the basic code for the callback interface will be simple.  The only
"difficult" part will be to find every occurence where csoundFileOpen is
called because the caller will have to provide a little more information to
csoundFileOpen.  I can do all of the work, and depending on whether we want
to release 5.04 this week or the following week, it can either go in the
next release or this release (respectively).

Does this sound alright to everyone??

Thanks.

Anthony Kozar
anthonykozar AT sbcglobal DOT net


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-10-28 21:52
Frommatt ingalls
SubjectRe: [Cs-dev] FileOpen callback
sounds fine to me.

btw, can you get SDII files to work with csound5?

i thought they were supported by libsndfile, but it
ain't working for me.

-m

On Oct 28, 2006, at 10:24 AM, Anthony Kozar wrote:

> Hi all,
>
> One thing that I have been struggling with since Csound 5 is making  
> files
> that Csound creates have appropriate Mac files types on OS 9.   
> Under Csound
> 4, this was (partially) handled by Mac-only code mixed in with  
> Csound.  Now,
> my front end finds the output soundfile when Csound is done and  
> sets its
> type, but all other files -- sorted score, soundfiles created by  
> opcodes,
> analysis files, etc. -- do not get set and it would be impossible  
> to do so
> from my front end alone without parsing the orchestra and score and  
> even
> "performing" it in some cases.
>
> I have considered solutions including a custom version of  
> libsndfile and a
> special "Mac-only" API for Csound, but even these will not catch  
> every file.
> So just this morning I had an idea that I think will work better  
> and not
> require any platform-specific code in Csound or libsndfile.
>
> Istvan has nicely abstracted nearly all file opening in Csound into  
> a single
> interface: csoundFileOpen() (or csound->FileOpen for plugins).  If  
> we added
> a way to set a callback called from csoundFileOpen() whenever a  
> file is
> opened by Csound, then I think I could do everything that I need.  The
> callback would have to provide the host with the full pathname, the  
> type of
> file being opened, and whether it is reading or writing the file.
>
> I can see this callback being useful for many other purposes as  
> well.  I
> would also like to add dependency tracking to my front end and  
> provide an
> interface for easily finding and opening all files in a Csound  
> project.
> This callback interface would be great for these and I am sure other
> creative purposes as well.
>
> I think the basic code for the callback interface will be simple.   
> The only
> "difficult" part will be to find every occurence where  
> csoundFileOpen is
> called because the caller will have to provide a little more  
> information to
> csoundFileOpen.  I can do all of the work, and depending on whether  
> we want
> to release 5.04 this week or the following week, it can either go  
> in the
> next release or this release (respectively).
>
> Does this sound alright to everyone??
>
> Thanks.
>
> Anthony Kozar
> anthonykozar AT sbcglobal DOT net
>
>
> ---------------------------------------------------------------------- 
> ---
> Using Tomcat but need to do more? Need to support web services,  
> security?
> Get stuff done quickly with pre-integrated technology to make your  
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache  
> Geronimo
> http://sel.as-us.falkag.net/sel? 
> cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-10-29 01:59
FromAnthony Kozar
SubjectRe: [Cs-dev] SDII files
SDII does not work at all on OS 9 (which is ironic considering that the
format originated there and does not make much sense on other platforms ...)

It is implemented in a way that is _supposed_ to work correctly on OS X
(writing an actual resource fork via some commandline naming trick).  On
Linux and Windows, it is supposed to create two files, one for each fork.

So, what happens when you try to write one?

I have been giving a lot of thought recently to reimplementing the
libsndfile code for SDII using actual Resource Manager calls (which would be
Mac-only of course).

Anthony Kozar
anthonykozar AT sbcglobal DOT net


matt ingalls wrote on 10/28/06 4:52 PM:

> sounds fine to me.
> 
> btw, can you get SDII files to work with csound5?
> 
> i thought they were supported by libsndfile, but it
> ain't working for me.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net