Skip to content

Conversation

@pjabardo
Copy link

…actArray`

Used the approach used by AxisArrays where the a new parametric type is used to specify the array data type. The constructor is used to garantee that an AbstractArray is actually used.

What does this implement/fix?

For now, SampleBufP and SpectrumBuf use an Array object to store data. But using an AbstractArray could be interesting, mostly for using views of arrays.

There is an issue #60 that deals with it but the approach
uses abstract type for the data field which has several issues.

The approach here, uses the same approach as AxisArrays pacakge:

mutable struct SampleBuf{T, N, D} <: AbstractSampleBuf{T, N}
    data::D
    samplerate::Float64
    SampleBuf{T,N,D}(data::AbstractArray{T,N}, sr::Real) where {T,N,D} = new{T,N,D}(data,sr)
end

Now, not only can SubArrays be used but other arrays types such as StaticArrays or FixedSizeArrays can be used.

Reference issue

Example: Fixes #60.

Additional information

Any additional information you think is important.

…actArray`

Used the approach used by `AxisArrays` where the a new parametric type is used to specify the array data type. The constructor is used to garantee that an `AbstractArray` is actually used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrap AbstractArray rather than Array in SampleBuf?

2 participants