aboutsummaryrefslogtreecommitdiff
path: root/Source/Sfx.c
diff options
context:
space:
mode:
authorXaviDCR92 <xavi.dcr@gmail.com>2018-03-17 01:43:53 +0100
committerXaviDCR92 <xavi.dcr@gmail.com>2018-03-17 01:43:53 +0100
commit51d4c1ea89c7de9841d37505f9b780de70c696f2 (patch)
tree0b49df5082a68fef97903eb7b7d6b4921277a6cd /Source/Sfx.c
parentbe36d09ae70587f2ccb73906e895914421f336ff (diff)
downloadairport-51d4c1ea89c7de9841d37505f9b780de70c696f2.tar.gz
* System.c: Root counters are finally working, YAY!
* Sfx.c: SfxStopMusic() was relying on global timer to be increased under ISR, but this is not true anymore! * Other minor changes on EndAnimation.c.
Diffstat (limited to 'Source/Sfx.c')
-rw-r--r--Source/Sfx.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/Source/Sfx.c b/Source/Sfx.c
index 48d6bed..4e6d324 100644
--- a/Source/Sfx.c
+++ b/Source/Sfx.c
@@ -14,6 +14,7 @@
/* *************************************
* Local Prototypes
* *************************************/
+
/* *************************************
* Local Variables
* *************************************/
@@ -79,7 +80,13 @@ bool SfxUploadSound(char* file_path, SsVag * vag)
void SfxPlayTrack(MUSIC_TRACKS track)
{
#ifndef NO_CDDA
- SsCdVol(0x7FFF - SfxCddaVolumeReduction,0x7FFF - SfxCddaVolumeReduction);
+ enum
+ {
+ CD_MAX_VOLUME = (uint16_t)0x7FFF
+ };
+
+ SsCdVol(CD_MAX_VOLUME - SfxCddaVolumeReduction,
+ CD_MAX_VOLUME - SfxCddaVolumeReduction);
SsEnableCd();
CdPlayTrack(track);
Serial_printf("Track number %d playing...\n",track);
@@ -89,20 +96,14 @@ void SfxPlayTrack(MUSIC_TRACKS track)
void SfxStopMusic(void)
{
#ifndef NO_CDDA
- uint64_t timer = SystemGetGlobalTimer();
uint16_t CDVol = 0x7FFF;
- uint8_t time_step = 5;
- while (CDVol > 0x3F)
+ while (CDVol > 0x003F)
{
- CDVol>>=1;
- SsCdVol(CDVol,CDVol);
-
- while (SystemGetGlobalTimer() < (timer + time_step) );
-
- timer = SystemGetGlobalTimer();
+ CDVol >>= 1;
+ SsCdVol(CDVol, CDVol);
}
CdSendCommand(CdlMute,0);
-#endif
+#endif // NO_CDDA
}