I just added SDL audio support to Caloric:
http://revolf.free.fr/beos/patches/calo ... ff.001.txt
(no it's not BeOS specific).
While it doesn't really add anything useful for Unix users (they'll use arts, esd, alsa or oss anyway, but it lets SDL choose by default), it will help porting to other platforms who have SDL but aren't Unix and as such lack any of those APIs. This way, SDL will just the available native audio subsystem of the OS.
It's one step towards a win32 build (there is an SDL port AFAIK, so it should be doable with cygwin or mingw).
This way XP users will again be able to have a windowed ORIC emulator
SDL Audio in Caloric
Re: SDL Audio in Caloric
Greetings. I have been spending some time trying to get Caloric compiled under cygwin. I declare my lack of experience here, but after many attempts, I ended up with the correct (?) cygwin configuration so configure does not complain.mmu_man wrote:I just added SDL audio support to Caloric:
http://revolf.free.fr/beos/patches/calo ... ff.001.txt
(no it's not BeOS specific).
While it doesn't really add anything useful for Unix users (they'll use arts, esd, alsa or oss anyway, but it lets SDL choose by default), it will help porting to other platforms who have SDL but aren't Unix and as such lack any of those APIs. This way, SDL will just the available native audio subsystem of the OS.
It's one step towards a win32 build (there is an SDL port AFAIK, so it should be doable with cygwin or mingw).
This way XP users will again be able to have a windowed ORIC emulator
After that I found a lot of trouble to make things compile. I had to include some lables (__CYGWIN__ and HAVE_OSS) and also add the include path /usr/include (surely something is misconfigured in this case) to the generated Makefile.
I also had to modify some sources (somethings did not work, like including linux/soundcard.h, or some other little things), but it ended up compiling.
However it did not pass the link stage. I get errors I can't solve at all. Here is an example:
Code: Select all
6502_c.o: In function `showState':
/home/Chema/caloric-0.1a/src/6502_c.c:98: undefined reference to `_Carry'
/home/Chema/caloric-0.1a/src/6502_c.c:98: undefined reference to `_Overflow'
/home/Chema/caloric-0.1a/src/6502_c.c:98: undefined reference to `_Flags'
6502_c.o: In function `on_buttonreset_clicked':
/home/Chema/caloric-0.1a/src/6502_c.c:243: undefined reference to `_Sys_Request'
/home/Chema/caloric-0.1a/src/6502_c.c:243: undefined reference to `_Sys_Request'
Code: Select all
traps.o:traps.S:169: undefined reference to `fgetc'
traps.o:traps.S:184: undefined reference to `fclose'
traps.o:traps.S:190: undefined reference to `feof'
traps.o:traps.S:198: undefined reference to `tap_open_read'
traps.o:traps.S:216: undefined reference to `tap_open_write'
traps.o:traps.S:229: undefined reference to `fputc'
traps.o:traps.S:236: undefined reference to `fflush'
traps.o:traps.S:247: undefined reference to `printf'
via1.o:via1.S:157: undefined reference to `printf'
And after that is solved I must figure out about the Windows port of SDL, as I just included the library and headers on Cygwin, but I think I need a component running on the Windows part.
Cheers.
-
- Flight Lieutenant
- Posts: 322
- Joined: Thu Sep 21, 2006 7:45 pm
- Location: 26000 Valence, FRANCE
- Contact:
Re: SDL Audio in Caloric
cygwin gcc should define it on its own...Chema wrote:After that I found a lot of trouble to make things compile. I had to include some lables (__CYGWIN__ and HAVE_OSS) and also add the include path /usr/include (surely something is misconfigured in this case) to the generated Makefile.
Why are you defining HAVE_OSS ??? windows doesn't have that, there is no reason to do so. And that's why configure didn't define it, because it didn't detect it.
It's actually the whole reason I added SDL audio support, so SDL uses the native audio system on the OS. Because BeOS doesn't have OSS (not as an API at least).
Of course if you define HAVE_OSS it will try to use it!I also had to modify some sources (somethings did not work, like including linux/soundcard.h, or some other little things), but it ended up compiling.
Hmm that's likely due to the name mangling on windows... symbols get a _ prefix automatically by the compiler, but the asm code doesn't have them, so they aren't found.However it did not pass the link stage. I get errors I can't solve at all. Here is an example:Code: Select all
6502_c.o: In function `showState': /home/Chema/caloric-0.1a/src/6502_c.c:98: undefined reference to `_Carry' /home/Chema/caloric-0.1a/src/6502_c.c:98: undefined reference to `_Overflow' /home/Chema/caloric-0.1a/src/6502_c.c:98: undefined reference to `_Flags' 6502_c.o: In function `on_buttonreset_clicked': /home/Chema/caloric-0.1a/src/6502_c.c:243: undefined reference to `_Sys_Request' /home/Chema/caloric-0.1a/src/6502_c.c:243: undefined reference to `_Sys_Request'
Same here, but the other way, the asm code references symbols that are _ prefixed... that's ugly (ugliest being calling libc funcs form asm) and should be fixed.Code: Select all
traps.o:traps.S:169: undefined reference to `fgetc' traps.o:traps.S:184: undefined reference to `fclose' traps.o:traps.S:190: undefined reference to `feof' traps.o:traps.S:198: undefined reference to `tap_open_read' traps.o:traps.S:216: undefined reference to `tap_open_write' traps.o:traps.S:229: undefined reference to `fputc' traps.o:traps.S:236: undefined reference to `fflush' traps.o:traps.S:247: undefined reference to `printf' via1.o:via1.S:157: undefined reference to `printf'
Re: SDL Audio in Caloric
For sure there is something misconfigured in my cygwin installation, I will try to solve it. I had to define HAVE_OSS because else I had problems when compiling. I think the problem is in dsp.c in this piece of code:mmu_man wrote: cygwin gcc should define it on its own...
Why are you defining HAVE_OSS ??? windows doesn't have that, there is no reason to do so. And that's why configure didn't define it, because it didn't detect it.
It's actually the whole reason I added SDL audio support, so SDL uses the native audio system on the OS. Because BeOS doesn't have OSS (not as an API at least).
Code: Select all
#if HAVE_ALSA
if (alsa_open () == 0)
{
sound_write = alsa_write;
sound_close = alsa_close;
return 0;
}
return 1;
#else
if (oss_open () == 0)
{
sound_write = oss_write;
sound_close = oss_close;
return 0;
}
#endif
I can't remember exactly if this is the problem, but I remember having compile errors with oss_write and others not being defined.
Well, that is not the only problem (cygwin has a /usr/lib/sys/soundcard.h IIRC). Also the sources usually issue #include <SDL/SDL.h> and I had to change that to #include<SDL.h> as the rest is already issued by -I flags.Of course if you define HAVE_OSS it will try to use it!I also had to modify some sources (somethings did not work, like including linux/soundcard.h, or some other little things), but it ended up compiling.
Another thing is with signals. In static const int fatal_signals[] = in hosttraps.c I had to remove some of them (SIGIOT, SIGSTKFLT, SIGPWR, and SIGUNUSED) as the compiler issued undefined errors.
Finally serial_desc=open(serial_name,O_RDWR | O_NDELAY); in host.c issued an error about O_NDELAY not being defined.
So nothing I can do on my part, I suppose...However it did not pass the link stage. I get errors I can't solve at all. Here is an example:
Hmm that's likely due to the name mangling on windows... symbols get a _ prefix automatically by the compiler, but the asm code doesn't have them, so they aren't found.
...
Same here, but the other way, the asm code references symbols that are _ prefixed... that's ugly (ugliest being calling libc funcs form asm) and should be fixed.
Another thing, which is not a problem in Caloric I think, is that each time something changes and I have to run ./configure again, it takes ages to perform all the tests and generate the Makefile.
One silly question. Where should I configure the path where gcc should look for the includes? I do have the INCLUDE_PATH variable set in .bash_profile as
Code: Select all
INCLUDE_PATH=/usr/include:${INCLUDE_PATH}
export INCLUDE_PATH
Cheers
-
- Flight Lieutenant
- Posts: 322
- Joined: Thu Sep 21, 2006 7:45 pm
- Location: 26000 Valence, FRANCE
- Contact:
Re: SDL Audio in Caloric
Did you apply the diff I posted the url in that same thread ???Chema wrote:For sure there is something misconfigured in my cygwin installation, I will try to solve it. I had to define HAVE_OSS because else I had problems when compiling. I think the problem is in dsp.c in this piece of code:
As neither HAVE_ALSA nor HAVE_OSS are defined, functions oss_write and oss_close are undefined, but still used... I had an error about that.Code: Select all
#if HAVE_ALSA if (alsa_open () == 0) { sound_write = alsa_write; sound_close = alsa_close; return 0; } return 1; #else if (oss_open () == 0) { sound_write = oss_write; sound_close = oss_close; return 0; } #endif
It fixes just that and other stuff.
If you use SDL only you don't need soundcard.h.Well, that is not the only problem (cygwin has a /usr/lib/sys/soundcard.h IIRC). Also the sources usually issue #include <SDL/SDL.h> and I had to change that to #include<SDL.h> as the rest is already issued by -I flags.
Just use the patch!
The patch I made for BeOS fixes those as BeOS doesn't have them either:Another thing is with signals. In static const int fatal_signals[] = in hosttraps.c I had to remove some of them (SIGIOT, SIGSTKFLT, SIGPWR, and SIGUNUSED) as the compiler issued undefined errors.
http://revolf.free.fr/beos/patches/calo ... ff.001.txt
http://revolf.free.fr/beos/patches/calo ... ff.001.txtFinally serial_desc=open(serial_name,O_RDWR | O_NDELAY); in host.c issued an error about O_NDELAY not being defined.
You can use mangling macros to prepend the underscore in asm depending on the platform. Best would be of course to replace the asm with plain C. Won't be much slower really.So nothing I can do on my part, I suppose...
As long as you only modify the C code there is no reason to rerun configure.Another thing, which is not a problem in Caloric I think, is that each time something changes and I have to run ./configure again, it takes ages to perform all the tests and generate the Makefile.
Should work just runningOne silly question. Where should I configure the path where gcc should look for the includes? I do have the INCLUDE_PATH variable set in .bash_profile asbut still have to add -I/usr/include to the Makefile to make gcc find everything under sys (#include<sys/whatever>). Sorry to feel stupid here, it has been a loooong time since I stopped using unixCode: Select all
INCLUDE_PATH=/usr/include:${INCLUDE_PATH} export INCLUDE_PATH
CFLAGS=-I/usr/include ./configure ...
One note I forgot to post
I managed to compile everything with no errors (after modifying some sources about the problem with exporting symbols mentioned before), but did not succeed in the end.
For what I read in the net, SDL imposes mingw libaries (even when compiled from sources) which seems to be incompatible with other libraries needed by Caloric (thread support, at least, IIRC). I got several errors like this:
It seems to be a known issue, but have not the slightest idea about how it could be solved.
Anyway we are really near
I managed to compile everything with no errors (after modifying some sources about the problem with exporting symbols mentioned before), but did not succeed in the end.
For what I read in the net, SDL imposes mingw libaries (even when compiled from sources) which seems to be incompatible with other libraries needed by Caloric (thread support, at least, IIRC). I got several errors like this:
Code: Select all
/home/Chema/caloric-0.1a/src/interrup.c:66: undefined reference to `_sigaction
locate.o: In function `locate_file':
/home/Chema/caloric-0.1a/src/locate.c:96: undefined reference to `___errno'
/home/Chema/caloric-0.1a/src/locate.c:186: undefined reference to `___errno'
oric.o: In function `SDL_main':
/home/Chema/caloric-0.1a/src/oric.c:95: undefined reference to `__impure_ptr'
Anyway we are really near