![]() |
![]() |
#101 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,541
|
Quote:
Quote:
An easier workaround for you may be not to use one channel for music at all and start your repeating samples there. Quote:
|
|||
![]() |
![]() |
#102 | ||
Mostly Harmless
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,149
|
Quote:
I had most (all?) of the OS-side already, and I'd hoped to work on hooking it up to the player this week, but there are so many other things to do... ![]() Quote:
I had a repeat count in the sfx structure, which could also be -1 for infinite. I used the infinite repeat for background effects like wind or an engine noise. Your idea of locking out a channel for these effects might be workable ... though I only use them rarely. |
||
![]() |
![]() |
#103 |
Mostly Harmless
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,149
|
I actually have a version that works with OS-allocated audio channels and CIA-B interrupts now. Super untidy yet
![]() TLDR: Use AddICRVector to set up a Timer A and Timer B interrupt on CIA-B. Have the TA interrupt server call mt_TimerAInt Have the TB interrupt server call whatever ptplayer has stored in the address pointed to by mt_Lev6Int Comment out various bits of ptplayer related to manual setting of level 6 interrupt things Change rte to rts Question: in the interrupt handlers there is a nop before the rte. What's that for? |
![]() |
![]() |
#104 | |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,016
|
Quote:
|
|
![]() |
![]() |
#105 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,541
|
Quote:
Exactly. |
|
![]() |
![]() |
#106 |
Mostly Harmless
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,149
|
Ah I've just posted my modified 5.3 version here
![]() https://gist.github.com/johngirvin/8...e2f439bb074e95 But I'd be interested in the latest code. Does it have other improvements? |
![]() |
![]() |
#107 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,541
|
Quote:
From the Readme: Code:
- Fixed sign-bug in tremolo/vibrato command 7xx (Antiriad/EAB). - New function _mt_samplevol may be used to redefine a sample's volume. - _mt_playfx now returns a pointer to the selected channel status structure when the sample was scheduled for playing and returns NULL when ignored. - Wait 576 ticks for audio DMA instead of 496, which fixes issues with low notes on a few A1200 configurations. (No, this doesn't harm the player's performance, as it is a timer interrupt.) - Defining the symbol MINIMAL lets you assemble a minimal version of the player, without the ability to insert sound effects and without master-volume or changing samples volumes. - Improved interrupt handling, following a suggestion of Ross/EAB. - Minor optimizations. |
|
![]() |
![]() |
#108 |
Mostly Harmless
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,149
|
Updated the gist to 5.4 beta
![]() This isn't a "clean" version that could be released as it has some changes specific to my game and modifications to the player code. It would probably take another IFD symbol to control making the regular or "os-friendlier" version. Things to look at: - removed SDATA feature - changed rte to rts - removed clearing of EXTERN bit in INTREQ - mt_Delay, mt_MasterVol, mt_MasterFade - fiddled with the TB interrupt routine |
![]() |
![]() |
#109 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,541
|
ptplayer 6.0 release
I have finally released a new version. It took so long because we have currently no new game in a state to easily test all modifications ourselves. So thanks to all the beta testers!
The latest bug fix, not included in the 5.4beta, finally makes _mt_musicmask work as expected. You can download the release from Aminet: http://aminet.net/mus/play/ptplayer.lha Full list of changes: Code:
- _mt_musicmask works as documented now! Sound effects will never play on the masked channels. Previously it was rather a hint not to use them. - Fixed sign-bug in tremolo/vibrato command 7xx (Antiriad/EAB). - New function _mt_samplevol may be used to redefine a sample's volume. - _mt_playfx now returns a pointer to the selected channel status structure when the sample was scheduled for playing and returns NULL when ignored. - Wait 576 ticks for audio DMA instead of 496, which fixes issues with low notes on a few A1200 configurations. (No, this doesn't harm the player's performance, as it is a timer interrupt.) - Defining the symbol MINIMAL lets you assemble a minimal version of the player, without the ability to insert sound effects and without master-volume or changing samples volumes. - Improved interrupt handling, following a suggestion of Ross/EAB. - Minor optimizations. |
![]() |
![]() |
#110 |
Registered User
Join Date: Apr 2020
Location: Melbourne / Australia
Posts: 23
|
Firstly a big thank you for all the work that has gone into this player and for sharing it with the community ! It is much appreciated. Whilst reviewing the code, was wondering whether line 295 of ptplayer.asm is correct
move.w d0,INTREQ(a0) ; should this be a6 instead of a0 ? |
![]() |
![]() |
#111 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,369
|
this package is a lifesaver. I was considering replacing the music OR sfx games player by that one (if memory allowed to) in whdload. Would be a cool project. Premiere or Wonderdog would be good candidates.
|
![]() |
![]() |
#112 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,541
|
Quote:
BTW, due to popular request I added the functions mt_loopfx() and mt_stopfx() to play endless, looped sound effects. Here are the changes of the 6.1beta, which may be released soon: Quote:
|
||
![]() |
![]() |
#113 | |
Registered User
Join Date: Apr 2020
Location: Melbourne / Australia
Posts: 23
|
Quote:
No worries, I'm probably one of the few trying to use the code in a semi OS friendly way by returning back to the OS CLI after my program is done. Thx for the link to the beta, I'll definitely have a look. |
|
![]() |
![]() |
#114 |
Registered User
Join Date: Aug 2008
Location: Salisbury
Posts: 768
|
Hey Phx
I've got a slightly weird issue with the sound effects engine which is obviously down to my use case but wondered if you had any thoughts on how I can fix it. My game has a dynamic sound buffer meaning when you enter each room, the sound effects for that room are unpacked into a buffer in chip ram. The issue is that the sound engine is leaving the dma running at the previous sound effects volume so when the buffer is refilled for the next room it ends playing a high pitch noise. I updated to 6.1 beta in the hope that calling _mt_stopfx for all 4 channels would prevent this from happening but it seems that the engine detects that the sample has ended so doesn't turn it off. If music was playing (which it will be eventually) then it'll probably not be as much of a problem, but would like to see if I can get this resolved anyway. Was thinking one way would be to load the pointer / repeat after the DMA has kicked off to be a dedicated clean word in chipram. That way, when the sample finishes it'll be outside of the dynamic buffer. I had a look at implementing this myself but it looks like as though the loading of the hardware registers is somewhat intertwined with the protracker playback engine? Any thoughts would be greatly appreciated. |
![]() |
![]() |
#115 |
Registered User
Join Date: Aug 2008
Location: Salisbury
Posts: 768
|
OK, maybe ignore me, think I found and patched it although it might need a little more work to patch looped samples back in.
|
![]() |
![]() |
#116 | ||||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,541
|
Quote:
Quote:
Quote:
Quote:
Anyway, if I understand your problem correctly, the simplest solution would be to call _mt_end, before changing your dynamic buffer. It disables all Audio DMA and sets all volumes to zero. Otherwise, I could imagine an option in the player, which defines that you can guarantee the word at $0 being cleared. You may try the following patch and assemble with NULL_IS_CLEARED=1: Code:
Index: ptplayer.asm =================================================================== RCS file: /usr/src/cvs/ptplayer/ptplayer.asm,v retrieving revision 1.35 diff -u -r1.35 ptplayer.asm --- ptplayer.asm 5 Jan 2021 10:12:43 -0000 1.35 +++ ptplayer.asm 12 Feb 2021 14:00:50 -0000 @@ -138,6 +138,12 @@ ENABLE_SAWRECT equ 1 endc +; Set this if you can guarantee that the word at $0 is cleared and if +; you want to use if for idle-looping of samples. + ifnd NULL_IS_CLEARED +NULL_IS_CLEARED equ 0 + endc + ; Delay in CIA-ticks, which guarantees that at least one Audio-DMA ; took place, even with the lowest periods. ; 496 should be the correct value. But there are some A1200 which @@ -1005,13 +1011,18 @@ beq .1 ; no sfx playing anyway moveq #1,d0 move.b d0,n_sfxpri(a0) - move.w d0,n_sfxlen(a0) ; idle loop at sample-start + move.w d0,n_sfxlen(a0) ; idle loop move.w #108,n_sfxper(a0) ; enter idle as quickly as possible clr.w n_sfxvol(a0) ; and cut volume + ifne NULL_IS_CLEARED + clr.b n_looped(a0) + clr.l n_sfxptr(a0) ; use $0 for idle-looping + else tst.b n_looped(a0) beq .1 clr.b n_looped(a0) subq.l #2,n_sfxptr(a0) ; idle loop at sample-start - 2 + endc .1: move.w #$c000,INTENA(a6) rts @@ -1344,6 +1355,9 @@ move.l a0,AUDLC(a5) move.w d0,AUDLEN(a5) moveq #1,d0 ; idles after playing once + ifne NULL_IS_CLEARED + sub.l a0,a0 + endc ; save repeat and period for TimerB interrupt .2: move.l a0,n_loopstart(a2) @@ -1509,8 +1523,12 @@ move.w (a0)+,d0 ; length bne .4 + ifne NULL_IS_CLEARED + moveq #0,d2 ; use $0 for empty samples + else ; use the first two bytes from the first sample for empty samples move.l mt_SampleStarts(a4),d2 + endc addq.w #1,d0 .4: move.l d2,n_start(a2) @@ -1538,7 +1556,6 @@ add.l d3,d2 add.l d3,d2 move.w (a0),d0 -; beq idle_looping ; @@@ shouldn't happen, d0=n_length!? move.w d0,n_replen(a2) exg d0,d3 ; n_replen to d3 add.w d3,d0 @@ -1552,11 +1569,16 @@ no_offset: move.w (a0),d3 + ifne NULL_IS_CLEARED + cmp.w #1,d3 + beq .1 + bhi set_replen + else bne set_replen -idle_looping: + endc ; repeat length zero means idle-looping - moveq #0,d2 ; FIXME: expect two zero bytes at $0 addq.w #1,d3 +.1: moveq #0,d2 ; expect two zero bytes at $0 set_replen: move.w d3,n_replen(a2) set_len_start: |
||||
![]() |
![]() |
#117 |
Registered User
Join Date: Aug 2008
Location: Salisbury
Posts: 768
|
Thanks for the reply PHX. So the solution I came up with was to have a dedicated word in chip ram for the idle. If the sfx being played is a single shot, then it loads this pointer instead of the sample pointer meaning when the sfx ends, I'm in a safe area of chip ram which wont get overwritten when my buffer gets refilled on a room change. All my high pitch noise is now gone.
Code:
; save repeat and period for TimerB interrupt .2: move.l a0,n_loopstart(a2) cmp.b #1,d0 bne .3 move.l #NullSample,n_loopstart(a2) .3: move.w d0,n_replen(a2) move.w n_sfxper(a2),d0 move.w d0,AUDPER(a5) move.w d0,n_period(a2) move.w n_sfxvol(a2),AUDVOL(a5) |
![]() |
![]() |
#118 |
Registered User
Join Date: Aug 2008
Location: Salisbury
Posts: 768
|
and I've just spotted a potential bug here.
should be .. Code:
cmp.w #1,d0 |
![]() |
![]() |
#119 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,541
|
Yes, your solution will work, as long as you only care about one-shot effects.
I just hoped somebody would test the general solution for your problem (my patch above), so I can check that in for the next release. ![]() |
![]() |
![]() |
#120 |
Registered User
Join Date: Aug 2008
Location: Salisbury
Posts: 768
|
Hey PHX, I see, so you're doing kinda the same thing except but using address $0 as the clear word.
Looped samples were dealt with still as I tell it to stop playing sfx on all four channels before a room change. Anyways, I'll grab your latest beta and give it a try. One thing I have noticed is the master volume doesn't appear to be effecting samples which are already playing. I have a short fade which occurs when soundtracks are switched and the looped samples being played by the mod are not reducing until another sample is played. Is that how it currently works, i.e. master volume doesn't come into effect until a sample is triggered? |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
MOD-player with external sound effects | phx | Coders. Asm / Hardware | 14 | 18 June 2012 10:41 |
Amiga Forever&Protracker bad sound | moriez | support.WinUAE | 14 | 06 January 2009 01:26 |
What was the first Amiga tracker to support external midi instruments | Kola | Amiga scene | 3 | 09 December 2008 19:20 |
Sound/Protracker package | Dunny | request.Apps | 3 | 23 July 2008 19:17 |
Sampled sound player? | cdoty | Coders. General | 7 | 25 August 2007 16:21 |
|
|