Csound Csound-dev Csound-tekno Search About

[CSOUND-DEV:4754] csound5 on OSX

Date2004-05-19 07:54
Fromjpff@codemist.co.uk
Subject[CSOUND-DEV:4754] csound5 on OSX
I have made some updates to allow OSX to get further. (there was a
typo in Top/dl_opcodes.c)

I am now seriously stuck with generating .so files
In man gcc I see

-shared
           This option is not supported on Mac OS X.

There must be an alternative.  Any suggestions?  Does this not matter?
I thought of just removing -shared but that seem internal to scons

The other stopper at present is that I need a version of getChar for
OSX.  I had assumed it might be like unix but that fails as well.  Any
ideas?

==John ffitch

Date2004-05-19 09:41
From"Matt J. Ingalls"
Subject[CSOUND-DEV:4756] Re: csound5 on OSX
steven probably could explain better, but to my memory this is what was
added to deal with the -shared problem:

if getPlatform() == 'darwin':
	pluginEnvironment.Append(LINKFLAGS = ['-dynamiclib'])
	pluginEnvironment['SHLIBSUFFIX'] = '.dylib'


i did check this into cvs, is it not in the current file?


i think that sensekey should be removed out of pitch.c
and put into the kernel because getChar() is in the API.
btw, here is some changes i made to that:


  	static char inChar_ = 0; // these should really be in the
  	static int kbHit_ = 0; // ENVIRONS struct

	PUBLIC void csoundKeyPress(void *csound, char c)
	{
  		inChar_ = c;
  		kbHit_ = 1;
  	}

   	char getChar()
   	{
   		if (kbHit_) {
   			kbHit_ = 0;
   			return inChar_;
   		}

   		return -1;
   	}



it also would be REALLY USEFUL to implement a 'sensekeyup' opcode!

-m

On Wed, 19 May 2004 jpff@codemist.co.uk wrote:

> I have made some updates to allow OSX to get further. (there was a
> typo in Top/dl_opcodes.c)
>
> I am now seriously stuck with generating .so files
> In man gcc I see
>
> -shared
>            This option is not supported on Mac OS X.
>
> There must be an alternative.  Any suggestions?  Does this not matter?
> I thought of just removing -shared but that seem internal to scons
>
> The other stopper at present is that I need a version of getChar for
> OSX.  I had assumed it might be like unix but that fails as well.  Any
> ideas?
>
> ==John ffitch
>
>

Date2004-05-19 11:36
Fromjpff@codemist.co.uk
Subject[CSOUND-DEV:4759] Re: csound5 on OSX
>>>>> "Matt" == Matt J Ingalls  writes:

 Matt> steven probably could explain better, but to my memory this is what was
 Matt> added to deal with the -shared problem:

 Matt> if getPlatform() == 'darwin':
 Matt> 	pluginEnvironment.Append(LINKFLAGS = ['-dynamiclib'])
 Matt> 	pluginEnvironment['SHLIBSUFFIX'] = '.dylib'


 Matt> i did check this into cvs, is it not in the current file?

Yes it is, but the -shared option is still there and gives a warning
message on every compilation

 Matt> i think that sensekey should be removed out of pitch.c
 Matt> and put into the kernel because getChar() is in the API.

Did not know that it was in the API.  What difference does it make
being in teh kernel rather than loadable?

 Matt> btw, here is some changes i made to that:


 Matt>   	static char inChar_ = 0; // these should really be in the
 Matt>   	static int kbHit_ = 0; // ENVIRONS struct

 Matt> 	PUBLIC void csoundKeyPress(void *csound, char c)
 Matt> 	{
 Matt>   		inChar_ = c;
 Matt>   		kbHit_ = 1;
 Matt>   	}

 Matt>    	char getChar()
 Matt>    	{
 Matt>    		if (kbHit_) {
 Matt>    			kbHit_ = 0;
 Matt>    			return inChar_;
 Matt>    		}

 Matt>    		return -1;
 Matt>    	}

Do not understand that.  How does that get the character?

 Matt> it also would be REALLY USEFUL to implement a 'sensekeyup'
 Matt> opcode!

Not sure how to detect a change withjout continuous monitoring

==John ffitch

Date2004-05-19 20:05
From"Matt J. Ingalls"
Subject[CSOUND-DEV:4763] Re: csound5 on OSX
> Yes it is, but the -shared option is still there and gives a warning
> message on every compilation

hmm i dont see that, maybe i should refresh from cvs..

>
>  Matt> i think that sensekey should be removed out of pitch.c
>  Matt> and put into the kernel because getChar() is in the API.
>
> Did not know that it was in the API.  What difference does it make
> being in teh kernel rather than loadable?

so you dont have to have a function pointer to getChar() in the
ENVIRONS.  what really should happen i think is that all the #ifdef
stuff should be removed out of pitch.c and be replace with:

int ksense(KSENSE *p)
{
        *p->ans = getChar();
        return OK;
}

THEN in csound.c you can define getChar() and put in the
platform specific code for _getch() or whatever. [ i would hope the
linux implementation would work for OSX too? ] something like:

static char inChar_ = 0; // these should really be in the
static int kbHit_ = 0; // ENVIRONS struct

PUBLIC void csoundKeyPress(void *csound, char c)
{
	inChar_ = c;
	kbHit_ = 1;
}

char getChar()
{
       if (kbHit_) { // if host has sent a keypress
	 kbHit_ = 0;
	 return inChar_;
 	}
	else {
# ifdef WIN32
    	  if (_kbhit())
      		return _getch();
#else
    	  if (kbhit())
      		return getchar();
#endif
	}

	return -1; // no recent keyhit so return, -1
}





> Do not understand that.  How does that get the character?

the host calls csoundKeyPress() everytime a new key is pressed.

>
>  Matt> it also would be REALLY USEFUL to implement a 'sensekeyup'
>  Matt> opcode!
>
> Not sure how to detect a change withjout continuous monitoring

dont know if there is a unix way to do it, but definitely through the api
it should be supported as other oses/programs can trap key ups.
implementing this would allow you to use the keyboard as a piano keyboard,
holding down notes, etc..

as you can guess, i use sensekey A LOT in my own stuff!!

-m