15 July 2021, 06:45 | #1 |
Registered User
Join Date: Sep 2019
Location: Sydney
Posts: 357
|
Blitter affecting audio?
In my Turrican AGA conversion, I have an audio problem that I've not been able to understand.
In cases where the blitter use is very high (boss fights), and if a frame is dropped, the TFMX music will sometimes distort slightly. The music player uses interrupts for vertical blanks (level 3), Audio (level 4) and CIA timer (level 6). They all appear to be working and so I wouldn't expect anything could break the music even during a lost frame. In fact if I add an artificial delay to intentionally drop lots of frames, the music does continue to play without distortion. It is only when I add in large blits from the boss fights that the problem occurs. Is it possible that the blitter can cause an interrupt to be missed, or audio DMA slots to be lost? I didn't think that was the case, but I'm low on ideas. The only other thing done inside the interrupts of any significance is the audio mixer update inside the level 4 interrupt. I've tried disabling it, but no change. To be honest it is not a massive problem as I've mostly got the blitter usage in the boss fights to a manageable level, but it would still be nice to resolve the root cause. Any ideas would be greatly appreciated. |
15 July 2021, 09:31 | #2 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,410
|
The Blitter does not affect audio per se, but it can still be the reason for the issue you see.
If you run the Blitter in 'nasty' mode (BLTHOG) then you're locking out the CPU during blits (assuming copy & cookie cut blits here as they're the most common for games). This leads to faster blits, but it also can cause side effects. If an interrupt triggers during a blit, it will be delayed until the CPU gets access to the bus again (which will be after the blit is finished). In the case of mod player/music/audio interrupts, it's important that they're not delayed by too much, because you'll get audible glitches otherwise. So, if your blits are big enough, it is indeed possible to get to a point where the music related interrupts get delayed too much and you start hearing that. Note that the same also applies for other interrupts, such as the VBL. A potential solution would be to blit big objects in several smaller blits instead of as one very big blit. That way, there will be a smaller maximum delay until interrupts can trigger again, which should help resolve the problem. Incidentally, the reason why the audio mixer doesn't show this problem is because audio interrupts trigger so early that there is a lot of time for the mixer to catch up before issues become apparent. Last edited by roondar; 15 July 2021 at 10:37. |
15 July 2021, 13:46 | #3 |
Registered User
Join Date: Sep 2019
Location: Sydney
Posts: 357
|
Thanks Roondar. This makes sense. I only turn on blitter nasty at the end of a frame if there is blit work left to do. So I can see it could cause a vblank interrupt delay.
Boss blits are broken up into smaller bits but are still large for some bosses. I’ll have to think about this some more. Neither turning off nasty nor breaking up blits are particularly appealing at first glance. |
15 July 2021, 14:04 | #4 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,410
|
It's certainly possible that the VBlank might be pushed down that way. Thought of another 'trick' that might help. You could use the Copper to force the Blitter to non-nasty around the VBlank, so that the music interrupt always gets some time.
|
15 July 2021, 15:59 | #5 |
Registered User
Join Date: May 2018
Location: Ireland
Posts: 672
|
Doesnt the Turrican series generally have the large bosses as backgrounds that are scrolled and blits the actual background? , would that be possible? I havnt played PC Turrican 2 so dont know if it is or not.
|
16 July 2021, 04:23 | #6 | |
Registered User
Join Date: Sep 2019
Location: Sydney
Posts: 357
|
Quote:
This worked! If I clear blitter nasty at the very start of the copper list, this allows the vblank interrupt to be called and the music is free of distortion. It is certainly a more elegant solution than breaking up the blits, or turning off blitter nasty completely (which does have a significant impact on frame timings). Thanks for the help. |
|
16 July 2021, 04:30 | #7 | |
Registered User
Join Date: Sep 2019
Location: Sydney
Posts: 357
|
Quote:
On that note, is it possible to mask playfields in WinUAE? I thought you could do it with Mb 55 and MB aa, but doing this on original Turrican 2 does not give the results I would expect. I thought the lives and score must be done using dual playfield, as they don't appear to be hardware sprites, but masking the bitplanes does not separate them from the main playfield. |
|
16 July 2021, 04:49 | #8 |
Registered User
Join Date: Sep 2019
Location: Sydney
Posts: 357
|
Also AGA dual playfield is 16 colours x 2. The first boss alone in the PC version has 73 colours. So I'm unlikely to use dual playfield anywhere in the conversion.
|
16 July 2021, 10:20 | #9 | ||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,410
|
Quote:
Quote:
For T2 specifically, it could be possible that the lives/score are just blit on top instead of being on a separate playfield? |
||
16 July 2021, 14:02 | #10 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Quote:
Example: do you want to see what happens on bplane 3? -> Mb 4 More: do you want to 'disable' EHB bplane? -> Mb 1F |
|
17 July 2021, 10:24 | #11 | |
Registered User
Join Date: Sep 2019
Location: Sydney
Posts: 357
|
Quote:
I think they must be. It's just that they look like prime candidates for hardware sprites and I'm just surprised that an action heavy game didn't take the cheap route. |
|
17 July 2021, 12:36 | #12 |
Registered User
Join Date: Nov 2015
Location: Italy
Posts: 191
|
They also wasted memory by having 384 (320+32+32) pixel wide screen buffers (and probably 190+32+32 high). Even if tiles are 32x32 they could blit them as 16x16 and then use 304+16+16 wide buffers.
|
22 July 2021, 13:50 | #13 | |
Registered User
Join Date: Aug 2018
Location: Untergrund/Germany
Posts: 408
|
Quote:
I guess the additional width was chosen to get rid of clipping Bobs on X axis as it makes blitter setup much less complex. I used that approach for 'Tinyus' and 'Wrong Way Driver' too. |
|
23 July 2021, 00:06 | #14 |
Registered User
Join Date: Sep 2019
Location: Sydney
Posts: 357
|
I suppose it depends on whether you are trying to save blitter time or CPU time.
I clip to the visible borders of the screen to avoid any extra overdraw. For objects within the bounds of the screen there is a faster no-clip path for the blits. |
23 July 2021, 14:09 | #15 | |
Registered User
Join Date: Aug 2018
Location: Untergrund/Germany
Posts: 408
|
Quote:
Yeah, on A1200 i would always prefer to clip instead. Regardless A500 or A1200 it's a good optimization to never clip <=32 pixel wide Bobs because you usually have that space due to scrolling. |
|
23 July 2021, 14:22 | #16 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,410
|
I prefer to either not clip, or to only clip to the nearest 16 pixels (both horizontally or vertically). That way, the overhead for clipping is almost always worth the gain in cycles for not blitting that part of the object. To make that work, I need at least 16 pixels of extra space on all sides of the bitmap. But you normally need some space for scrolling anyway, so it's not such a big deal.
You still pay in cycles for testing if clipping needs to be done I suppose, but that's shouldn't be that many cycles to do (admittedly, I didn't time it). |
23 July 2021, 15:41 | #17 | |
Registered User
Join Date: Nov 2015
Location: Italy
Posts: 191
|
Quote:
Assuming 16x16 tiles, then for scrolling you only need 16 + 16 extra pixels. So for visible width of 320 pixels (max. 21 visible tiles) = 320 + 32 = 352. I don't think that's is enough space for unclipped 32 pixel wide bobs. |
|
23 July 2021, 15:47 | #18 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
|
23 July 2021, 15:57 | #19 | |
Registered User
Join Date: Nov 2015
Location: Italy
Posts: 191
|
Quote:
Really? Assuming a non scrolling at all screen with visible 320 pixels. Does it still need to be 320+16+16 internally for clipping to work? That would suck. Can't that be avoided some way by for example using descending blit mode for clipping at the left side. |
|
23 July 2021, 16:05 | #20 |
Registered User
Join Date: Nov 2015
Location: Italy
Posts: 191
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Immediate Blitter & Wait for Blitter... | volvo_0ne | support.WinUAE | 32 | 18 September 2022 09:52 |
wait for blitter vs immediate blitter | jotd | support.WinUAE | 1 | 08 September 2020 04:14 |
Audio adapters - cheapest way to add an audio input to my A1200? | Laika | support.Hardware | 10 | 21 February 2019 18:11 |
Blitter busy flag with blitter DMA off? | NorthWay | Coders. Asm / Hardware | 9 | 23 February 2014 21:05 |
increase 1 layer size without affecting the rest | turrican3 | support.WinUAE | 3 | 23 September 2013 01:01 |
|
|