English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Releases

 
 
Thread Tools
Old 15 August 2012, 11:24   #1
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,003
Protracker player with support for external sound fx

Yesterday I uploaded my new protracker player from Sqrxz to Aminet:
http://aminet.net/mus/play/ptplayer.lha

This player is quite optimized and has some useful features for game
developers:

- Insert external sound effects into the replayed module.

- A fast master volume for the replayed music.

- No busy waiting. DMA and repeat pointers are set with timer interrupts.

- E8 command can be used as a trigger for your main program.


The sound fx system will always block the channel which would be free for the longest period. This has the effect that the replayed song is often not disturbed at all. Up to four sound fx can be played at the same time (which would block all four music channels for this period).

The master volume is always applied to the music, but does not affect external sound fx.
phx is offline  
AdSense AdSense  
Old 15 August 2012, 11:49   #2
Akira
Registered User

Akira's Avatar
 
Join Date: May 2001
Location: New York
Posts: 18,180
Awesome
Akira is offline  
Old 15 August 2012, 12:55   #3
SyX
Registered User

 
Join Date: Sep 2004
Location: Brasil
Age: 43
Posts: 127
AMAZING!!!
SyX is offline  
Old 10 October 2012, 10:31   #4
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,003
The player was updated on Aminet today. I fixed some minor bugs in the tone-portamento (3) and note-cut (EC) commands.
phx is offline  
Old 22 March 2014, 17:14   #5
losso
Registered User

losso's Avatar
 
Join Date: Oct 2013
Location: Hamburg
Posts: 42
Great stuff. Works like a charm, thanks a million!
losso is offline  
Old 13 May 2014, 22:07   #6
Foul
Registered User

Foul's Avatar
 
Join Date: Jun 2009
Location: Perigueux/France
Age: 43
Posts: 1,260
Send a message via ICQ to Foul Send a message via MSN to Foul Send a message via Skype™ to Foul
Unhappy

can't assemble : (Asm-Pro V1.18)

>a
Pass 1..
** Illegal Operator
101 near a4
>
Foul is offline  
Old 14 May 2014, 14:35   #7
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,003
From the ReadMe:
Code:
The source is tested with the vasm assembler, but should work with most
assemblers after minor modifications (e.g. NEAR directive). Static
variables are accessed using the Small Data model, with base register
in A4.
Perhaps I should release a more portable source without using the small data model, as many people seem to have problems with it. Sorry for that.

The "minor" modifications would include:
- remove "xref _LinkerDB" and "near a4"
- remove the two "lea _LinkerDB,a4"
- remove the "(a4)" in all base-relative addressing modes
- optionally rename or remove "section __MERGED,bss"

The resulting code will be bigger and slower, but it might assemble with AsmPro after after that.
phx is offline  
Old 14 May 2014, 16:00   #8
spud
Registered User

 
Join Date: May 2010
Location: London, UK
Posts: 206
I did more or less that to get it working with my devpac environment a while ago. It works a treat, but I didn't give any thought to the speed though - is it likely to be significantly slower?
spud is offline  
Old 14 May 2014, 18:48   #9
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,003
I didn't make any tests, but there are more than 130 base-relative instructions in the source, and some of them are executed multiple times in each frame. The difference to an absolute 32-bit addressing mode is 4 68000 cycles.

You can get some speed back by converting the read operations to PC-relative.
phx is offline  
Old 14 May 2014, 21:47   #10
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 705
or leave the a4 basereg in there, and explicitly subtract the base address label in the offsets..
hooverphonique is offline  
Old 15 May 2014, 10:51   #11
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,003
Or use the AsmPro/AsmOne BASEREG directive.
phx is offline  
Old 15 May 2014, 11:44   #12
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 5,567
I have adapted the source, it doesn't use "near" anymore which means it should be possible to assemble with all "standard" assemblers (for this reason I have not used "BASEREG" either). I have added "mt_var" (i.e. NEAR a4 has been replaced with lea mt_var,a4) and changed all a4 references accordingly. I haven't tested the replayer but at least it can be assembled with ASM-Pro now.

Last edited by StingRay; 20 May 2014 at 12:38.
StingRay is offline  
Old 15 May 2014, 14:00   #13
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 5,567
Following slight (untested!) optimisation could be done in the "mt_mastervol" routine:

Instead of

Code:
	lea	mt_MasterVolTabs(pc),a0
	add.w	d0,d0
	add.w	d0,d0
	move.l	(a0,d0.w),mt_MasterVolTab-mt_var(a4)
this could be done:
Code:
; stingray, since each volume table has a size of 65 bytes
; we simply multiply (optimised of course) by 65 to get the
; offset to the correct table

	lea	MasterVolTab0(pc),a0
	add.w	d0,a0
	lsl.w	#6,d0
	add.w	d0,a0
	move.l	a0,mt_MasterVolTab-mt_var(a4)
Saves one memory access and, much better, all the 65 pointers to the tables can be removed as well which means slightly shorter code, less RELOC32 data and less hassle to make the replayer 100% pc-relative.
StingRay is offline  
Old 15 May 2014, 14:02   #14
spud
Registered User

 
Join Date: May 2010
Location: London, UK
Posts: 206
I'll give that a whirl on devpac later with my current project. If saves a few cycles over my own version of this protracker player I'll gladly use it
spud is offline  
Old 19 May 2014, 11:06   #15
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,003
Quote:
Originally Posted by StingRay View Post
I have added "mt_var" (i.e. NEAR a4 has been replaced with lea mt_var,a4) and changed all a4 references accordingly.
The "lea mt_var,a4" is not part of any function there. To make it really work you would either have to initialize a4 before doing any mt_#? function call, or add the "lea" at the beginning of each exported function.

Also _LinkerDB has to be removed. The interrupts were still using it to initialize the small data base.

Quote:
Originally Posted by StingRay View Post
Saves one memory access and, much better, all the 65 pointers to the tables can be removed as well which means slightly shorter code, less RELOC32 data and less hassle to make the replayer 100% pc-relative.
Indeed, I missed that. Very good. I take it!

Last edited by TCD; 20 May 2014 at 14:21. Reason: Back-to-back posts merged
phx is offline  
Old 20 May 2014, 12:37   #16
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 5,567
Quote:
Originally Posted by phx View Post
The "lea mt_var,a4" is not part of any function there.
I know, saw it after I added the line of code there and didn't bother to remove it. As it is it's pretty much useless of course!

Quote:
Originally Posted by phx View Post
Also _LinkerDB has to be removed. The interrupts were still using it to initialize the small data base.
I missed the _LinkerDB in the interrupts, thanks for the hint.

I have adapted the source a bit more (all branches have distance specifiers now (.b wherever possible), above mentioned problems fixed, mt_mastervol optimised etc.) and also tested the replayer, it works fine for me!

I have added 2 options as well:

MT_NOBSS, this can be set to 0 or <0>, if it's not set to zero the BSS section for the variables will be removed, useful if one needs pc-relative code (the replayer isn't 100% pc-relative yet though)

MT_INITA4: if this is set to anything else than 0 all routines which require a4 to be initialised will contain an additional "lea mt_var,a4" line


Updated and working version of the source attached to this post, example how to call the replayer added too (check beginning of the source).


Quote:
Originally Posted by phx View Post
Indeed, I missed that. Very good. I take it!
Excellent.
Attached Files
File Type: s ptplayer_sting_OK.s (64.6 KB, 110 views)
StingRay is offline  
Old 21 May 2014, 22:21   #17
Coagulus
Gets there in the end...

Coagulus's Avatar
 
Join Date: Sep 2005
Location: Wales
Posts: 607
Might be a long shot but can anyone (or is it even possible to!) make a Blitzlib out of this?
Coagulus is offline  
Old 25 May 2014, 14:44   #18
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,003
I have no idea how a BlitzBasic library looks like. Maybe when I find some documentation about it.
phx is offline  
Old 27 May 2014, 22:36   #19
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,003
Quote:
Originally Posted by StingRay View Post
I have adapted the source a bit more (all branches have distance specifiers now (.b wherever possible), above mentioned problems fixed, mt_mastervol optimised etc.) and also tested the replayer, it works fine for me!
Thanks for that!

I plan to update the player on Aminet these days, as the version used in Solid Gold was improved a bit over the last Aminet release. For example mt_init allows to start a song at any position and you may optionally split your MOD (move samples to Chip RAM, keep the rest in Fast RAM).

I would also like to include an alternative version without small data, which assembles with Devpac and AsmOne/Pro. For that I used your modified source and merged it with the latest version.

You find it attached. I made some tests with it and it seems to work fine. I assembed it successfully with PhxAss, vasm, Devpac, AsmPro and snma.
Attached Files
File Type: lha ptplayer.lha (15.6 KB, 104 views)
phx is offline  
Old 29 May 2014, 01:02   #20
Galahad/FLT
Going nowhere

Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 44
Posts: 6,569
Quote:
Originally Posted by StingRay View Post
I know, saw it after I added the line of code there and didn't bother to remove it. As it is it's pretty much useless of course!



I missed the _LinkerDB in the interrupts, thanks for the hint.

I have adapted the source a bit more (all branches have distance specifiers now (.b wherever possible), above mentioned problems fixed, mt_mastervol optimised etc.) and also tested the replayer, it works fine for me!

I have added 2 options as well:

MT_NOBSS, this can be set to 0 or <0>, if it's not set to zero the BSS section for the variables will be removed, useful if one needs pc-relative code (the replayer isn't 100% pc-relative yet though)

MT_INITA4: if this is set to anything else than 0 all routines which require a4 to be initialised will contain an additional "lea mt_var,a4" line


Updated and working version of the source attached to this post, example how to call the replayer added too (check beginning of the source).




Excellent.
Thanks for doing this, assembles properly in Devpac now

However, not sure if its something i'm doing wrong, or if theres a problem with the routine, but i've tried two separate modules now, and after playing about 20 seconds or so, both stop playing using this routine.

Is it just me?
Galahad/FLT is offline  
AdSense AdSense  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
MOD-player with external sound effects phx Coders. Asm / Hardware 14 18 June 2012 11:41
Amiga Forever&Protracker bad sound moriez support.WinUAE 14 06 January 2009 02:26
What was the first Amiga tracker to support external midi instruments Kola Amiga scene 3 09 December 2008 20:20
Sound/Protracker package Dunny request.Apps 3 23 July 2008 20:17
Sampled sound player? cdoty Coders. General 7 25 August 2007 17:21

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 12:28.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.23464 seconds with 13 queries