diff --git a/boop/audio/sid.c b/boop/audio/sid.c index 0128d39..9ade33e 100644 --- a/boop/audio/sid.c +++ b/boop/audio/sid.c @@ -157,7 +157,7 @@ void beep(unsigned char n) { SIDsetfrq(0,5001); break; } - PWMPR = 0; + //PWMPR = 0; switchSound(SOUND_ON); SID.flags |= SIDenable; SID.reg[REG_Control] |= GATE; diff --git a/boop/audio/sid.h b/boop/audio/sid.h index e67980f..05833b5 100644 --- a/boop/audio/sid.h +++ b/boop/audio/sid.h @@ -101,12 +101,12 @@ struct SID_ { struct SID_ SID; -unsigned int playtone_cb; -unsigned char *playtone[3]; -unsigned char playstate; -unsigned char tonelen[3]; -unsigned short playcounter; -unsigned short playcountermax; +extern unsigned int playtone_cb; +extern unsigned char *playtone[3]; +extern unsigned char playstate; +extern unsigned char tonelen[3]; +extern unsigned short playcounter; +extern unsigned short playcountermax; void SIDsetfrq(unsigned char voice, unsigned short frq); void SIDsetadsr(unsigned char voice,unsigned char attack, unsigned char decay, unsigned char sustain, unsigned char release); diff --git a/boop/audio/sidfiles.h b/boop/audio/sidfiles.h index 0a4dccb..6f10dde 100644 --- a/boop/audio/sidfiles.h +++ b/boop/audio/sidfiles.h @@ -769,6 +769,7 @@ const unsigned char song1[] = { 0xa2,0x25,0x00,0x00,0x21,0x11,0x70,0xd2,0x0f,0x00,0x00,0x21,0x00,0x70, 0xa2,0x25,0x00,0x00,0x21,0x11,0x70,0xd2,0x0f,0x00,0x00,0x21,0x00,0x70, 0xa2,0x25,0x00,0x00,0x21,0x11,0x70,0xd2,0x0f,0x00,0x00,0x21,0x00,0x70, +/* 0x1f,0x15,0x00,0x00,0x21,0x11,0x70,0xc3,0x10,0x00,0x00,0x21,0x00,0x70, 0x1f,0x15,0x00,0x00,0x21,0x11,0x70,0xc3,0x10,0x00,0x00,0x21,0x00,0x70, 0x1f,0x15,0x00,0x00,0x21,0x11,0x70,0xc3,0x10,0x00,0x00,0x21,0x00,0x70, @@ -1001,4 +1002,5 @@ const unsigned char song1[] = { 0xc1,0x2c,0x00,0x00,0x21,0x11,0x70,0x31,0x1c,0x00,0x00,0x21,0x00,0x70, 0xc1,0x2c,0x00,0x00,0x21,0x11,0x70,0x31,0x1c,0x00,0x00,0x21,0x00,0x70, 0xc1,0x2c,0x00,0x00,0x21,0x11,0x70,0x31,0x1c,0x00,0x00,0x21,0x00,0x70 +*/ }; diff --git a/boop/audio/sound.c b/boop/audio/sound.c index 310ecbc..3eee98c 100644 --- a/boop/audio/sound.c +++ b/boop/audio/sound.c @@ -20,6 +20,7 @@ #include "sound.h" #include "soundirq.h" #include "lpc2220.h" +#include "pwm.h" #define AUTO_OFF_TIME 0x4000 @@ -37,7 +38,7 @@ unsigned char timeout; unsigned int auto_timeout; void startSoundIRQ(void) -{ +{/* timeout = 0; auto_timeout = 0; out1 = 0; @@ -57,6 +58,7 @@ void startSoundIRQ(void) //VICVectCntl0 = VIC_SLOT_EN | INT_SRC_PWM; VICIntSelect |= INT_PWM; VICIntEnable = INT_PWM; + */ } void initSound(void) @@ -67,12 +69,18 @@ void initSound(void) tval = 0; last_sample = 0; bl_val = 0x3F; + timeout = 0; + auto_timeout = 0; + out1 = 0; } void switchSound(unsigned char onoff) { if(onoff) { + + PWM_set_frequency(30864); + sound_shutdown = 0; PINSEL0 &= ~(3 << (2 * SND_PWM)); // IO PINSEL0 |= (2 << (2 * SND_PWM)); // PWM @@ -81,6 +89,7 @@ void switchSound(unsigned char onoff) FIODIR0 |= (1<