Csound Csound-dev Csound-tekno Search About

[Cs-dev] how to start using the cSound API

Date2008-01-23 09:37
FromCarsten Høyer
Subject[Cs-dev] how to start using the cSound API
Hi
Yesterday i tried to begin using the cSound API. I have been looking at 
2 documents:
Rory Walsh: Introduction to the csound host API Link 

Csound API reference manual Link 

The reference manual says i need to include csound.h and link to 
libcsound.a, on windows (where i am right now), it should be csound.h 
and csound.lib or csound.dll. I only have the header files not the 
library files - i have downloaded csound compiled and the source files. 
So here is my question:

To get the library files, do i need to compile csound from source? or is 
it that the library files are really named something different these days?

Thank you
Carsten

Sub question: are there any other documents on the API out there, than 
the ones i have linked to?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 09:44
FromRory Walsh
SubjectRe: [Cs-dev] how to start using the cSound API
> To get the library files, do i need to compile csound from source? or is 
> it that the library files are really named something different these days?

No is the quick answer. Did you run pexports on csound32.dll.5.1? The 
instructions are on the first page of my tutorial. What platform are you 
using?

> Thank you
> Carsten
> 
> Sub question: are there any other documents on the API out there, than 
> the ones i have linked to?
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 10:17
FromCarsten Høyer
SubjectRe: [Cs-dev] how to start using the cSound API
I´m sure i searched for csound32.dll* yesterday without luck. Guess i 
didnt because it´s there today :) - I will walk through the 
"Introduction to the csound host API" now. thanks

Carsten

Rory Walsh skrev:
>> To get the library files, do i need to compile csound from source? or is 
>> it that the library files are really named something different these days?
>>     
>
> No is the quick answer. Did you run pexports on csound32.dll.5.1? The 
> instructions are on the first page of my tutorial. What platform are you 
> using?
>
>   

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 10:22
FromRory Walsh
SubjectRe: [Cs-dev] how to start using the cSound API
If you run into any problem let us know. There is another article about 
using the Csound API and wxWidgets in the Csound journal but it assumes 
that you have looked over the one your using first. Once you have things 
up and running I suggest you start using the C++ API interface. It 
provides much easier ways of doing everything and there is also a 
performance thread class. I'd still recommend doing that tutorial in C 
first as it will give you a good idea of what's going on.

Rory.


Carsten Høyer wrote:
> I´m sure i searched for csound32.dll* yesterday without luck. Guess i 
> didnt because it´s there today :) - I will walk through the 
> "Introduction to the csound host API" now. thanks
> 
> Carsten
> 
> Rory Walsh skrev:
>>> To get the library files, do i need to compile csound from source? or is 
>>> it that the library files are really named something different these days?
>>>     
>> No is the quick answer. Did you run pexports on csound32.dll.5.1? The 
>> instructions are on the first page of my tutorial. What platform are you 
>> using?
>>
>>   
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 10:35
FromCarsten Høyer
SubjectRe: [Cs-dev] how to start using the cSound API
Great. It is exactly wxWidgets i´m using for gui :) - Do you have a link?

Carsten

Rory Walsh skrev:
> If you run into any problem let us know. There is another article about 
> using the Csound API and wxWidgets in the Csound journal but it assumes 
> that you have looked over the one your using first. Once you have things 
> up and running I suggest you start using the C++ API interface. It 
> provides much easier ways of doing everything and there is also a 
> performance thread class. I'd still recommend doing that tutorial in C 
> first as it will give you a good idea of what's going on.
>
> Rory.
>
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 10:55
FromRory Walsh
SubjectRe: [Cs-dev] how to start using the cSound API
Just go to the csound journal page from csounds.com and you should be 
able to find it. The wxWidgets stuff is pretty basic, are you an 
experienced wxWidgets programmer?

Carsten Høyer wrote:
> Great. It is exactly wxWidgets i´m using for gui :) - Do you have a link?
> 
> Carsten
> 
> Rory Walsh skrev:
>> If you run into any problem let us know. There is another article about 
>> using the Csound API and wxWidgets in the Csound journal but it assumes 
>> that you have looked over the one your using first. Once you have things 
>> up and running I suggest you start using the C++ API interface. It 
>> provides much easier ways of doing everything and there is also a 
>> performance thread class. I'd still recommend doing that tutorial in C 
>> first as it will give you a good idea of what's going on.
>>
>> Rory.
>>
>>   
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 11:57
FromCarsten Høyer
SubjectRe: [Cs-dev] how to start using the cSound API
OK, im a little further now. I first tried compiling from Visual Studio 
express, but it gave me some benign redefinition problems with intptr_t 
and uintptr_t. I found a thread concerning this subject on nabble, and 
decided not to waste more energy on VC++.
I have now compiled the test program csoundAPItest.exe, however, when i 
try to run the program i´m getting this:

6 [main] csoundAPItest 632 _cygtls::handle_exceptions: Exception: STATUS_A
CCESS_VIOLATION
4440 [main] csoundAPItest 632 open_stackdumpfile: Dumping stack trace to 
csou
ndAPItest.exe.stackdump
309095 [main] csoundAPItest 632 _cygtls::handle_exceptions: Exception: 
STATUS_A
CCESS_VIOLATION
342494 [main] csoundAPItest 632 _cygtls::handle_exceptions: Error while 
dumping
state (probably corrupted stack)

What does that mean?
Carsten

Rory Walsh skrev:
> Just go to the csound journal page from csounds.com and you should be 
> able to find it. The wxWidgets stuff is pretty basic, are you an 
> experienced wxWidgets programmer?
>   
"Beyond the basics" i would say.

PS: The command:
dlltool --dllname=csound32.dll.5.1 --input-def=csound32.def –outputlib=
libcsound32.a

misses a "-" in --outputlib (minor detail)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 12:03
FromRory Walsh
SubjectRe: [Cs-dev] how to start using the cSound API
Hmm,  did you pass arguments to csoundAPItest.exe? If not that could be 
the problem as the program assumes that there is some input, I guess I 
should change that so it checks argc.

Rory.



Carsten Høyer wrote:
> OK, im a little further now. I first tried compiling from Visual Studio 
> express, but it gave me some benign redefinition problems with intptr_t 
> and uintptr_t. I found a thread concerning this subject on nabble, and 
> decided not to waste more energy on VC++.
> I have now compiled the test program csoundAPItest.exe, however, when i 
> try to run the program i´m getting this:
> 
> 6 [main] csoundAPItest 632 _cygtls::handle_exceptions: Exception: STATUS_A
> CCESS_VIOLATION
> 4440 [main] csoundAPItest 632 open_stackdumpfile: Dumping stack trace to 
> csou
> ndAPItest.exe.stackdump
> 309095 [main] csoundAPItest 632 _cygtls::handle_exceptions: Exception: 
> STATUS_A
> CCESS_VIOLATION
> 342494 [main] csoundAPItest 632 _cygtls::handle_exceptions: Error while 
> dumping
> state (probably corrupted stack)
> 
> What does that mean?
> Carsten
> 
> Rory Walsh skrev:
>> Just go to the csound journal page from csounds.com and you should be 
>> able to find it. The wxWidgets stuff is pretty basic, are you an 
>> experienced wxWidgets programmer?
>>   
> "Beyond the basics" i would say.
> 
> PS: The command:
> dlltool --dllname=csound32.dll.5.1 --input-def=csound32.def –outputlib=
> libcsound32.a
> 
> misses a "-" in --outputlib (minor detail)
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 12:13
FromCarsten Høyer
SubjectRe: [Cs-dev] how to start using the cSound API
Ok, passing arguments it works.
"Don't forget to pass the normal Csound flags when testing your new 
application!" should be pretty self explanatory. But i thought it would 
output the flags like csound when tested without arguments.

Carsten

Rory Walsh skrev:
> Hmm,  did you pass arguments to csoundAPItest.exe? If not that could be 
> the problem as the program assumes that there is some input, I guess I 
> should change that so it checks argc.
>
> Rory.
>   

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 12:22
FromRory Walsh
SubjectRe: [Cs-dev] how to start using the cSound API
It should really, I keep meaning to update the code but never get around 
to it.... with regards to wxWidgets have you starting building your own 
custom widgets yet? I'm working on a Csound/wxWidgets project at the 
moment, that's why I'm asking.

Carsten Høyer wrote:
> Ok, passing arguments it works.
> "Don't forget to pass the normal Csound flags when testing your new 
> application!" should be pretty self explanatory. But i thought it would 
> output the flags like csound when tested without arguments.
> 
> Carsten
> 
> Rory Walsh skrev:
>> Hmm,  did you pass arguments to csoundAPItest.exe? If not that could be 
>> the problem as the program assumes that there is some input, I guess I 
>> should change that so it checks argc.
>>
>> Rory.
>>   
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 12:36
FromCarsten Høyer
SubjectRe: [Cs-dev] how to start using the cSound API
Rory Walsh skrev:
> It should really, I keep meaning to update the code but never get around 
> to it.... with regards to wxWidgets have you starting building your own 
> custom widgets yet? I'm working on a Csound/wxWidgets project at the 
> moment, that's why I'm asking.
>   
I am making a university project where i wish to create a _simple_  buzz 
clone (reaktor) with drag/drop from a treectrl. I know its been made 
before (like Cable: http://cabel.sourceforge.net/screenshots.html), and 
really the points/grades in this project is not about csound/wxwidgets 
but more the algorithm to control the wires between opcodes. I´m 
thinking of using some derived Dijkstras shortest path, and make the 
wires angled (that is, not straight like in reaktor). I got a long way 
to go :)

Carsten

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 12:48
FromRory Walsh
SubjectRe: [Cs-dev] how to start using the cSound API
Sound interesting. Good luck with the wiring between opcodes. I had to 
do this once and it was a real pain, although I went along the route of 
MAX/MSP style connections that users could alter. Unfortunately I didn't 
do it with wxWidgets. How easy is drag and drop to implement in 
wxWidgets? this is all getting a little off topic.... I might email you 
directly..



Carsten Høyer wrote:
> Rory Walsh skrev:
>> It should really, I keep meaning to update the code but never get around 
>> to it.... with regards to wxWidgets have you starting building your own 
>> custom widgets yet? I'm working on a Csound/wxWidgets project at the 
>> moment, that's why I'm asking.
>>   
> I am making a university project where i wish to create a _simple_  buzz 
> clone (reaktor) with drag/drop from a treectrl. I know its been made 
> before (like Cable: http://cabel.sourceforge.net/screenshots.html), and 
> really the points/grades in this project is not about csound/wxwidgets 
> but more the algorithm to control the wires between opcodes. I´m 
> thinking of using some derived Dijkstras shortest path, and make the 
> wires angled (that is, not straight like in reaktor). I got a long way 
> to go :)
> 
> Carsten
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 14:00
From"Oeyvind Brandtsegg"
SubjectRe: [Cs-dev] how to start using the cSound API
AttachmentsNone  

Date2008-01-23 14:08
FromRory Walsh
SubjectRe: [Cs-dev] how to start using the cSound API
> Not difficult, I mean *I* could figure it out...
> see e.g. wxDropSource and wxDropTarget.

I don't think you give yourself enough credit! Carsten sent me the 
following link which seems to explain it quite well:
http://zetcode.com/tutorials/wxwidgetstutorial/dragdrop/

Rory.

p.s. will you be heading to LAC this year?


> For an example, you could also possibly look at the ImproSculpt4 source in
> ui/SegmentDnD.py
> ui/PlaybackModule.py
> ui/WaveDisplay.py
> 
> Oeyvind
> 
> 2008/1/23, Rory Walsh :
> How easy is drag and drop to implement in
>> wxWidgets? this is all getting a little off topic.... I might email you
>> directly..
>>
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 14:44
From"Oeyvind Brandtsegg"
SubjectRe: [Cs-dev] how to start using the cSound API
AttachmentsNone  

Date2008-01-23 14:49
FromRory Walsh
SubjectRe: [Cs-dev] how to start using the cSound API
That's a pity, was hoping for a few more improscuplt tutorials!

Oeyvind Brandtsegg wrote:
> Sorry, can't make it this year.
> Oeyvind
> 
>> p.s. will you be heading to LAC this year?
>>
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 17:59
Fromjpff
SubjectRe: [Cs-dev] how to start using the cSound API
So Oeyvind will not be there, and I understand Dave Philips is
funding-challenged.  Who will be there?  I am already booked in, and
have a couple of papers and a piece.

Who will I have to talk to?

==John ffitch

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-23 18:08
FromRory Walsh
SubjectRe: [Cs-dev] how to start using the cSound API
I'm going to go, although I haven't booked anything yet. Is there a list 
of accommodation somewhere? They had a good list last year but I can't 
find any on the current site?

Rory.



jpff wrote:
> So Oeyvind will not be there, and I understand Dave Philips is
> funding-challenged.  Who will be there?  I am already booked in, and
> have a couple of papers and a piece.
> 
> Who will I have to talk to?
> 
> ==John ffitch
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-25 12:48
FromCarsten Høyer
Subject[Cs-dev] Csound and wxwidgets
Hello
I am trying to compile Rory Walshs example of using Csound with 
wxWidgets. http://www.csounds.com/journal/2006summer/wxCsound.html

It compiles ok, but when i run it in debug mode i get an error.
I run the program and I load a soundfile. Then i close the program and i 
get an error related to the command: csoundDestroy(ud->csound);

What confuses me (among many things) is that the code doesnt initialize 
csound, shouldnt csoundInitialize(....) be called at some point?

It does appear to me that csound is initialized because i can hit the 
play button and the sound will play. However, it will play really fast 
and the timer doesnt output anything. The speed might be due to my wav 
file being 11k 16bit mono. The slider has no effect either.

I am using visual studio 2005 express, xp 32-bit.
And i have changed the path in cmdl to point to my soundfile.csd file.
Some might say try Dev-Cpp, but i dont really want to go there, i spend 
a lot of time yesterday trying to make wxwidgets work with dev-cpp, 
without any luck. I then went back to VC++ where i allready had a 
wxwidgets project going.

Hope you can help
Carsten

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-25 13:03
FromRory Walsh
SubjectRe: [Cs-dev] Csound and wxwidgets
Yes csoundInitialize(....) should be called somewhere, whoops, my bad. 
Your soundfile speed issue is most likely due to the sampling rate, can 
you try it with a regular 44.1 sound file? Do you get the same problem 
in run mode? I just compiled it with MinGW and didn't have any problems, 
the slider works fine too but I've never tried building it in debug 
mode, me and GDB don't really like each other. Have you checked that the 
slider event is being triggered? I don't think anyone has a problem with 
MSVC++, if that's what your used to then I don't see why you should use 
dev-c++ or anything else for that matter.

Rory.



Carsten Høyer wrote:
> Hello
> I am trying to compile Rory Walshs example of using Csound with 
> wxWidgets. http://www.csounds.com/journal/2006summer/wxCsound.html
> 
> It compiles ok, but when i run it in debug mode i get an error.
> I run the program and I load a soundfile. Then i close the program and i 
> get an error related to the command: csoundDestroy(ud->csound);
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-25 13:15
FromCarsten Høyer
SubjectRe: [Cs-dev] Csound and wxwidgets
Going to Berlin, will have to give feedback in a few days :)
Carsten

> Yes csoundInitialize(....) should be called somewhere, whoops, my bad. 
> Your soundfile speed issue is most likely due to the sampling rate, can 
> you try it with a regular 44.1 sound file? Do you get the same problem 
> in run mode? I just compiled it with MinGW and didn't have any problems, 
> the slider works fine too but I've never tried building it in debug 
> mode, me and GDB don't really like each other. Have you checked that the 
> slider event is being triggered? I don't think anyone has a problem with 
> MSVC++, if that's what your used to then I don't see why you should use 
> dev-c++ or anything else for that matter.
>
> Rory.
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-02-01 22:16
FromCarsten Høyer
SubjectRe: [Cs-dev] Csound and wxwidgets
AttachmentsNone  None  
This is probably mostly for Rory.
Im trying to initialize csound in wxwidgets.
My guess is that, since wxwidgets has its own main method (wxApp), csoundinitialize should not be given arguements from the command line or main method arguments.
So in the example found in the csound journal we have:

char** cmdl;

cmdl[0] = "csound";
cmdl[1] = "C:\\soundfile.csd";
cmdl[2] = (char*)filestring.ToAscii();

My idea is to run csoundinitalize right after the above 3 lines, but im a little confused about what arguments to use where:

int csoundInitialize(int * argc, char *** argv, int flags);

Can you please help me out here.
Thank you
Carsten

Rory Walsh skrev:
Yes csoundInitialize(....) should be called somewhere, whoops, my bad. 
Your soundfile speed issue is most likely due to the sampling rate, can 
you try it with a regular 44.1 sound file? Do you get the same problem 
in run mode? I just compiled it with MinGW and didn't have any problems, 
the slider works fine too but I've never tried building it in debug 
mode, me and GDB don't really like each other. Have you checked that the 
slider event is being triggered? I don't think anyone has a problem with 
MSVC++, if that's what your used to then I don't see why you should use 
dev-c++ or anything else for that matter.

Rory.



Carsten Høyer wrote:
  
Hello
I am trying to compile Rory Walshs example of using Csound with 
wxWidgets. http://www.csounds.com/journal/2006summer/wxCsound.html

It compiles ok, but when i run it in debug mode i get an error.
I run the program and I load a soundfile. Then i close the program and i 
get an error related to the command: csoundDestroy(ud->csound);

    

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


  


Date2008-02-01 22:19
FromCarsten Høyer
SubjectRe: [Cs-dev] Csound and wxwidgets
This is probably mostly for Rory.
Im trying to initialize csound in wxwidgets.
My guess is that, since wxwidgets has its own main method (wxApp), 
csoundinitialize should not be given arguements from the command line or 
main method arguments.
So in the example found in the csound journal we have:

char** cmdl;

cmdl[0] = "csound";
cmdl[1] = "C:\\soundfile.csd";
cmdl[2] = (char*)filestring.ToAscii();

My idea is to run csoundinitalize right after the above 3 lines, but im 
a little confused about what arguments to use where:

int csoundInitialize(int * argc, char *** argv, int flags);

Can you please help me out here.
Thank you
Carsten

PS: Sorry if i´m double posting, i tried sending this email as both 
plain text and html, but it hasnt showed up in my email.

Rory Walsh skrev:
> Yes csoundInitialize(....) should be called somewhere, whoops, my bad. 
> Your soundfile speed issue is most likely due to the sampling rate, can 
> you try it with a regular 44.1 sound file? Do you get the same problem 
> in run mode? I just compiled it with MinGW and didn't have any problems, 
> the slider works fine too but I've never tried building it in debug 
> mode, me and GDB don't really like each other. Have you checked that the 
> slider event is being triggered? I don't think anyone has a problem with 
> MSVC++, if that's what your used to then I don't see why you should use 
> dev-c++ or anything else for that matter.
>
> Rory.
>
>
>
> Carsten Høyer wrote:
>   
>> Hello
>> I am trying to compile Rory Walshs example of using Csound with 
>> wxWidgets. http://www.csounds.com/journal/2006summer/wxCsound.html
>>
>> It compiles ok, but when i run it in debug mode i get an error.
>> I run the program and I load a soundfile. Then i close the program and i 
>> get an error related to the command: csoundDestroy(ud->csound);
>>
>>     
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-02-01 23:29
FromVictor.Lazzarini@nuim.ie
SubjectRe: [Cs-dev] Csound and wxwidgets
AttachmentsNone  None  None  None  

Date2008-02-02 13:42
FromCarsten Høyer
SubjectRe: [Cs-dev] Csound and wxwidgets
A lot of info in this email, so i decided to make an index:
1. My problem:
2. My setup
3. 3 different call stacks
4. test.h the program header
5. test.cpp
6. soundfile.csd

1. ------------------------------------------------------
I am still having problem with the code from the CSound Journal: 
http://www.csounds.com/journal/2006summer/wxCsound.html

The code as i am trying to compile it, is given below.
Testing the program in debug mode, i am getting the following 2 errors, 
once a soundfile is done playing:

First-chance exception at 0x7c90eb74 (ntdll.dll) in csound_test.exe: 
0xC0000008: An invalid handle was specified.
Unhandled exception at 0x01c79002 (pitch.dll) in csound_test.exe: 
0xC0000005: Access violation writing location 0x00000000.

The following error when first opening a soundfile, playing it, pausing 
it and then using EXIT:
Unhandled exception at 0x01ca8f90 in csound_test.exe: 0xC0000005: Access 
violation reading location 0x01ca8f90.

And the last error when just using EXIT
Unhandled exception at 0x10252758 (msvcr80d.dll) in csound_test.exe: 
0xC0000005: Access violation reading location 0xcdcdcdc1.

I think that the unspecified handler in error 1 is caused by the 
threadID being empty.
The error with pitch.dll - i dont know :)
The unhandled exception when exiting could be caused by csound not being 
initialized properly, because commenting out 
"csoundDestroy(ud->csound);" in the MyFrame destructor causes this error 
to disappear.

Just a sub-question, concerning csound32.dll and pitch.dll: How do i 
load the symbols to csound dlls? (don´t know much about this subject, 
just know that i had to load the symbols for windows dlls to get some 
sensible information in the call stack)

Thank you
Carsten

2 -------------------------------------
Environment:
XP-32bit
Visual Studio 2005 Express

Debug

Linker: wxmsw28d_aui.lib comctl32.lib uuid.lib rpcrt4.lib advapi32.lib 
wxbase28d.lib wxmsw28d_core.lib wxpngd.lib wxzlibd.lib wxtiffd.lib 
wxjpegd.lib csound32.lib

Multithreaded debug DLL

3 ------------------------------------------
CALL STACK WHEN LETTING A SOUNDFILE PLAY ALL THE WAY THROUGH:
pitch.dll!01c79002()
[Frames below may be incorrect and/or missing, no symbols loaded for 
pitch.dll]
user32.dll!_InternalCallWinProc@20() + 0x28 bytes
user32.dll!_UserCallWinProcCheckWow@32() + 0xb7 bytes
user32.dll!_DispatchClientMessage@20() + 0x4d bytes
user32.dll!___fnDWORD@4() + 0x24 bytes
ntdll.dll!_KiUserCallbackDispatcher@12() + 0x13 bytes
user32.dll!_NtUserPeekMessage@20() + 0xc bytes
user32.dll!_PeekMessageA@20() + 0xfb bytes
csound_test.exe!wxEventLoop::Pending() Line 217 + 0x14 bytes C++
csound_test.exe!wxEventLoopManual::Run() Line 99 + 0xf bytes C++
csound_test.exe!wxAppBase::MainLoop() Line 312 + 0x17 bytes C++
csound_test.exe!wxAppBase::OnRun() Line 367 + 0x12 bytes C++
csound_test.exe!wxEntryReal(int & argc=1, char * * argv=0x00d51e30)
Line 456 + 0x1d bytes C++
csound_test.exe!wxEntry(int & argc=1, char * * argv=0x00d51e30) Line 209 
+ 0xd bytes C++
csound_test.exe!wxEntry(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ *
__formal=0x00000000, HINSTANCE__ * __formal=0x00000000, int nCmdShow=1)
Line 386 + 0xd bytes C++
csound_test.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ *
hPrevInstance=0x00000000, char * lpCmdLine=0x00151f4f, int nCmdShow=1)
Line 3 + 0x33 bytes C++
csound_test.exe!__tmainCRTStartup() Line 578 + 0x35 bytes C
csound_test.exe!WinMainCRTStartup() Line 403 C
kernel32.dll!_BaseProcessStart@4() + 0x23 bytes

CALL STACK WHEN OPEN FILE, PLAY, PAUSE THEN USING EXIT:
01c78f90()
user32.dll!_InternalCallWinProc@20() + 0x28 bytes
user32.dll!_UserCallWinProcCheckWow@32() + 0xb7 bytes
user32.dll!_DispatchClientMessage@20() + 0x4d bytes
user32.dll!___fnDWORD@4() + 0x24 bytes
ntdll.dll!_KiUserCallbackDispatcher@12() + 0x13 bytes
user32.dll!_NtUserDestroyWindow@4() + 0xc bytes
csound_test.exe!wxTopLevelWindowBase::~wxTopLevelWindowBase()
Line 75 + 0x21 bytes C++
csound_test.exe!wxTopLevelWindowMSW::~wxTopLevelWindowMSW()
Line 641 + 0xf bytes C++
csound_test.exe!wxTopLevelWindow::~wxTopLevelWindow() + 0x16 bytes C++
csound_test.exe!wxFrameBase::~wxFrameBase() Line 79 + 0x1d bytes C++
csound_test.exe!wxFrame::~wxFrame() Line 214 + 0xf bytes C++
csound_test.exe!MyFrame::~MyFrame() Line 46 + 0x8 bytes C++
csound_test.exe!MyFrame::`scalar deleting destructor'() + 0x2b bytes C++
csound_test.exe!wxAppBase::DeletePendingObjects() Line 423 + 0x23 bytes C++
csound_test.exe!wxAppBase::ProcessIdle() Line 458 C++
csound_test.exe!wxEventLoopManual::Run() Line 99 + 0x4f bytes C++
csound_test.exe!wxAppBase::MainLoop() Line 312 + 0x17 bytes C++
csound_test.exe!wxAppBase::OnRun() Line 367 + 0x12 bytes C++
csound_test.exe!wxEntryReal(int & argc=1, char * * argv=0x00d51e30)
Line 456 + 0x1d bytes C++
csound_test.exe!wxEntry(int & argc=1, char * * argv=0x00d51e30)
Line 209 + 0xd bytes C++
csound_test.exe!wxEntry(HINSTANCE__ * hInstance=0x00400000,
HINSTANCE__ * __formal=0x00000000, HINSTANCE__ * __formal=0x00000000,
int nCmdShow=1) Line 386 + 0xd bytes C++
csound_test.exe!WinMain(HINSTANCE__ * hInstance=0x00400000,
HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f4f,
int nCmdShow=1) Line 3 + 0x33 bytes C++
csound_test.exe!__tmainCRTStartup() Line 578 + 0x35 bytes C
csound_test.exe!WinMainCRTStartup() Line 403 C
kernel32.dll!_BaseProcessStart@4() + 0x23 bytes

CALL STACK WHEN JUST USING EXIT:
msvcr80d.dll!operator delete(void * pUserData=0xcdcdcdcd) Line 52 + 0x3 
bytes C++
csound_test.exe!MyFrame::~MyFrame() Line 45 + 0x1b bytes C++
csound_test.exe!MyFrame::`scalar deleting destructor'() + 0x2b bytes C++
csound_test.exe!wxAppBase::DeletePendingObjects() Line 423 + 0x23 bytes C++
csound_test.exe!wxAppBase::ProcessIdle() Line 458 C++
csound_test.exe!wxEventLoopManual::Run() Line 99 + 0x4f bytes C++
csound_test.exe!wxAppBase::MainLoop() Line 312 + 0x17 bytes C++
csound_test.exe!wxAppBase::OnRun() Line 367 + 0x12 bytes C++
csound_test.exe!wxEntryReal(int & argc=1, char * * argv=0x00d51e30)
Line 456 + 0x1d bytes C++
csound_test.exe!wxEntry(int & argc=1, char * * argv=0x00d51e30)
Line 209 + 0xd bytes C++
csound_test.exe!wxEntry(HINSTANCE__ * hInstance=0x00400000,
HINSTANCE__ * __formal=0x00000000, HINSTANCE__ * __formal=0x00000000,
int nCmdShow=1) Line 386 + 0xd bytes C++
csound_test.exe!WinMain(HINSTANCE__ * hInstance=0x00400000,
HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f4f,
int nCmdShow=1) Line 3 + 0x33 bytes C++
csound_test.exe!__tmainCRTStartup() Line 578 + 0x35 bytes C
csound_test.exe!WinMainCRTStartup() Line 403 C
kernel32.dll!_BaseProcessStart@4() + 0x23 bytes



4 ------------------------------------------
TEST.H:

#ifndef TEST_H
#define TEST_H
#include "wx/wx.h"
#include "csound.h"
#include 
//--------------------------------------------------------------------------
struct userData{
/*result of csoundCompile()*/
int result;
/*instance of csound*/
CSOUND* csound;
/*performance status*/
bool PERF_STATUS;
};
//--------------------------------------------------------------------------
//main csound performance thread....
uintptr_t csThread(void *clientData);
//--------------------------------------------------------------------------
enum
{
ID_Quit = 100,
ID_About = 200,
ID_Scroll = 300,
ID_Open = 400,
ID_Play = 500,
ID_Timer = 600
};
//--------------------------------------------------------------------------
class MyApp: public wxApp
{
virtual bool OnInit();
};
//--------------------------------------------------------------------------
class MyFrame: public wxFrame
{
public:
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
~MyFrame();
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnOpen(wxCommandEvent& event);
void ScrollChange(wxScrollEvent &event);
void OnPlay(wxCommandEvent &event);
void OnTimer(wxTimerEvent& event);
wxMenu *menu;
wxMenuBar *menuBar;
wxSlider* slider;
wxButton* button;
wxPanel* panel;
userData* ud;
wxTextCtrl* label;
wxTimer* timer;
char** cmdl;
void* threadID;
protected:
DECLARE_EVENT_TABLE()
};
//--------------------------------------------------------------------------
#endif


5 -------------------------------------
TEST:CPP:
#include "test.h"

IMPLEMENT_APP(MyApp)
//--------------------------------------------------------------------------
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame( "Soundfiler..", wxPoint(50,50), 
wxSize(220,120) );
frame->Show(TRUE);
return TRUE;
}
//--------------------------------------------------------------------------
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Open, MyFrame::OnOpen)
EVT_MENU(ID_Quit, MyFrame::OnQuit)
EVT_MENU(ID_About, MyFrame::OnAbout)
EVT_BUTTON(ID_Play, MyFrame::OnPlay)
EVT_COMMAND_SCROLL_THUMBTRACK ( ID_Scroll, MyFrame::ScrollChange)
EVT_TIMER(ID_Timer, MyFrame::OnTimer)
END_EVENT_TABLE()
//--------------------------------------------------------------------------
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const 
wxSize& size)
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
{
menu = new wxMenu;
menu->Append( ID_Open, "&Open" );
menu->Append( ID_About, "&About..." );
menu->Append( ID_Quit, "E&xit" );
menuBar = new wxMenuBar;
menuBar->Append( menu, "&File" );
wxFrame::SetMenuBar( menuBar );
panel = new wxPanel(this, wxID_ANY, wxPoint(0, 0), wxFrame::GetSize());
slider = new wxSlider(panel, ID_Scroll, 0, 0, 100, wxPoint(10, 5), 
wxSize(200, 30));
button = new wxButton(panel, ID_Play, "Play file", wxPoint(140, 40), 
wxSize(60, 20));
label = new wxTextCtrl(panel, wxID_ANY, "0:00:00", wxPoint(15, 40), 
wxSize(50, 20), wxTE_RICH);
ud = (userData *) malloc(sizeof(userData));
timer = new wxTimer(this, ID_Timer);
//initialise PERF_STATUS to 0
ud->PERF_STATUS = 0;
}
//--------------------------------------------------------------------------
MyFrame::~MyFrame()
{
csoundDestroy(ud->csound);
delete ud;
delete cmdl;
}
//--------------------------------------------------------------------------
void MyFrame::OnQuit(wxCommandEvent& event)
{
wxMessageBox("Add test here to make sure Csound has stopped performing...");
Close(TRUE);
}
//--------------------------------------------------------------------------
void MyFrame::OnAbout(wxCommandEvent& event)
{
wxMessageBox("A simple Csound application");
}
//--------------------------------------------------------------------------
void MyFrame::OnOpen(wxCommandEvent& event)
{

if(!ud->PERF_STATUS){
/*char array to hld command line flags*/
/*allocate enough memory to hold
three command line parameters*/
cmdl = (char **) malloc(sizeof(char*)*(3));
/*call wxFileDialog constructor*/
wxFileDialog *dlg = new wxFileDialog(this, "Open a text file", "", "",
"All files(*.*)|*.*|Text Files(*.txt)|*.txt",
wxOPEN, wxDefaultPosition);
/* only enter test if user presses Ok if the user were
to press cancel instead ShowModal() would return wxID_CANCEL*/
if ( dlg->ShowModal() == wxID_OK )
{

/*get file name, GetPath retrieves name and path of
selected file and append --strset to the start of it*/
wxString filestring = "--strset1="+dlg->GetPath();
/*create instance of Csound*/
ud->csound=csoundCreate(NULL);
/*set command line flags*/
cmdl[0] = "csound";
cmdl[1] = "C:/soundfile.csd";
cmdl[2] = (char*)filestring.ToAscii();

csoundInitialize(NULL, NULL, 0);

/*make sure the last thread has finished
and reset csound
csoundJoinThread(threadID);
csoundReset(ud->csound);*/
ud->result=csoundCompile(ud->csound,3,cmdl);
}
dlg->Destroy();
}
else wxMessageBox("Please stop the audio first");
}
//--------------------------------------------------------------------------
void MyFrame::OnPlay(wxCommandEvent& event)
{
if(!ud->result)
{
MYFLT* pvalue;
if(ud->PERF_STATUS==0)
{
ud->PERF_STATUS=1;
threadID = csoundCreateThread(csThread, (void*)ud);
/*sleep for a few milliseconds to ensure the thread has
adequte time to start before retrieving value of "lenght*/
Sleep(100);
timer->Start(300);
if(csoundGetChannelPtr(ud->csound, &pvalue, "length", 
CSOUND_OUTPUT_CHANNEL | CSOUND_CONTROL_CHANNEL)==0)
{
/*set range according to sound file lenght*/
slider->SetRange(0, (int)*pvalue);
}
button->SetLabel("Pause");
}
else{
timer->Stop();
ud->PERF_STATUS = 0;
button->SetLabel("Play");
}
}
else wxMessageBox("please open an audio file");
}
//--------------------------------------------------------------------------
void MyFrame::ScrollChange(wxScrollEvent& event)
{
if(ud->PERF_STATUS==1)
{
MYFLT* pvalue;
//send position of slider to Csound on channel "skip"
if(csoundGetChannelPtr(ud->csound, &pvalue, "skip",
CSOUND_INPUT_CHANNEL | CSOUND_CONTROL_CHANNEL)==0)
*pvalue = (MYFLT)slider->GetValue();
}
}
//--------------------------------------------------------------------------
void MyFrame::OnTimer(wxTimerEvent& event)
{
if(ud->PERF_STATUS==1)
{
MYFLT* pvalue;
int scoreTime;
wxString minCaption, secCaption;
if(csoundGetChannelPtr(ud->csound, &pvalue, "time", 
CSOUND_OUTPUT_CHANNEL | CSOUND_CONTROL_CHANNEL)==0)
{
scoreTime = (int)*pvalue;
}
slider->SetValue(scoreTime);
int seconds = ((int)scoreTime)%60;
int minutes = (int)((scoreTime)/60);
//pass times to strings...
minCaption.Printf("%d", minutes);
secCaption.Printf("%d", seconds);
if((seconds<10)&&(minutes<10))
label->SetValue("0:0"+minCaption+":0"+secCaption);
else if((seconds>9)&&(minutes<10))
label->SetValue("0:0"+minCaption+":"+secCaption);
else if((seconds<10)&&(minutes>9))
label->SetValue("0:"+minCaption+":0"+secCaption);
else label->SetValue("0:"+minCaption+":"+secCaption);
}
else
{
slider->SetValue(0);
label->SetValue("0:00:00");
csoundJoinThread(ud->csound);
csoundReset(ud->csound);
ud->result=csoundCompile(ud->csound,3,cmdl);
button->SetLabel("Play");
timer->Stop();
}
}
//--------------------------------------------------------------------------
uintptr_t csThread(void *data)
{
userData* udata = (userData*)data;
if(!udata->result)
{
while((csoundPerformKsmps(udata->csound) == 0)&&(udata->PERF_STATUS==1));
}
udata->PERF_STATUS=0;
return 1;
}


6 -------------------------------------------
SOUNDFILE.CSD:


-odac -b10


sr = 44100
kr = 4410
ksmps = 10
nchnls = 2

;//length of soundfile
giflen init 0;

instr 1
;//retrieve file string form command line
Sname strget 1
giflen filelen Sname
/*send value of length to host on channel “lenght”*/
chnset giflen, "length"
/*start instr 2 with duration giflen*/
event_i "i", 2, 0, giflen
endin

instr 2
ifirst = 0
Sname strget 1

/*retrieve number of audio channels in file
so that we can add support for mono and stereo*/
ichnls filenchnls Sname
/*retrieve slider position from host application*/
ksearch chnget "skip"
/*set position to start playback from
ksearch chnget "skip"*/
ktrig changed ksearch

reset:
k1 line 0, p3, p3
iskip = i(ksearch);
if(ktrig==0) then
goto contin
else

/*reinitialise instrument every time
a user changes the slider*/
reinit reset

endif
contin:
ktime = k1+iskip;
/*output time to our host*/
chnset ktime, "time"
if(ktime>giflen) then
chnset 0, "time"
event "e", 2, 0, 0
endif
if(ichnls==2) then
a1, a2 soundin Sname, iskip
outs a1, a2
elseif(ichnls==1) then
a1 soundin Sname, iskip
outs a1, a1
endif
rireturn
endin



i1 0 1




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net