What is Arkos Tracker? › Forums › Arkos Tracker forum › General discussion › Music fade out
- This topic has 3 replies, 2 voices, and was last updated 3 years, 6 months ago by thegeps.
-
AuthorPosts
-
May 21, 2021 at 4:50 pm #30510thegepsParticipant
I need to fade a song before stop it. Time ago you wrote me this:
“As for the fade out itself, simply decrease the volume from 0 to 16 (move from one value to another after a few frames, it will sound smoother), with a threshold detection:
ld a,(PLY_AKG_PSGReg8) ;Then 9 and 10.
sub 1
jr nc, NoDeb
xor a
NoDeb ld (PLY_AKG_PSGReg8),a
Do that before the call to PLY_AKG_SendPSGRegisters is done, it will be simpler (warning, this method needs A, so save it first if you modify it).”
well, I found
PLY_AKG_PSGREG8
and
PLY_AKG_PSGREG10
but no reg9 variable?
and by “Do that before the call to PLY_AKG_SendPSGRegisters is done” you mean that I have to put some code inside your player? O_o (like putting there a variable check and call the regs decrease before that calling?)
May 21, 2021 at 10:25 pm #30511TarghanKeymasterYes, you have to modify the player. I may add this as a build-in feature in a next version (with a conditional flag, most people don’t want to use this).
I guess you’re using the ROM player? Check the PLY_AKG_PSGReg9_10_Instr label… But even in this case the PLY_AKG_PSGReg9 is present, from what I read.
May 22, 2021 at 6:47 am #30512thegepsParticipantYep, I’m using the ROM player. There isn’t the reg9 label…
The 9_10instr is there, and I saw that is used to stop the song by resetting bot H and L and then doingLd (ply_akg_psgreg9_10instr),hl
So, how can I use that? L byte is for reg9 and H byte for reg10?
May 24, 2021 at 3:49 pm #30514thegepsParticipantok, I’m actually doing this, and it works.
Not the best or most elegant solution but I’m fine with it.First of all I’ve set two variables
mfade: equ 0e7f1h
volume equ 0e7f2hmfade is a flag: 1-do a fade, 0-play as usual
in the ROM player I’ve done this mod, just after the ply_akg_sendpsgregisters label
;original code
PLY_AKG_SENDPSGREGISTERS
push af
ld a,(mfade)
or a
call nz,fade_music
pop af
;original codein my source I have the routine to be called:
fade_music:
ld a,(volume)
ld (PLY_AKG_PSGREG8),a
ld (PLY_AKG_PSGREG9_10_INSTR),a
ld (PLY_AKG_PSGREG9_10_INSTR+1),a
retand this piece of code where I need to have the fade out:
ld a,11 ;this set start volume value
ld (volume),a
ld a,1 ;set the fade flag
ld (mfade),a
volume_fading:
ld b,25
call wait ;wait is a routine synched with vblank that wait b vlaue * 1/50th. so, before decreasing the volume by 1, half sec will pass
ld a,(volume)
dec a
ld (volume),a
jp nz,volume_fading
ld b,25
call wait ; wait another half sec after the fade out is completed
xor a
ld (mfade),a ;remove the fade flag
call PLY_AKG_STOP ;and stop the music -
AuthorPosts
- You must be logged in to reply to this topic.