Minor fixes
This commit is contained in:
parent
42a431c8b2
commit
416f5043b5
2 changed files with 20 additions and 18 deletions
|
@ -60,7 +60,7 @@ function ISM_RectangularRoom_core(
|
||||||
tx::SVector{3, T}, # transmitter position
|
tx::SVector{3, T}, # transmitter position
|
||||||
rx::SVector{3, T}, # reveiver position
|
rx::SVector{3, T}, # reveiver position
|
||||||
B::SMatrix{3, 3, T}, # receiver orientation
|
B::SMatrix{3, 3, T}, # receiver orientation
|
||||||
dp::DirectivityPattern, # Receiver directivity pattern
|
dp::AbstractDirectivityPattern, # Receiver directivity pattern
|
||||||
L::Tuple{T, T, T}, # room size (Lx, Ly, Lz)
|
L::Tuple{T, T, T}, # room size (Lx, Ly, Lz)
|
||||||
β::Tuple{T, T, T, T, T, T}, # Reflection coefficients (βx1, βx2, βy1, βy2, βz1, βz2)
|
β::Tuple{T, T, T, T, T, T}, # Reflection coefficients (βx1, βx2, βy1, βy2, βz1, βz2)
|
||||||
c::T, # velocity of the wave
|
c::T, # velocity of the wave
|
||||||
|
@ -103,7 +103,7 @@ function ISM_RectangularRoom_core!(
|
||||||
tx::SVector{3, T}, # transmitter position
|
tx::SVector{3, T}, # transmitter position
|
||||||
rx::SVector{3, T}, # reveiver position
|
rx::SVector{3, T}, # reveiver position
|
||||||
B::SMatrix{3, 3, T}, # receiver orientation
|
B::SMatrix{3, 3, T}, # receiver orientation
|
||||||
dp::DirectivityPattern, # Receiver directivity pattern
|
dp::AbstractDirectivityPattern, # Receiver directivity pattern
|
||||||
L::Tuple{T, T, T}, # room size (Lx, Ly, Lz)
|
L::Tuple{T, T, T}, # room size (Lx, Ly, Lz)
|
||||||
β::Tuple{T, T, T, T, T, T}, # Reflection coefficients (βx1, βx2, βy1, βy2, βz1, βz2)
|
β::Tuple{T, T, T, T, T, T}, # Reflection coefficients (βx1, βx2, βy1, βy2, βz1, βz2)
|
||||||
c::T, # velocity of the wave
|
c::T, # velocity of the wave
|
||||||
|
|
28
src/types.jl
28
src/types.jl
|
@ -12,12 +12,12 @@ export RIRConfig, ISMConfig
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
abstract type DirectivityPattern end
|
abstract type AbstractDirectivityPattern end
|
||||||
struct OmnidirectionalPattern <: DirectivityPattern end
|
struct OmnidirectionalPattern <: AbstractDirectivityPattern end
|
||||||
struct SubcardioidPattern <: DirectivityPattern end
|
struct SubcardioidPattern <: AbstractDirectivityPattern end
|
||||||
struct CardioidPattern <: DirectivityPattern end
|
struct CardioidPattern <: AbstractDirectivityPattern end
|
||||||
struct HypercardioidPattern <: DirectivityPattern end
|
struct HypercardioidPattern <: AbstractDirectivityPattern end
|
||||||
struct BidirectionalPattern <: DirectivityPattern end
|
struct BidirectionalPattern <: AbstractDirectivityPattern end
|
||||||
|
|
||||||
|
|
||||||
const Omnidirectional = OmnidirectionalPattern()
|
const Omnidirectional = OmnidirectionalPattern()
|
||||||
|
@ -28,20 +28,22 @@ const Bidirectional = BidirectionalPattern()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct TxRx{T<:AbstractFloat}
|
abstract type AbstractTxRx end
|
||||||
|
|
||||||
|
struct TxRx{T<:Real} <: AbstractTxRx
|
||||||
position::SVector{3, T} # Position
|
position::SVector{3, T} # Position
|
||||||
B::SMatrix{3, 3, T} # Orientation
|
B::SMatrix{3, 3, T} # Orientation
|
||||||
directivity::DirectivityPattern # Directivity pattern
|
directivity::AbstractDirectivityPattern # Directivity pattern
|
||||||
end
|
end
|
||||||
|
|
||||||
function TxRx(position, B=SMatrix{3,3}(1.0I), d=Omnidirectional)
|
function TxRx(position, B=SMatrix{3,3}(1.0I), d=Omnidirectional)
|
||||||
TxRx(position, B, d)
|
TxRx(position |> SVector{3}, B, d)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
abstract type Room end
|
abstract type Room end
|
||||||
|
|
||||||
struct RectangularRoom{T<:AbstractFloat} <: Room
|
struct RectangularRoom{T<:Real} <: Room
|
||||||
c::T
|
c::T
|
||||||
L::Tuple{T, T, T}
|
L::Tuple{T, T, T}
|
||||||
β::Tuple{T, T, T, T, T, T}
|
β::Tuple{T, T, T, T, T, T}
|
||||||
|
@ -54,19 +56,19 @@ abstract type RIRConfig end
|
||||||
"""
|
"""
|
||||||
|
|
||||||
"""
|
"""
|
||||||
struct ISMConfig{T<:AbstractFloat, I <: Integer} <: RIRConfig
|
struct ISMConfig{T<:Real, I<:Integer, R<:AbstractRNG} <: RIRConfig
|
||||||
order::Tuple{I, I} # Order of reflection [low, high]
|
order::Tuple{I, I} # Order of reflection [low, high]
|
||||||
fs::T # Sampling frequency
|
fs::T # Sampling frequency
|
||||||
N::I # Number of samples in impulse response
|
N::I # Number of samples in impulse response
|
||||||
Wd::T # Single impulse width
|
Wd::T # Single impulse width
|
||||||
hp::Bool # High pass filter
|
hp::Bool # High pass filter
|
||||||
isd::T # Image source distortion (randomized image method)
|
isd::T # Image source distortion (randomized image method)
|
||||||
lrng::AbstractRNG
|
lrng::R
|
||||||
end
|
end
|
||||||
|
|
||||||
function ISMConfig(
|
function ISMConfig(
|
||||||
order=(0, -1),
|
order=(0, -1),
|
||||||
fs=16000,
|
fs=16000.0,
|
||||||
N=4000,
|
N=4000,
|
||||||
Wd=8e-3,
|
Wd=8e-3,
|
||||||
hp=true,
|
hp=true,
|
||||||
|
|
Loading…
Reference in a new issue