updates for SampleTypes-to-SampledSignals rename
This commit is contained in:
parent
547cce821a
commit
43292ccaf8
5 changed files with 13 additions and 13 deletions
|
@ -11,8 +11,8 @@ julia:
|
|||
notifications:
|
||||
email: false
|
||||
script:
|
||||
# SampleTypes is unregistered so clone it for testing
|
||||
- julia -e 'Pkg.clone("https://github.com/JuliaAudio/SampleTypes.jl.git")'
|
||||
# SampledSignals is unregistered so clone it for testing
|
||||
- julia -e 'Pkg.clone("https://github.com/JuliaAudio/SampledSignals.jl.git")'
|
||||
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
|
||||
- julia -e 'Pkg.clone(pwd()); Pkg.build("PortAudio"); Pkg.test("PortAudio"; coverage=true)'
|
||||
after_success:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
PortAudio.jl
|
||||
============
|
||||
|
||||
PortAudio.jl is a wrapper for [libportaudio](http://www.portaudio.com/), which gives cross-platform access to audio devices. It is compatible with the types defined in [SampleTypes.jl](https://github.com/JuliaAudio/SampleTypes.jl). It provides a `PortAudioStream` type, which can be read from and written to.
|
||||
PortAudio.jl is a wrapper for [libportaudio](http://www.portaudio.com/), which gives cross-platform access to audio devices. It is compatible with the types defined in [SampledSignals.jl](https://github.com/JuliaAudio/SampledSignals.jl). It provides a `PortAudioStream` type, which can be read from and written to.
|
||||
|
||||
## Opening a stream
|
||||
|
||||
|
@ -33,7 +33,7 @@ julia> PortAudio.devices()
|
|||
|
||||
## Reading and Writing
|
||||
|
||||
The `PortAudioStream` type has `source` and `sink` fields which are of type `PortAudioSource <: SampleSource` and `PortAudioSink <: SampleSink`, respectively. are subtypes of `SampleSource` and `SampleSink`, respectively (from [SampleTypes.jl](https://github.com/JuliaAudio/SampleTypes.jl)). This means they support all the stream and buffer features defined there. For example, if you load SampleTypes with `using SampleTypes` you can read 5 seconds to a buffer with `buf = read(stream.source, 5s)`, regardless of the sample rate of the device.
|
||||
The `PortAudioStream` type has `source` and `sink` fields which are of type `PortAudioSource <: SampleSource` and `PortAudioSink <: SampleSink`, respectively. are subtypes of `SampleSource` and `SampleSink`, respectively (from [SampledSignals.jl](https://github.com/JuliaAudio/SampledSignals.jl)). This means they support all the stream and buffer features defined there. For example, if you load SampledSignals with `using SampledSignals` you can read 5 seconds to a buffer with `buf = read(stream.source, 5s)`, regardless of the sample rate of the device.
|
||||
|
||||
PortAudio.jl also provides convenience wrappers around the `PortAudioStream` type so you can read and write to it directly, e.g. `write(stream, stream)` will set up a loopback that will read from the input and play it back on the output.
|
||||
|
||||
|
@ -55,7 +55,7 @@ write(stream, stream)
|
|||
### Record 10 seconds of audio and save to an ogg file
|
||||
|
||||
```julia
|
||||
julia> using PortAudio, SampleTypes, LibSndFile
|
||||
julia> using PortAudio, SampledSignals, LibSndFile
|
||||
|
||||
julia> stream = PortAudioStream("Built-in Microph", 2, 0)
|
||||
PortAudio.PortAudioStream{Float32,SIUnits.SIQuantity{Int64,0,0,-1,0,0,0,0,0,0}}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
module SpectrumExample
|
||||
|
||||
using GR, PortAudio, SampleTypes
|
||||
using GR, PortAudio, SampledSignals
|
||||
|
||||
const N = 1024
|
||||
const stream = PortAudioStream(1, 0, bufsize=N)
|
||||
|
|
|
@ -2,7 +2,7 @@ __precompile__()
|
|||
|
||||
module PortAudio
|
||||
|
||||
using SampleTypes
|
||||
using SampledSignals
|
||||
using Devectorize
|
||||
using RingBuffers
|
||||
|
||||
|
@ -175,7 +175,7 @@ end
|
|||
|
||||
Base.isopen(stream::PortAudioStream) = stream.stream != C_NULL
|
||||
|
||||
SampleTypes.samplerate(stream::PortAudioStream) = stream.samplerate
|
||||
SampledSignals.samplerate(stream::PortAudioStream) = stream.samplerate
|
||||
Base.eltype{T, U}(stream::PortAudioStream{T, U}) = T
|
||||
|
||||
Base.read(stream::PortAudioStream, args...) = read(stream.source, args...)
|
||||
|
@ -221,8 +221,8 @@ for (TypeName, Super) in ((:PortAudioSink, :SampleSink),
|
|||
end
|
||||
end
|
||||
|
||||
SampleTypes.nchannels(s::Union{PortAudioSink, PortAudioSource}) = size(s.jlbuf, 2)
|
||||
SampleTypes.samplerate(s::Union{PortAudioSink, PortAudioSource}) = samplerate(s.stream)
|
||||
SampledSignals.nchannels(s::Union{PortAudioSink, PortAudioSource}) = size(s.jlbuf, 2)
|
||||
SampledSignals.samplerate(s::Union{PortAudioSink, PortAudioSource}) = samplerate(s.stream)
|
||||
Base.eltype{T, U}(::Union{PortAudioSink{T, U}, PortAudioSource{T, U}}) = T
|
||||
|
||||
function Base.show{T <: Union{PortAudioSink, PortAudioSource}}(io::IO, stream::T)
|
||||
|
@ -231,11 +231,11 @@ function Base.show{T <: Union{PortAudioSink, PortAudioSource}}(io::IO, stream::T
|
|||
end
|
||||
|
||||
|
||||
function SampleTypes.unsafe_write(sink::PortAudioSink, buf::SampleBuf)
|
||||
function SampledSignals.unsafe_write(sink::PortAudioSink, buf::SampleBuf)
|
||||
write(sink.ringbuf, buf)
|
||||
end
|
||||
|
||||
function SampleTypes.unsafe_read!(source::PortAudioSource, buf::SampleBuf)
|
||||
function SampledSignals.unsafe_read!(source::PortAudioSource, buf::SampleBuf)
|
||||
read!(source.ringbuf, buf)
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
using BaseTestNext
|
||||
using PortAudio
|
||||
using SampleTypes
|
||||
using SampledSignals
|
||||
|
||||
# these test are currently set up to run on OSX
|
||||
|
||||
|
|
Loading…
Reference in a new issue