![]() |
![]() |
#1 |
Registered User
Join Date: Oct 2013
Location: Hamburg
Posts: 70
|
Audio: Re-triggering a note
Hey,
I'm writing a minimalist tracker playback routine. What would be the cheapest way to re-trigger a note that has not been fully played? From what I've read in the HRM, in order to stop and restart playback for a channel, its audio DMA flag has to be disabled long enough (two sampling periods) to prevent looping. I want to avoid setting up interrupts and have a VBR-wait main loop. Would it be too coarse (and sound bad) if I just disable audio DMA for a whole frame before the new note is triggered? Or is there an easier (cheap) way to achieve this? Thanks for any hints, losso |
![]() |
![]() |
#2 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,572
|
Quote:
Quote:
Quote:
|
|||
![]() |
![]() |
#3 |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,917
|
set pointer to null data? write null data to AUDxDAT? (instead stopping play, just play silence)?
|
![]() |
![]() |
#4 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,603
|
Writing to AUD pointers or data won't help (or any other audio register).
Agnus has already fetched next audio word (unless period is small enough) and audio pointer and length is only copied to internal registers when DMA starts or length becomes zero. There is no other ways than to wait (max 2xaudio period color clocks). Writing low value to period register after clearing DMA bit should lower max waiting time to 1xaudio period color clocks. (Period is reloaded after each 8-bit sample) |
![]() |
![]() |
#5 | |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,917
|
Quote:
Did i miss something? As i understand issue is that for restarting , if restarting time (ie DMA play -> some time -> DMA stop --retrig time--> DMA start) is less than period then sample can be restarted from last position (i.e. before DMA was stopped), if retrig time is longer than period then there is no way to restart sample from last position and sample playout will start from beginning. So looping is possible only by changing real pointer to sample data and this need to be controlled by software (CPU OR/AND Copper) - as stop DMA/start DMA in less two periods will not disturb audio continuity at all. |
|
![]() |
![]() |
#6 | |||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,603
|
Quote:
After period ends twice (both audio states, 2 and 3, have finished), state machine enter idle state: channel's output stays at whatever the last 8-bit sample was. Quote:
If DMA is turned on before audio state machine gets back to idle state (state 0), it continues like nothing happened. It technically changes to non-DMA mode and only condition out of non-DMA mode is: INTREQ bit must be set when state 3 period counting has finished. Writing or not writing to AUDxDAT does not matter! Quote:
|
|||
![]() |
![]() |
#7 |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,917
|
OK, sorry for that, yes it was not clear.
Generally fastest way to stop audio but make it responsive (stop play, start play) is to set sound that is long 1 word (2 samples), set sample value as zero, set period very high then audio DMA will start produce audio but there is no need to wait long time for 2xperiod as period is very short. So instead doing time consuming wait, kind of brute forced method can be used (with all remaining limitations). Probably is not clear still anyway... |
![]() |
![]() |
#8 | |
Registered User
Join Date: Jan 2012
Location: USA
Posts: 374
|
Quote:
How about turning DMA off, writing very small value to period, polling INTREQR, clear INTREQ, loading channel settings, and restarting DMA? Not sure it would work, though. Audio state diagram seems to be missing a few things. Diagram suggests that the state may transition from 011 to 010 only if (perfin*(AUDxON + ~(AUDxIP)), but action on transition says AUDxIR if napnav & ~(AUDxON). |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Best Audio Config in Winuae for a Creative X-Fi Audio Card | shaf | support.WinUAE | 2 | 14 June 2012 16:27 |
Triggering the WinUAE Debugger? | h0ffman | Coders. General | 2 | 03 June 2011 14:52 |
Triggering a Level 7 NMI Interrupt in WinUAE | psw | support.WinUAE | 2 | 07 December 2010 15:14 |
Things to note about WHD Dragon's Lair | MethodGit | project.WHDLoad | 18 | 18 April 2007 11:52 |
NOTE: You can't use DMS files with names longer than 18 characters! | andreas | support.WinUAE | 2 | 07 July 2002 02:22 |
|
|