Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Composing > change player speed externally
2019-10-14 23:01
Narciso

Registered: Mar 2019
Posts: 10
change player speed externally

Good night, I have a question.

In the goattracker editor, the F0X function is used to set the speed of the music player.

It is possible to change the speed of the goattracker player from an external machine code program. Does anyone know the memory address to alter that parameter

Thank you
2019-10-15 05:52
Karmic

Registered: Apr 2015
Posts: 66
Well, there is no one memory address. You have to dig into the code a bit to find the right one.

Hunt for this snippet:
jsr $xxxx
ldx #$07
jsr $xxxx
ldx #$0e
dec $xxxx,x
beq $xxxx
bpl $xxxx
lda $xxxx,x <- this instruction's operand is the tempo address
sta $xxxx,x

Note that since every channel has its own independent tempo counter, you will need to change that address, as well as the ones +7 and +$e.
2019-10-15 12:04
TheRyk

Registered: Mar 2009
Posts: 2244
another variant, probably I'm gonna be bashed for it as it's rather the mallet method (German: Holzhammermethode), set a counter to leave out (slow down) or have extra (speed up) JSR $PLAY in every so-and-so-many-eth frame. Thus, you can pitch up/down almost every tune very exactly.

Example
play
   jsr $1003; delete if you wanna slow down 
   dec counter+1
counter
   lda #07
   bne nothingspecial
   lda #$07; whatever value you like
   sta counter+1; reset counter for next round of counting
playcounterdependent
   jsr $1003; extra call every 7th frame
nothingspecial

Of course pitching up costs double raster time, whereas pitching down grants extra rastertime in frames when nothing is played.
2019-10-15 17:05
Zyron

Registered: Jan 2002
Posts: 2381
When it comes to using counters I find it really odd to decrease it before reading it, and that routine can be a bit shorter. ;)

    jsr $1003
cnt ldx #$07
    dex
    bne j1
    jsr $1003
    ldx #$07
j1  stx cnt+1
2019-10-16 03:38
Karmic

Registered: Apr 2015
Posts: 66
Keep in mind, the above mentioned method has the potential to sometimes fuck up hard-restart timings..... if you can't find the tempo address or absolutely need sub-frame tempo then it certainly is valid.
2019-10-17 22:51
Narciso

Registered: Mar 2019
Posts: 10
OK friends. Thanks for the answers. I will try the methods.

regards
2019-10-19 21:39
Oswald

Registered: Apr 2002
Posts: 5094
decreasing can also read it at the same time, plus better on zp, and not destroying any registers while skipping:

dec counter
bne skip
lda #$07
sta counter
jsr $1003
skip
2019-10-21 17:05
TheRyk

Registered: Mar 2009
Posts: 2244
Zyron wins! :)
I don't think that Karmic's concerns play a practical role apart from very few cases (if at all)
Oswald's got a point and might be right about accu and x/y regs but IF(!) those reg values matter, you normally move them on stack anyway before (PHA TXA PHA TYA PHA) and restore them from stack after (PLA TAY PLA TAX PLA). ZP regs are an option for counters however (be aware not to use ZP regs used by the .SID of course hehe)
2019-10-22 11:38
Frantic

Registered: Mar 2003
Posts: 1648
Another obvious type of strategy would be to call the player from a timer interrupt. A timer value of $4cc7 (if I remember correctly) corresponds to "once a frame", so other values than that would play the sid in a different speed. You would have quite precise control over the speed that way, and the calls to the player would be evenly spaced in time (in contrast to the counter method, that sometimes calls the player twice very quickly).

If a timer interrupt like that would be acceptable or not in your context I don't know..
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Didi/Laxity
Acidchild/Padua
Worrior1/Artline Des..
Dr. Doom/RAD
Sulevi/Virtual Dreams
DJ Gruby/TRiAD
Guests online: 88
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Party Elk 2  (9.6)
4 Cubic Dream  (9.6)
5 Copper Booze  (9.6)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Mutetus  (9.7)
3 Jeroen Tel  (9.7)
4 Linus  (9.6)
5 Stinsen  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.058 sec.