Added ASND sound, centered menus, added other save directories

This commit is contained in:
fabio.olimpieri 2012-04-08 09:16:42 +00:00
parent de19c97eae
commit dbff026c93
10 changed files with 161 additions and 74 deletions

View File

@ -25,7 +25,7 @@ INCLUDES :=
# options for code generation # options for code generation
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) -Wno-pointer-sign -DDEBUG CFLAGS = -g -O2 -Wall -Wno-unused-but-set-variable $(MACHDEP) $(INCLUDE) -Wno-pointer-sign -DDEBUG
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
@ -33,7 +33,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project # any extra libraries we wish to link with the project
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
LIBS := -lSDL_mixer -lsmpeg -lvorbisidec -lSDL_image -lpng -ljpeg -lz -lSDL -lSDL_gfx -lfreetype -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard LIBS := -lasnd -lSDL_mixer -lsmpeg -lvorbisidec -lSDL_image -lpng -ljpeg -lz -lSDL -lSDL_gfx -lfreetype -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing # list of directories containing libraries, this must be the top level containing
@ -114,15 +114,15 @@ dist: $(BUILD)
mkdir -p $@/apps/fbzx-wii mkdir -p $@/apps/fbzx-wii
mkdir -p $@/fbzx-wii/fbzx mkdir -p $@/fbzx-wii/fbzx
mkdir -p $@/fbzx-wii/spectrum-roms mkdir -p $@/fbzx-wii/spectrum-roms
mkdir -p $@/fbzx-wii/applications mkdir -p $@/fbzx-wii/tapes
mkdir -p $@/fbzx-wii/snapshots
mkdir -p $@/fbzx-wii/microdrives
mkdir -p $@/fbzx-wii/pixmaps mkdir -p $@/fbzx-wii/pixmaps
mkdir -p $@/fbzx-wii/doc/fbzx mkdir -p $@/apps/fbzx-wii/doc
cp fbzx.dol $@/apps/fbzx-wii/boot.dol cp fbzx.dol $@/apps/fbzx-wii/boot.dol
cp spectrum-roms/* $@/fbzx-wii/spectrum-roms cp spectrum-roms/* $@/fbzx-wii/spectrum-roms
cp keymap.bmp $@/fbzx-wii/fbzx cp keymap.bmp $@/fbzx-wii/fbzx
cp fbzx.desktop $@/fbzx-wii/applications cp AMSTRAD CAPABILITIES COPYING FAQ README README.TZX VERSIONS $@/apps/fbzx-wii/doc
cp fbzx.svg $@/fbzx-wii/pixmaps
cp AMSTRAD CAPABILITIES COPYING FAQ README README.TZX VERSIONS $@/fbzx-wii/doc/fbzx/
cd $@ && tar -czf ../fbzx-wii-bin.tar.gz * cd $@ && tar -czf ../fbzx-wii-bin.tar.gz *
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------

View File

@ -24,6 +24,15 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifdef DEBUG
extern FILE *fdebug;
#define printf(...) fprintf(fdebug,__VA_ARGS__)
#else
#ifdef GEKKO
#define printf(...)
#endif
#endif
void uncompress_z80(FILE *fichero,int length,unsigned char *memo) { void uncompress_z80(FILE *fichero,int length,unsigned char *memo) {
unsigned char byte_loaded,EDfound,counter; unsigned char byte_loaded,EDfound,counter;
@ -87,7 +96,9 @@ int save_z80(char *filename) {
fprintf(fichero,"%c%c%c%c%c%c",procesador.Rm.br.A,procesador.Rm.br.F,procesador.Rm.br.C,procesador.Rm.br.B,procesador.Rm.br.L,procesador.Rm.br.H); // AF, BC and HL fprintf(fichero,"%c%c%c%c%c%c",procesador.Rm.br.A,procesador.Rm.br.F,procesador.Rm.br.C,procesador.Rm.br.B,procesador.Rm.br.L,procesador.Rm.br.H); // AF, BC and HL
if(ordenador.mode128k==0) // 48K if(ordenador.mode128k==0) // 48K
fprintf(fichero,"%c%c",(byte)(procesador.PC&0x0FF),(byte)((procesador.PC>>8)&0xFF)); // PC fprintf(fichero,"%c%c",(byte)(procesador.PC&0x0FF),(byte)((procesador.PC>>8)&0xFF)); // PC
//Endian?
//fprintf(fichero,"%c%c",(byte)(procesador.PC&0x0FF),(byte)((procesador.PC<<8)&0xFF)); // PC
else else
fprintf(fichero,"%c%c",0,0); // 128K fprintf(fichero,"%c%c",0,0); // 128K

View File

@ -37,10 +37,10 @@ void printchar(unsigned char *memo, unsigned char carac, int x, int y, unsigned
lugar2=lugar; lugar2=lugar;
for (bucle2=0;bucle2 < 16;bucle2++) { for (bucle2=0;bucle2 < 16;bucle2++) {
if ((characters[carac-32][pos]) & bit_rot) if ((characters[carac-32][pos]) & bit_rot)
paint_one_pixel (colors + (int) (color), lugar2); paint_one_pixel ((unsigned char *) (colors + (int) (color)), lugar2);
//*((unsigned int *)lugar2)=*(colors+(int)(color-16)); //*((unsigned int *)lugar2)=*(colors+(int)(color-16));
else if ((ordenador.text_mini==0)||((bucle1%2==0)&&(bucle2%2==0))) else if ((ordenador.text_mini==0)||((bucle1%2==0)&&(bucle2%2==0)))
paint_one_pixel (colors + (int) (back), lugar2); paint_one_pixel ((unsigned char *)(colors + (int) (back)), lugar2);
//*((unsigned int *)lugar2)=*(colors+(int)(back-16)); //*((unsigned int *)lugar2)=*(colors+(int)(back-16));
if ((ordenador.text_mini==0)||(bucle2%2==1)) { if ((ordenador.text_mini==0)||(bucle2%2==1)) {
lugar2+=ordenador.bpp; lugar2+=ordenador.bpp;

View File

@ -33,7 +33,11 @@
#ifdef DEBUG #ifdef DEBUG
extern FILE *fdebug; extern FILE *fdebug;
#define printf(...) fprintf(fdebug,__VA_ARGS__); fflush (fdebug) #define printf(...) fprintf(fdebug,__VA_ARGS__)
#else
#ifdef GEKKO
#define printf(...)
#endif
#endif #endif
/* Returns the bus value when reading a port without a periferial */ /* Returns the bus value when reading a port without a periferial */
@ -581,12 +585,12 @@ inline void show_screen (int tstados) {
} }
if (ordenador.osd_time) if (ordenador.osd_time)
print_string (ordenador.screenbuffer,ordenador.osd_text, -1,460, 12, 0,ordenador.screen_width); print_string (ordenador.screenbuffer,ordenador.osd_text, -1,450, 12, 0,ordenador.screen_width);
else { else {
if (ordenador.zaurus_mini==0) if (ordenador.zaurus_mini==0)
print_string (ordenador.screenbuffer," ",-1, 460, 12, 0,ordenador.screen_width); print_string (ordenador.screenbuffer," ",-1, 450, 12, 0,ordenador.screen_width);
else else
print_string (ordenador.screenbuffer," ",-1, 460, 12, 0,ordenador.screen_width); print_string (ordenador.screenbuffer," ",-1, 450, 12, 0,ordenador.screen_width);
} }
} }

View File

@ -26,6 +26,7 @@
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <malloc.h>
#include "characters.h" #include "characters.h"
#include "menus.h" #include "menus.h"
#include <string.h> #include <string.h>
@ -42,7 +43,11 @@
#ifdef DEBUG #ifdef DEBUG
FILE *fdebug; FILE *fdebug;
#define printf(...) fprintf(fdebug,__VA_ARGS__); fflush (fdebug) #define printf(...) fprintf(fdebug,__VA_ARGS__)
#else
#ifdef GEKKO
#define printf(...)
#endif
#endif #endif
char debug_var=1; char debug_var=1;
@ -293,7 +298,9 @@ void init_screen(int resx,int resy,int depth,int fullscreen,int dblbuffer,int hw
value=0; value=0;
for(bucle2=0;bucle2<NUM_SNDBUF;bucle2++) { for(bucle2=0;bucle2<NUM_SNDBUF;bucle2++) {
sound[bucle2]=(unsigned char *)malloc(ordenador.buffer_len*ordenador.increment+8); //sound[bucle2]=(unsigned char *)malloc(ordenador.buffer_len*ordenador.increment+8);
//ASND Required alligned memory with padding
sound[bucle2]=(unsigned char *)memalign(32,ordenador.buffer_len*ordenador.increment+32);
for(bucle=0;bucle<ordenador.buffer_len*ordenador.increment+4;bucle++) for(bucle=0;bucle<ordenador.buffer_len*ordenador.increment+4;bucle++)
sound[bucle2][bucle]=value; sound[bucle2][bucle]=value;
value+=4; value+=4;
@ -515,12 +522,9 @@ int main(int argc,char *argv[]) {
#endif #endif
#ifdef GEKKO #ifdef GEKKO
fullscreen=1;
dblbuffer=1; dblbuffer=1;
hwsurface=1; hwsurface=1;
setenv("HOME", "/fbzx-wii", 1); setenv("HOME", "/fbzx-wii", 1);
printf("\x1b[2;0H");
//initialize libfat library //initialize libfat library
if (!fatInitDefault()) if (!fatInitDefault())
@ -531,8 +535,7 @@ int main(int argc,char *argv[]) {
} }
else else
printf("SD FAT subsytem initialized\n\n"); printf("SD FAT subsytem initialized\n\n");
//SDL_Delay(3000);
#endif #endif
@ -678,6 +681,10 @@ int main(int argc,char *argv[]) {
strcat(path_snaps,"/"); strcat(path_snaps,"/");
strcpy(path_taps,path_snaps); strcpy(path_taps,path_snaps);
strcpy(path_mdrs,path_snaps); strcpy(path_mdrs,path_snaps);
strcat(path_snaps,"snapshots");
strcat(path_taps,"tapes");
strcat(path_mdrs,"microdrives");
ordenador.current_tap[0]=0; ordenador.current_tap[0]=0;
// assign random values to the memory before start execution // assign random values to the memory before start execution
@ -796,7 +803,12 @@ int main(int argc,char *argv[]) {
ordenador.interr=0; ordenador.interr=0;
} }
} }
save_config(&ordenador); save_config(&ordenador);
#ifdef GEKKO
fatUnmount(0);
#endif
return 0; return 0;
} }

View File

@ -90,7 +90,7 @@ void settings_menu() {
do { do {
clean_screen(); clean_screen();
print_string(fbuffer,"Current settings",-1,5,15,0,ancho); print_string(fbuffer,"Current settings",-1,20,15,0,ancho);
switch(ordenador.mode128k) { switch(ordenador.mode128k) {
case 0: case 0:
if(ordenador.issue==2) if(ordenador.issue==2)
@ -207,8 +207,8 @@ void settings_menu() {
print_string(fbuffer,"V:",30,400,12,0,ancho); print_string(fbuffer,"V:",30,400,12,0,ancho);
print_string(fbuffer,"TV Set mode",78,400,15,0,ancho); print_string(fbuffer,"TV Set mode",78,400,15,0,ancho);
print_string(fbuffer,"ESC:",168,460,12,0,ancho); print_string(fbuffer,"ESC:",168,450,12,0,ancho);
print_string(fbuffer,"return emulator",232,460,15,0,ancho); print_string(fbuffer,"return emulator",232,450,15,0,ancho);
switch(wait_key()) { switch(wait_key()) {
case SDLK_ESCAPE: case SDLK_ESCAPE:
@ -305,8 +305,8 @@ void help_menu() {
clean_screen(); clean_screen();
print_string(fbuffer,"FBZX (2.7.0)",-1,10,15,0,ancho); print_string(fbuffer,"FBZX (2.7.0)",-1,20,15,0,ancho);
print_string(fbuffer,"Available keys",-1,40,14,0,ancho); print_string(fbuffer,"Available keys",-1,50,14,0,ancho);
print_string(fbuffer,"Shift:Caps Shift Ctrl:Symbol Shift",-1,95,11,0,ancho); print_string(fbuffer,"Shift:Caps Shift Ctrl:Symbol Shift",-1,95,11,0,ancho);
print_string(fbuffer,"F1:",14,160,12,0,ancho); print_string(fbuffer,"F1:",14,160,12,0,ancho);
@ -470,13 +470,13 @@ void tools_menu() {
do { do {
clean_screen(); clean_screen();
print_string(fbuffer,"Tools",-1,10,15,0,ancho); print_string(fbuffer,"Tools",-1,20,15,0,ancho);
print_string(fbuffer,"1:",14,50,12,0,ancho); print_string(fbuffer,"1:",14,60,12,0,ancho);
print_string(fbuffer,"show keyboard template",62,50,15,0,ancho); print_string(fbuffer,"show keyboard template",62,60,15,0,ancho);
print_string(fbuffer,"2:",14,90,12,0,ancho); print_string(fbuffer,"2:",14,100,12,0,ancho);
print_string(fbuffer,"insert POKEs",62,90,15,0,ancho); print_string(fbuffer,"insert POKEs",62,100,15,0,ancho);
print_string(fbuffer,"ESC:",14,250,12,0,ancho); print_string(fbuffer,"ESC:",14,250,12,0,ancho);
print_string(fbuffer,"return emulator",78,250,15,0,ancho); print_string(fbuffer,"return emulator",78,250,15,0,ancho);
@ -518,7 +518,7 @@ void snapshots_menu() {
clean_screen(); clean_screen();
print_string(fbuffer,"SNAPSHOTS",-1,10,15,0,ancho); print_string(fbuffer,"SNAPSHOTS",-1,30,15,0,ancho);
print_string(fbuffer,"1:",14,100,12,0,ancho); print_string(fbuffer,"1:",14,100,12,0,ancho);
print_string(fbuffer,"load a Z80/SNA snapshot",62,100,15,0,ancho); print_string(fbuffer,"load a Z80/SNA snapshot",62,100,15,0,ancho);
@ -582,29 +582,29 @@ void taps_menu() {
do { do {
clean_screen(); clean_screen();
print_string(fbuffer,"TAP/TZX files",-1,10,15,0,ancho); print_string(fbuffer,"TAP/TZX files",-1,20,15,0,ancho);
print_string(fbuffer,"1:",14,50,12,0,ancho); print_string(fbuffer,"1:",14,60,12,0,ancho);
print_string(fbuffer,"select a TAP/TZX file",62,50,15,0,ancho); print_string(fbuffer,"select a TAP/TZX file",62,60,15,0,ancho);
print_string(fbuffer,"2:",14,90,12,0,ancho); print_string(fbuffer,"2:",14,100,12,0,ancho);
print_string(fbuffer,"rewind TAP/TZX file",62,90,15,0,ancho); print_string(fbuffer,"rewind TAP/TZX file",62,100,15,0,ancho);
print_string(fbuffer,"3:",14,130,12,0,ancho); print_string(fbuffer,"3:",14,140,12,0,ancho);
print_string(fbuffer,"fast/normal speed",62,130,15,0,ancho); print_string(fbuffer,"fast/normal speed",62,140,15,0,ancho);
print_string(fbuffer,"4:",14,170,12,0,ancho); print_string(fbuffer,"4:",14,180,12,0,ancho);
print_string(fbuffer,"write protection",62,170,15,0,ancho); print_string(fbuffer,"write protection",62,180,15,0,ancho);
print_string(fbuffer,"5:",14,210,12,0,ancho); print_string(fbuffer,"5:",14,220,12,0,ancho);
print_string(fbuffer,"create TAP file",62,210,15,0,ancho); print_string(fbuffer,"create TAP file",62,220,15,0,ancho);
print_string(fbuffer,"ESC:",14,250,12,0,ancho); print_string(fbuffer,"ESC:",14,260,12,0,ancho);
print_string(fbuffer,"return emulator",78,250,15,0,ancho); print_string(fbuffer,"return emulator",78,260,15,0,ancho);
print_string(fbuffer,"Current TAP/TZX file is:",-1,300,12,0,ancho); print_string(fbuffer,"Current TAP/TZX file is:",-1,310,12,0,ancho);
print_string(fbuffer,ordenador.current_tap,-1,320,12,0,ancho); print_string(fbuffer,ordenador.current_tap,-1,330,12,0,ancho);
print_copy(fbuffer,ancho); print_copy(fbuffer,ancho);
@ -745,7 +745,7 @@ void create_tapfile() {
print_string(videomem,path_taps,0,152,12,0,ancho); print_string(videomem,path_taps,0,152,12,0,ancho);
retorno=ask_filename(nombre2,84,"tap"); retorno=ask_filename(nombre2,84,"tap",path_taps);
clean_screen(); clean_screen();
@ -801,19 +801,19 @@ void microdrive_menu() {
do { do {
clean_screen(); clean_screen();
print_string(fbuffer,"MICRODRIVE files",-1,10,15,0,ancho); print_string(fbuffer,"MICRODRIVE files",-1,20,15,0,ancho);
print_string(fbuffer,"1:",14,50,12,0,ancho); print_string(fbuffer,"1:",14,60,12,0,ancho);
print_string(fbuffer,"select a MDR file",62,50,15,0,ancho); print_string(fbuffer,"select a MDR file",62,60,15,0,ancho);
print_string(fbuffer,"2:",14,90,12,0,ancho); print_string(fbuffer,"2:",14,100,12,0,ancho);
print_string(fbuffer,"create a MDR file",62,90,15,0,ancho); print_string(fbuffer,"create a MDR file",62,100,15,0,ancho);
print_string(fbuffer,"3:",14,130,12,0,ancho); print_string(fbuffer,"3:",14,140,12,0,ancho);
print_string(fbuffer,"write protection",62,130,15,0,ancho); print_string(fbuffer,"write protection",62,140,15,0,ancho);
print_string(fbuffer,"ESC:",14,170,12,0,ancho); print_string(fbuffer,"ESC:",14,180,12,0,ancho);
print_string(fbuffer,"return emulator",78,170,15,0,ancho); print_string(fbuffer,"return emulator",78,180,15,0,ancho);
print_string(fbuffer,"Current MDR file is:",-1,300,12,0,ancho); print_string(fbuffer,"Current MDR file is:",-1,300,12,0,ancho);
print_string(fbuffer,ordenador.mdr_current_mdr,-1,320,12,0,ancho); print_string(fbuffer,ordenador.mdr_current_mdr,-1,320,12,0,ancho);
@ -928,7 +928,7 @@ void create_mdrfile() {
print_string(videomem,"MDR file will be saved in:",-1,132,12,0,ancho); print_string(videomem,"MDR file will be saved in:",-1,132,12,0,ancho);
print_string(videomem,path_mdrs,0,152,12,0,ancho); print_string(videomem,path_mdrs,0,152,12,0,ancho);
retorno=ask_filename(nombre2,84,"mdr"); retorno=ask_filename(nombre2,84,"mdr",path_mdrs);
clean_screen(); clean_screen();
@ -991,9 +991,9 @@ void create_scrfile() {
print_string(videomem,"(up to 30 characters)",-1,52,14,0,ancho); print_string(videomem,"(up to 30 characters)",-1,52,14,0,ancho);
print_string(videomem,"SCR file will be saved in:",-1,132,12,0,ancho); print_string(videomem,"SCR file will be saved in:",-1,132,12,0,ancho);
print_string(videomem,path_mdrs,0,152,12,0,ancho); print_string(videomem,path_snaps,0,152,12,0,ancho);
retorno=ask_filename(nombre2,84,"scr"); retorno=ask_filename(nombre2,84,"scr",path_snaps);
clean_screen(); clean_screen();
@ -1038,7 +1038,7 @@ void create_scrfile() {
} }
int ask_filename(char *nombre_final,int y_coord,char *extension) { int ask_filename(char *nombre_final,int y_coord,char *extension, char *path) {
int longitud,retorno; int longitud,retorno;
unsigned char nombre[37],nombre2[38]; unsigned char nombre[37],nombre2[38];
@ -1335,11 +1335,11 @@ int ask_filename(char *nombre_final,int y_coord,char *extension) {
nombre[longitud]=0; // erase cursor nombre[longitud]=0; // erase cursor
longitud=strlen(path_snaps); longitud=strlen(path);
if((path_snaps[longitud-1]!='/')&&(longitud>1)) if((path[longitud-1]!='/')&&(longitud>1))
sprintf(nombre_final,"%s/%s.%s",path_snaps,nombre,extension); // name sprintf(nombre_final,"%s/%s.%s",path,nombre,extension); // name
else else
sprintf(nombre_final,"%s%s.%s",path_snaps,nombre,extension); sprintf(nombre_final,"%s%s.%s",path,nombre,extension);
return (retorno); return (retorno);
} }
@ -1462,7 +1462,7 @@ void save_z80file() {
print_string(videomem,path_snaps,0,152,12,0,ancho); print_string(videomem,path_snaps,0,152,12,0,ancho);
retorno=ask_filename(nombre2,84,"z80"); retorno=ask_filename(nombre2,84,"z80", path_snaps);
clean_screen(); clean_screen();
@ -1827,7 +1827,7 @@ void keyboard_menu() {
for (bucle1=0;bucle1<344;bucle1++) for (bucle1=0;bucle1<344;bucle1++)
for(bucle2=0;bucle2<640;bucle2++) { for(bucle2=0;bucle2<640;bucle2++) {
retval=fscanf(fichero,"%c",&valor); retval=fscanf(fichero,"%c",&valor);
paint_one_pixel(colors+valor,buffer); paint_one_pixel((unsigned char *)(colors+valor),buffer);
buffer+=ordenador.bpp; buffer+=ordenador.bpp;
} }
} else { } else {
@ -1836,7 +1836,7 @@ void keyboard_menu() {
buffer2=buffer; buffer2=buffer;
for(bucle2=0;bucle2<640;bucle2++) { for(bucle2=0;bucle2<640;bucle2++) {
retval=fscanf(fichero,"%c",&valor); retval=fscanf(fichero,"%c",&valor);
paint_one_pixel(colors+valor,buffer); paint_one_pixel((unsigned char *)(colors+valor),buffer);
buffer+=(480*ordenador.bpp); buffer+=(480*ordenador.bpp);
} }
buffer=buffer2-ordenador.bpp; buffer=buffer2-ordenador.bpp;

View File

@ -45,7 +45,7 @@ void create_mdrfile();
void microdrive_menu(); void microdrive_menu();
void keyboard_menu(); void keyboard_menu();
void load_scrfile(); void load_scrfile();
int ask_filename(char *nombre,int y_coord,char *extension); int ask_filename(char *nombre,int y_coord,char *extension, char *path);
void create_scrfile(); void create_scrfile();
void do_poke(); void do_poke();
int ask_value(int *final_value,int y_coord,int max_value); int ask_value(int *final_value,int y_coord,int max_value);

View File

@ -33,7 +33,11 @@ char tabla[1024];
#ifdef DEBUG #ifdef DEBUG
extern FILE *fdebug; extern FILE *fdebug;
#define printf(...) fprintf(fdebug,__VA_ARGS__); fflush (fdebug) #define printf(...) fprintf(fdebug,__VA_ARGS__)
#else
#ifdef GEKKO
#define printf(...)
#endif
#endif #endif
/*#include <SDL/SDL.h> /*#include <SDL/SDL.h>
@ -60,6 +64,10 @@ snd_pcm_t * _soundDevice;
pa_simple *pulse_s; pa_simple *pulse_s;
#endif #endif
#ifdef GEKKO
#include <asndlib.h>
#endif
enum e_soundtype sound_type; enum e_soundtype sound_type;
int sound_init() { int sound_init() {
@ -112,6 +120,19 @@ int sound_init() {
} }
break; break;
#endif #endif
#ifdef GEKKO
case SOUND_ASND:
printf("Trying ASND sound\n");
if(0==sound_init_asnd()) {
sound_type=SOUND_ASND;
return 0;
} else {
printf("Failed\n");
return -1;
}
break;
#endif
default: default:
break; break;
} }
@ -140,9 +161,32 @@ int sound_init() {
} }
#endif #endif
#ifdef GEKKO
printf("Trying ASND sound\n");
if(0==sound_init_asnd()) {
sound_type=SOUND_ASND;
return 0;
}
#endif
return -1; return -1;
} }
#ifdef GEKKO
int sound_init_asnd() {
ASND_Init();
ASND_Pause(0);
ordenador.sign=0;
ordenador.format=0;
ordenador.channels=1;
ordenador.freq=48000;
ordenador.buffer_len=4096;
return 0;
}
#endif
#ifdef D_SOUND_PULSE #ifdef D_SOUND_PULSE
int sound_init_pulse() { int sound_init_pulse() {
@ -443,6 +487,15 @@ void sound_play() {
return; return;
break; break;
#endif #endif
#ifdef GEKKO
case SOUND_ASND: // ASND
retval=ASND_SetVoice(1,VOICE_MONO_8BIT,48000,0,ordenador.current_buffer,ordenador.buffer_len,
ordenador.volume, ordenador.volume, NULL);
while (ASND_StatusVoice(1) == SND_WORKING){};
return;
break;
#endif
default: default:
break; break;
} }
@ -470,6 +523,12 @@ void sound_close() {
pa_simple_free(pulse_s); pa_simple_free(pulse_s);
break; break;
#endif #endif
#ifdef GEKKO
case SOUND_ASND:
ASND_End();
break;
#endif
default: default:
break; break;
} }

View File

@ -20,7 +20,7 @@
#ifndef SOUND_H #ifndef SOUND_H
#define SOUND_H #define SOUND_H
enum e_soundtype {SOUND_NO, SOUND_OSS, SOUND_ALSA, SOUND_PULSEAUDIO, SOUND_AUTOMATIC}; enum e_soundtype {SOUND_NO, SOUND_OSS, SOUND_ALSA, SOUND_PULSEAUDIO, SOUND_AUTOMATIC, SOUND_ASND};
extern enum e_soundtype sound_type; extern enum e_soundtype sound_type;
@ -33,7 +33,8 @@ extern volatile unsigned char *sdl_sound_buffer;
int sound_init_oss(); int sound_init_oss();
int sound_init_alsa(); int sound_init_alsa();
int sound_init_pulse(); int sound_init_pulse();
int sound_init_asnd();
void sdlcallback(void *userdata, Uint8 *stream, int len); //void sdlcallback(void *userdata, Uint8 *stream, int len);
#endif #endif

View File

@ -29,7 +29,7 @@ CFLAGS = -g -O1 -Wall $(MACHDEP) $(INCLUDE)
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
#-fpack-struct
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project # any extra libraries we wish to link with the project
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------