Add ld10k1 tool

Added ld10k1 tool by Peter Zubaj.
This commit is contained in:
Takashi Iwai 2005-03-18 13:40:44 +00:00
parent 37104ebf62
commit 2df1aa7c20
98 changed files with 19970 additions and 1 deletions

View file

@ -0,0 +1,18 @@
EXTRA_DIST = README emu_constants.asm \
simple.asm vol_master.asm tone.asm \
vol_2.asm output.asm switch_2.asm \
sto51.asm switch_6.asm copy_2.asm \
prologic.asm fxbus.asm
dist_effects_DATA = simple.emu10k1 vol_master.emu10k1 tone.emu10k1 \
vol_2.emu10k1 output.emu10k1 switch_2.emu10k1 \
sto51.emu10k1 switch_6.emu10k1 copy_2.emu10k1 \
prologic.emu10k1 fxbus.emu10k1
CLEANFILES = $(dist_effects_DATA)
SUFFIXEC = .asm .emu10k1
.asm.emu10k1:
as10k1 -o $@ $<

View file

@ -0,0 +1 @@
Most of files in this directory is taken from emu10k1 OSS driver see opensource.creative.com

View file

@ -0,0 +1,13 @@
;PZU
name "2-channel copy"
left IO
right IO
macs left,left,$40,$40
macs right,right,$40,$40
end

View file

@ -0,0 +1,151 @@
;some hardware constants C_[n]<DecimalValue>, 'n' indicates negative value
;
;these are in 2's complement representation
C_0 equ $040 ;;00000000
C_1 equ $041 ;;00000001
C_2 equ $042 ;;00000002
C_3 equ $043 ;;00000003
C_4 equ $044 ;;00000004
C_8 equ $045 ;;00000008
C_16 equ $046 ;;00000010
C_32 equ $047 ;;00000020
C_256 equ $048 ;;00000100
C_65536 equ $049 ;;00010000
C_2^23 equ $04A ;;00080000
C_2^28 equ $04b ;;10000000
C_2^29 equ $04c ;;20000000 (C_max /4) +1
C_2^30 equ $04d ;;40000000 ( C_max / 2 ) + 1 (almost half)
C_nmax equ $04e ;;80000000 most negative number
C_max equ $04f ;;7fffffff most positive number
C_n1 equ $050 ;;ffffffff -1
C_n2 equ $051 ;;fffffffe -2
C_n2^30 equ $052 ;;c0000000 C_nmax /2
C_LSshift equ $55 ;;to left shift an address by using macsints
;;for fractional addresses
ZERO equ C_0;
ONE equ C_1;
;;; Hardware Registers:
ACCUM equ $56
CCR equ $57
NOISE1 equ $58
NOISE2 equ $59
IRQ equ $5A
DBAC equ $5B
and macro dest,srcA,srcB
andxor dest,srcA,srcB,C_0
endm
xor macro dest,srcA,srcB
andxor dest,C_n1,srcA,srcB
endm
not macro dest,src
andxor dest,src,C_n1,C_n1
endm
nand macro dest,srcA,srcB
andxor dest,srcA,srcB,C_n1
endm
or macro dest,srcA,srcB
not C_0,srcA
andxor dest,ACCUM,srcA,srcB
endm
nor macro dest,srcA,scrB
not dest,srcA
andxor dest,srcB,dest,srcA
not dest,dest
endm
neg macro dest,src
macs1 dest,C_0,C_1,C_nmax
endm
;;; branch on:
;;; ==0
beq macro count
skip CCR,CCR,C_8,count
endm
;;; !=0
bne macro count
skip CCR,CCR,C_256,count
endm
;;; <0
blt macro count
skip CCR,CCR,C_4,count
endm
;;; <=0
ble macro count
C___1008 con $1008
skip CCR,CCR,C___1008,count
endm
;;; always branch
bra macro count
skip C_0,C_max,C_max,count
endm
;;; on saturation- for now - as10k1 can not handle more than 25 macros
;bsa macro count
; skip CCR,CCR,C_16,count
; endm
bge macro count
C___80 con $80
skip CCR,CCR,C___80,count
endm
bgt macro count
C___180 con $180
skip CCR,CCR,C___180,count
endm
move macro dest,src
macs dest,src,C_0,C_0
endm
fracmult macro dest, src1, src2
macs dest,$40, src1, src2
endm
intmult macro dest, src1, src2
macints dest, $40, src1, src2
endm
add macro dest, src1, src2
acc3 dest, $40, src1, src2
endm
;;; usefull for testing values before a skip
test macro test
macs C_0,test,C_0,C_0
endm
cmp macro src1,scr2
macints C_0,src1,C_n1,src2
endm
;----------------------------------------
; dest = src1 - src2
sub macro dest, src1, src2
macints dest, src1, src2, C_n1
endm
;----------------------------------------
; LowPassFilter
lpf macro yy, mm, xx
interp yy, yy, mm, xx
endm
;----------------------------------------
; HighPassFilter
hpf macro yy, ss, mm, xx
interp ss, ss, mm, xx
sub yy, xx, ss
endm
end

View file

@ -0,0 +1,30 @@
name "FXBUS"
include "emu_constants.asm"
;; From alsa driver pci/emu10k1/emufx.c _volume_add
pcm_l io
pcm_r io
pcm_lr io
pcm_rr io
midi_l io
midi_r io
pcm_c io
pcm_lf io
spdif_l io
spdif_r io
;; Process FX Buses
macints pcm_l, C_0, pcm_l, C_4
macints pcm_r, C_0, pcm_r, C_4
macints pcm_lr, C_0, pcm_lr, C_4
macints pcm_rr, C_0, pcm_rr, C_4
macints midi_l, C_0, midi_l, C_4
macints midi_r, C_0, midi_r, C_4
macints pcm_c, C_0, pcm_c, C_4
macints pcm_lf, C_0, pcm_lf, C_4
macints spdif_l, C_0, spdif_l, C_4
macints spdif_r, C_0, spdif_r, C_4
end

View file

@ -0,0 +1,61 @@
;PZU
;parts are taken from passthrough-audigy
name "Output patch"
include "emu_constants.asm"
;inputs - and analog outputs
Left IO
Right IO
LeftSurr IO
RightSurr IO
Center IO
LFE IO
; these are used for digital output
DLeft IO
DRight IO
DLeftSurr IO
DRightSurr IO
DCenter IO
DLFE IO
enableL control 0,0,1
enableR control 0,0,1
tmp_a dyn
tmp_b dyn
mask con $ffff0000
;simple copy to analog output
macs Left, Left, C_0, C_0
macs Right, Right, C_0, C_0
macs LeftSurr, LeftSurr, C_0, C_0
macs RightSurr, RightSurr, C_0, C_0
macs Center, Center, C_0, C_0
macs LFE, LFE, C_0, C_0
;
macs DLeft, Left, C_0, C_0
macs DRight, Right, C_0, C_0
macs C_0, enableL, C_0, C_0
beq .endL
macs tmp_a, DLeft, C_0, C_0
ble .next_a
acc3 tmp_a, C_0, C_65536, tmp_a
.next_a
and DLeft, tmp_a, mask
.endL
macs C_0, enableR, C_0, C_0
beq .end
macs tmp_b, DRight, C_0, C_0
ble .next_b
acc3 tmp_b, C_0, C_65536, tmp_b
.next_b
and DRight, tmp_b, mask
.end
macs DLeftSurr, LeftSurr, C_0, C_0
macs DRightSurr, RightSurr, C_0, C_0
macs DCenter, Center, C_0, C_0
macs DLFE, LFE, C_0, C_0
end

View file

@ -0,0 +1,115 @@
; Surround Active Matrix for Emu10k1
; Author: Robert Mazur <robertmazur@yahoo.com>
; Date: Jan 14, 2002
; Version 1.1
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;========================================
name "ProLogic"
include "emu_constants.asm"
;========================================
delline delay &0.02 ; 0.02 sec delay
write twrite delline,&0 ; write at 0 sec
read tread delline,&0.02 ; read at 0.02 sec
;----------------------------------------
ml con #0.575997 ; lpf 7000Hz
yl sta 0
mlp con #0.277015 ; lpf 2500Hz
mhp con #3.7076e-2 ; hpf 300Hz
ylp sta 0
shp sta 0
;----------------------------------------
Lt io ; Stereo Left In
Rt io ; Stereo Right In
L equ Lt ; Front Left Out
R equ Rt ; Front Right Out
Ls io
Rs io
C io ; Center
;----------------------------------------
tmp dyn
ll dyn
rr dyn
vcal sta #0.5
vcar sta #0.5
fl sta 0
fr sta 0
mf con #0.013 ; ~ 100Hz
;----------------------------------------
; abs(x)
tmp_abs dyn
abs macro ret, xx
sub tmp_abs, C_0, xx
limit ret, C_0, tmp_abs, xx
endm
;========================================
; Start
;========================================
;; Servo
fracmult ll, vcal, Lt ; ll = vcal * Lt
abs tmp, ll ; tmp = abs(ll)
lpf fl, mf, tmp ; fl = LowPass((n)Hz, tmp);
fracmult rr, vcar, Rt ; rr = vcar * Rt
abs tmp, rr ; tmp = abs(rr)
lpf fr, mf, tmp ; fr = LowPass((n)Hz, tmp);
intmult ll, C_2, ll ; vca0 = 0.5 so we must multiply 'll' and 'rr' by 2
intmult rr, C_2, rr
sub tmp, fr, fl ; serv = fr - fl
macints vcal, C_2^30, C_2, tmp ;vcal = vca0 + 2*serv
macints vcar, C_2^30, C_n2, tmp ;vcar = vca0 - 2*serv
;; Suround
sub tmp, ll, rr ; delay.in = L - R
lpf yl, ml, tmp ; yl = LowPass(7kHz, delay.out) = rear
; macs L, Lt, vcar, yl ; L = Lt - vcar * S Remove Surround from front speakers
; macs1 R, Rt, vcal, yl ; R = Rt + vcal * S
move write, yl ; delay surround
fracmult tmp, vcar, read ; Ls = 2 * vcar * rear ( 2* becouse vca0 = 0.5)
intmult Ls,C_2,tmp
fracmult tmp, vcal, read ; Rs = 2 * vcal * rear
intmult Rs,C_2,tmp
;; Center
add tmp, ll, rr ; tmp = L + R
hpf tmp, shp, mhp, tmp ; tmp = HighPass(300Hz, tmp)
lpf ylp, mlp, tmp ; ylp = LowPass(2.5kHz, tmp) = center
move C, ylp ; Center
sub R, Rt, read ; R = R - rear
sub L, Lt, read ; L = L - rear
end
;========================================

View file

@ -0,0 +1,39 @@
name "Simple 5.1 volume"
include "emu_constants.asm"
inl io
outl equ inl
inr io
outr equ inr
inrl io
outrl equ inrl
inrr io
outrr equ inrr
inc io
outc equ inc
inlfe io
outlfe equ inlfe
Left control 0,0,100
Right control 0,0,100
LeftSurr control 0,0,100
RightSurr control 0,0,100
Center control 0,0,100
LFE control 0,0,100
macs outl,C_0, Left, inl
macs outr,C_0, Right, inr
macs outc,C_0, Center, inc
macs outrl,C_0, LeftSurr, inrl
macs outrr,C_0, RightSurr, inrr
macs outlfe,C_0, LFE, inlfe
end

View file

@ -0,0 +1,60 @@
;PZU
name "Simple 5.1 for Wave"
include "emu_constants.asm"
inl io
outl equ inl
inr io
outr equ inr
inrl io
outrl equ inrl
inrr io
outrr equ inrr
inc io
outc equ inc
inlfe io
outlfe equ inlfe
Left control 0,0,100
Right control 0,0,100
LeftSurr control 0,0,100
RightSurr control 0,0,100
Center control 0,0,100
LFE control 0,0,100
tmp dyn
c40 con $40000000
tmpl dyn
tmpr dyn
;5.1 playback
macs tmpl, inl, C_0, C_0
macs tmpr, inr, C_0, C_0
; macs outl, inl.o, Left, tmpl
; macs outr, inr.o, Right, tmpr
; macs outrl, inrl.o, LeftSurr, tmpl
; macs outrr, inrr.o, RightSurr, tmpr
; interp tmp, tmpl, c40, tmpr
; macs outc, inc.o, Center, tmp
; macs outlfe, inlfe.o, LFE, tmp
macs outl, $40, Left, tmpl
macs outr, $40, Right, tmpr
macs outrl, $40, LeftSurr, tmpl
macs outrr, $40, RightSurr, tmpr
interp tmp, tmpl, c40, tmpr
macs outc, $40, Center, tmp
macs outlfe, $40, LFE, tmp
end

View file

@ -0,0 +1,21 @@
;PZU
name "Switch 2 - channel"
include "emu_constants.asm"
Left IO
Right IO
switchL control 0,0,1
switchR control 0,0,1
macints Left, C_0, Left, switchL
macints Right, C_0, Right, switchR
; macs C_0, switchL, C_0, C_0
; beq .left
; macs Left, Left, C_0, C_0
;.left
; macs C_0, switchR, C_0, C_0
; beq .end
; macs Right, Right, C_0, C_0
;.end
end

View file

@ -0,0 +1,29 @@
;PZU
name "Switch 6 - channel"
include "emu_constants.asm"
Left IO
Right IO
LeftSurr IO
RightSurr IO
Center IO
LFE IO
switch control 0,0,1
macints Left, C_0, Left, switch
macints Right, C_0, Right, switch
macints LeftSurr, C_0, LeftSurr, switch
macints RightSurr, C_0, RightSurr, switch
macints Center, C_0, Center, switch
macints LFE, C_0, LFE, switch
; macs C_0, switch, C_0, C_0
; beq .end
; macs Left, Left, C_0, C_0
; macs Right, Right, C_0, C_0
; macs LeftSurr, LeftSurr, C_0, C_0
; macs RightSurr, RightSurr, C_0, C_0
; macs Center, Center, C_0, C_0
; macs LFE, LFE, C_0, C_0
;.end
end

View file

@ -0,0 +1,110 @@
; stolen from alsa-driver
name "Tone - Bass, Treble"
include "emu_constants.asm"
inl io
toutl equ inl
inr io
toutr equ inr
inrl io
toutrl equ inrl
inrr io
toutrr equ inrr
inc io
toutc equ inc
inlfe io
toutlfe equ inlfe
; Tone Control - Bass
bass0 control 20, 0, 40
bass1 control 20, 0, 40
bass2 control 20, 0, 40
bass3 control 20, 0, 40
bass4 control 20, 0, 40
; Tone Control - Treble
treble0 control 20, 0, 40
treble1 control 20, 0, 40
treble2 control 20, 0, 40
treble3 control 20, 0, 40
treble4 control 20, 0, 40
; Tone Control - Switch
toneonoff control 0, 0, 1
; temporary
templb sta 0, 0, 0, 0, 0
templt sta 0, 0, 0, 0, 0
temprb sta 0, 0, 0, 0, 0
temprt sta 0, 0, 0, 0, 0
temprlb sta 0, 0, 0, 0, 0
temprlt sta 0, 0, 0, 0, 0
temprrb sta 0, 0, 0, 0, 0
temprrt sta 0, 0, 0, 0, 0
tempcb sta 0, 0, 0, 0, 0
tempct sta 0, 0, 0, 0, 0
outl dyn
outr dyn
outrl dyn
outrr dyn
outc dyn
outlfe dyn
tmp sta 0, 0
BT macro tempb, tempt, chn
macs C_0, C_0, chn, bass0
macmv tempb+1, tempb, tempb+1, bass2
macmv tempb, chn, tempb, bass1
macmv tempb+3, tempb+2, tempb+3, bass4
macs tempb+2, ACCUM, tempb+2, bass3
acc3 tempb+2, tempb+2, tempb+2, C_0
macs C_0, C_0, tempb+2, treble0
macmv tempt+1, tempt, tempt+1, treble2
macmv tempt, tempb+2, tempt, treble1
macmv tempt+3, tempt+2, tempt+3, treble4
macs tempt+2, ACCUM, tempt+2, treble3
macints tempt+2, C_0, tempt+ 2, C_16
acc3 chn, tempt+2, C_0, C_0
endm
SONOFF macro out, in
macints tmp, C_0, out, toneonoff
andxor tmp+1, toneonoff, C_1, C_1
macints tmp+1, C_0, in, tmp+1
acc3 out, tmp, tmp+1, C_0
endm
;Process tone control
macs outl, inl, C_0, C_0
macs outr, inr, C_0, C_0
macs outrl, inrl, C_0, C_0
macs outrr, inrr, C_0, C_0
macs outc, inc, C_0, C_0
macs outlfe, inlfe, C_0, C_0
BT templb, templt, outl
BT temprb, temprt, outr
BT temprlb, temprlt, outrl
BT temprrb, temprrt, outrr
BT tempcb, tempct, outc
SONOFF outl, inl
SONOFF outr, inr
SONOFF outrl, inrl
SONOFF outrr, inrr
SONOFF outc, inc
SONOFF outlfe, inlfe
macs toutl, outl, C_0, C_0
macs toutr, outr, C_0, C_0
macs toutrl, outrl, C_0, C_0
macs toutrr, outrr, C_0, C_0
macs toutc, outc, C_0, C_0
macs toutlfe, outlfe, C_0, C_0
end

View file

@ -0,0 +1,15 @@
name "2-channel Vol"
Left control 0,0,100
Right control 0,0,100
signal_l IO
signal_r IO
macs signal_l,$40,signal_l,Left
macs signal_r,$40,signal_r,Right
end

View file

@ -0,0 +1,23 @@
name "Master Vol"
VolM control 0,0,100
;VolM control 100,0,#1
left IO
right IO
rleft IO
rright IO
center IO
lfe IO
macs left.o,$40,left,VolM
macs right.o,$40,right,VolM
macs rleft.o,$40,rleft,VolM
macs rright.o,$40,rright,VolM
macs center.o,$40,center,VolM
macs lfe.o,$40,lfe,VolM
end