24 October 2020, 12:09 | #61 |
Registered User
Join Date: Sep 2009
Location: Norway
Posts: 1,712
|
Ok, good to know.
Regarding having two mixer sets, well... I'd have to make sure that the integer sampling position wouldn't change inside the mixing loop (which is not guaranteed if delta is < 1), which requires some calculations before entering the loop. I want to keep the outer mix loop simple, don't want too much overhead in there. I already have a 32-bit division in there to figure out the max amount of samples to mix before eventually having to handle the sample end/loop end. |
24 October 2020, 12:48 | #62 | |
Registered User
Join Date: Dec 2014
Location: germany
Posts: 439
|
Quote:
EDIT: something like this, which is slower when delta > 1, but probably faster when samples are repeated: Code:
; d0.w = bytes to mix MIXSF MACRO move.w (a3,d2.l),d3 ; d3.w = 2x signed 8-bit samples move.b d3,d4 ext.w d4 asr.w #8,d3 sub.w d3,d4 ; d4.w = sample2-sample1 lsl.l #7,d4 nc: move.l d7,d5 rol.l #7,d5 or.w d4,d5 add.w (a6,d5.w*2),d3 move.w (a1,d3.w*2),d5 ; d5.w = left output sample (from volume LUT) swap d5 move.w (a4,d3.w*2),d5 ; d5.l = (leftSample << 16) | rightSample add.l d5,(a5)+ add.l d6,d7 ; increase sampling position bcc nc ; branch if carry clear = integer sampling position unchanged addx.l d1,d2 ENDM Last edited by chb; 24 October 2020 at 14:00. |
|
24 October 2020, 14:44 | #63 |
Registered User
Join Date: Sep 2009
Location: Norway
Posts: 1,712
|
Yeah, that could maybe help.
I think most songs will have an average sampling frequency above ~20kHz (28603.99(mixrate)*0.7), but it might still help for some songs. I'll try this when I get the time, on monday or so. |
24 October 2020, 15:20 | #64 | |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,024
|
Quote:
Simple you must/can try also this version: move.l d2,a3 move.b (a3),d3 move.b 1(a3),d7 If you want to reach maximum speed. Same for no swap command version. Last edited by Don_Adan; 24 October 2020 at 15:26. |
|
24 October 2020, 15:21 | #65 |
Registered User
Join Date: Sep 2009
Location: Norway
Posts: 1,712
|
Yes, that's what I was thinking of. Though you still have to ext.w both of them to calculate the delta sample (-256..254).
|
24 October 2020, 15:23 | #66 | |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,024
|
Quote:
|
|
24 October 2020, 15:26 | #67 |
Registered User
Join Date: Sep 2009
Location: Norway
Posts: 1,712
|
Hm yes, you are right. This will not work correctly because it will keep branching to nc until one integer of the sampling position has been reached (e.g. d0 counter is not respected until that has happened). Also this macro is unrolled 4 times inside the actual inner loop.
|
24 October 2020, 16:12 | #68 |
Registered User
Join Date: Dec 2014
Location: germany
Posts: 439
|
Yes, that's true. You'd either have the main loop set up accordingly (first do a number of iterations of the modified loop with the branch, then without), or just reserve 1/(sample read delta low) longwords at the end of the buffer, or check a5 against some end position during each iteration. Might be worth the hassle or not; probably depends how many bytes you typically mix. And how slow memory reads are compared to instructions, but those repeated samples come from the data cache anyway on 030+. Hmmm.
|
28 October 2020, 13:36 | #69 |
Registered User
Join Date: Sep 2009
Location: Norway
Posts: 1,712
|
I tried to move the two samples byte by byte instead of as a word, and it was slightly slower no matter what I did. I also tried to do a benchmark test on my A1200 68030 to figure out how much worse the speed was for a misaligned word read, and it seems to be a quite small speed penalty (if I did my tests right).
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Interpolation new Sound options | Paul | support.WinUAE | 10 | 17 March 2019 20:57 |
Artifacts from non-gamma-aware interpolation | mark_k | support.WinUAE | 5 | 08 January 2018 14:37 |
switch sound interpolation 4 chs | turrican3 | support.WinUAE | 1 | 14 February 2016 10:39 |
Non-linear retrogaming? | Nogg | Retrogaming General Discussion | 5 | 13 October 2007 17:09 |
is time linear | PaulS | request.Demos | 2 | 22 September 2002 12:37 |
|
|