English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 03 August 2020, 16:50   #1
KONEY
OctaMED Music Composer

KONEY's Avatar
 
Join Date: Jan 2009
Location: Venice - Italy
Age: 46
Posts: 443
PT player: best way to track song position in P6112

I'm still in the process of learning ASM and make my first Amiga intro.

At this point I successfully managed to playback my music with P6112 routine and also managed to attach my own effects to channels via the values contained in P61_visuctr* constants.

Now I'd like to trigger events at a given song position, possibly block played or something else. I could write my own frame counter and keep track of elapsed time in a variable but I'm pretty sure there's a best practice out there to know song position. The constant P61_rowpos seems like a good one but it's not clear what is recorded there (I guess tracker rows but still have to make tests)

So I'm hoping to get some guidance on what's the best method I should follow or any other information or suggestion would be appreciated.

Thanks!
KONEY is offline  
Old 03 August 2020, 23:11   #2
buzzybee
Registered User

 
Join Date: Oct 2015
Location: Landsberg / Germany
Posts: 390
I am using Protracker V2.3B for playback ... reading the current position of the song goes like this:

Code:
    lea	mt_chan1(pc),a4
    move.b mt_SongPos-mt_chan1(a4),storeSongPos ; save current song pos
    move.b	mt_Speed-mt_chan1(a4),storeSongSpeed
buzzybee is offline  
Old 03 August 2020, 23:50   #3
Antiriad_UK
OCS forever!

Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 265
I've not tried it myself, but I believe you can scatter E8x commands in your module and then read the last value in P61_PTrig in p6112. Should be able to use that for triggers. There's some notes about that in the replayer but not looked more into it than that.
Antiriad_UK is offline  
Old 04 August 2020, 00:02   #4
buzzybee
Registered User

 
Join Date: Oct 2015
Location: Landsberg / Germany
Posts: 390
You might also want to modify the original source code of the player. Try to find this piece:

Code:
song_step
	move.w	mt_PBreakPos-mt_chan1(a4),mt_PatternPos-mt_chan1(a4)
	move.w	d7,mt_PBreakPos-mt_chan1(a4)
	move.b	d7,mt_PosJumpFlag-mt_chan1(a4)
... then insert a piece like this:

Code:
    tst.b AudioRythmFlagAnim(pc)
    bne .2
    moveq #$3f,d0
    move.b d0,AudioRythmFlagAnim
.2
This way you will reset AudioRythmFlagAnim (to $3f in this case) each song step.
buzzybee is offline  
Old 04 August 2020, 00:04   #5
buzzybee
Registered User

 
Join Date: Oct 2015
Location: Landsberg / Germany
Posts: 390
Quote:
Originally Posted by Antiriad_UK View Post
I've not tried it myself, but I believe you can scatter E8x commands in your module and then read the last value in P61_PTrig in p6112. Should be able to use that for triggers. There's some notes about that in the replayer but not looked more into it than that.
Exactly. From the documentation of Pro Tracker V2.3B player:

; mt_E8Trigger
; This byte reflects the value of the last E8 command.
; It is reset to 0 after mt_init().

That´s how I sync some animation of some objects in RESHOOT R to the music.
buzzybee is offline  
Old 04 August 2020, 09:15   #6
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 47
Posts: 3,925
Quote:
Originally Posted by buzzybee View Post
Code:
    tst.b AudioRythmFlagAnim(pc)
    bne .2
    moveq #$3f,d0
    move.b d0,AudioRythmFlagAnim
.2
Probably me being a little pedantic here, but you can do that without altering a register :
Code:
    tst.b AudioRythmFlagAnim(pc)
    bne .2
    move.b #$3f,AudioRythmFlagAnim
.2
meynaf is offline  
Old 04 August 2020, 10:51   #7
KONEY
OctaMED Music Composer

KONEY's Avatar
 
Join Date: Jan 2009
Location: Venice - Italy
Age: 46
Posts: 443
as a total noob I'm a bit confused, does this somehow apply to P6112 as well?

Quote:
Originally Posted by buzzybee View Post
I am using Protracker V2.3B for playback ... reading the current position of the song goes like this:

Code:
    lea	mt_chan1(pc),a4
    move.b mt_SongPos-mt_chan1(a4),storeSongPos ; save current song pos
    move.b	mt_Speed-mt_chan1(a4),storeSongSpeed
KONEY is offline  
Old 04 August 2020, 10:57   #8
buzzybee
Registered User

 
Join Date: Oct 2015
Location: Landsberg / Germany
Posts: 390
Quote:
Originally Posted by KONEY View Post
as a total noob I'm a bit confused, does this somehow apply to P6112 as well?
I have never worked with P6112, but as far as I am aware both playback routines are based on the same structure. So if you read the documentation you should find a variable with comparable name like mt_SongPos, which has the same purpose.
buzzybee is offline  
Old 04 August 2020, 13:09   #9
Antiriad_UK
OCS forever!

Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 265
Quote:
Originally Posted by buzzybee View Post
I have never worked with P6112, but as far as I am aware both playback routines are based on the same structure. So if you read the documentation you should find a variable with comparable name like mt_SongPos, which has the same purpose.
It's P61_Pos.
Antiriad_UK is offline  
Old 04 August 2020, 13:21   #10
morbid
Registered User

 
Join Date: Aug 2020
Location: Huddinge
Posts: 2
The easiest way to get started with music sync and The Player is to add E8x commands to your Protracker module, and then in your code read the value of the variable P61_E8. It will contain the value of the last E8x command.

You may want to clear P61_E8 after you have read it.

If you really want to check song position you can have a look at P61_Pos, P61_Patt and P61_CRow.
morbid is offline  
Old 04 August 2020, 14:22   #11
KONEY
OctaMED Music Composer

KONEY's Avatar
 
Join Date: Jan 2009
Location: Venice - Italy
Age: 46
Posts: 443
This is what I was looking for, it works! Thanks!

Quote:
Originally Posted by Antiriad_UK View Post
It's P61_Pos.
KONEY is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
BZR Player - a new music player for Win bLAZER Retrogaming General Discussion 972 18 August 2020 08:49
Stack position and size hop Coders. Asm / Hardware 2 26 May 2019 18:20
Remeber directory position plasmatron request.UAE Wishlist 4 07 October 2010 22:42
FAT Player MikMod v5 (amiga mod player for Nintendo DS) spajdr Amiga scene 0 14 August 2008 21:55
Saving position ? Another World support.Games 1 28 April 2007 00:32

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:38.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.07715 seconds with 14 queries