Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user depeche ! (Registered 2019-11-18) You are not logged in 
CSDb User Forums


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

Registered: Mar 2019
Posts: 5
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: 43
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: 624
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: 2110
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: 43
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: 5
OK friends. Thanks for the answers. I will try the methods.

regards
2019-10-19 21:39
Oswald

Registered: Apr 2002
Posts: 4468
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: 624
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: 1385
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
JosteinBK
Facet/G★P
hedning/G★P
Mason/Unicess
Mythus/Delysid
Gunhed
Scarzix/Offence
Dymo/G★P
M-Forcer
Twilight/ExCeSs
aNdy/AL/Cosine
Knobby
Didi/Laxity
psych858o/MSL/Elysiu..
Guests online: 61
Top Demos
1 Uncensored  (9.7)
2 Unboxed  (9.7)
3 Edge of Disgrace  (9.7)
4 Coma Light 13  (9.7)
5 Comaland 100%  (9.6)
6 Lunatico  (9.6)
7 The Shores of Reflec..  (9.5)
8 Rivalry  (9.5)
9 C=Bit 18  (9.5)
10 X Marks the Spot  (9.5)
Top onefile Demos
1 Instinct  (9.6)
2 Sprite Font Compo Re..  (9.5)
3 The Tuneful Eight [u..  (9.5)
4 Dawnfall V1.1  (9.5)
5 Smile to the Sky  (9.5)
6 Space Demo  (9.5)
7 The Tuneful Eight (U..  (9.5)
8 Crystal Gazer  (9.5)
9 Je t'aime mon Monstre  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 PriorArt  (9.6)
2 Fossil  (9.5)
3 Oxyron  (9.5)
4 Booze Design  (9.4)
5 Arsenic  (9.4)
Top Webmasters
1 Perff  (9.6)
2 Morpheus  (9.6)
3 Slaygon  (9.5)
4 Sabbi  (9.2)
5 CreaMD  (9.2)

Home - Disclaimer
Copyright © No Name 2001-2019
Page generated in: 0.187 sec.