English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. Releases (https://eab.abime.net/forumdisplay.php?f=115)
-   -   Protracker player with support for external sound fx (https://eab.abime.net/showthread.php?t=65430)

phx 15 August 2012 10:24

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.

Amiga1992 15 August 2012 10:49

Awesome

SyX 15 August 2012 11:55

AMAZING!!! :agree

phx 10 October 2012 09:31

The player was updated on Aminet today. I fixed some minor bugs in the tone-portamento (3) and note-cut (EC) commands.

losso 22 March 2014 16:14

Great stuff. Works like a charm, thanks a million!

Foul 13 May 2014 21:07

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

>a
Pass 1..
** Illegal Operator
101 near a4
>

phx 14 May 2014 13:35

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.

spud 14 May 2014 15:00

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?

phx 14 May 2014 17:48

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.

hooverphonique 14 May 2014 20:47

or leave the a4 basereg in there, and explicitly subtract the base address label in the offsets..

phx 15 May 2014 09:51

Or use the AsmPro/AsmOne BASEREG directive. :)

StingRay 15 May 2014 10:44

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. :)

StingRay 15 May 2014 13:00

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.

spud 15 May 2014 13:02

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 :)

phx 19 May 2014 10:06

Quote:

Originally Posted by StingRay (Post 954685)
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 (Post 954725)
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! :)

StingRay 20 May 2014 11:37

1 Attachment(s)
Quote:

Originally Posted by phx (Post 955277)
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 (Post 955277)
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 (Post 955278)
Indeed, I missed that. Very good. I take it! :)

Excellent. :)

Coagulus 21 May 2014 21:21

Might be a long shot but can anyone (or is it even possible to!) make a Blitzlib out of this? :bowdown

phx 25 May 2014 13:44

I have no idea how a BlitzBasic library looks like. Maybe when I find some documentation about it.

phx 27 May 2014 21:36

1 Attachment(s)
Quote:

Originally Posted by StingRay (Post 955411)
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.

Galahad/FLT 29 May 2014 00:02

Quote:

Originally Posted by StingRay (Post 955411)
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?


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

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.05743 seconds with 11 queries