add a few more asserts
This commit is contained in:
parent
d3ae48dd09
commit
255050b6c5
1 changed files with 3 additions and 0 deletions
|
@ -42,6 +42,8 @@ end
|
||||||
function af_open(path::String, mode::String = "r",
|
function af_open(path::String, mode::String = "r",
|
||||||
sampleRate::Integer = 44100, channels::Integer = 1,
|
sampleRate::Integer = 44100, channels::Integer = 1,
|
||||||
format::Integer = 0)
|
format::Integer = 0)
|
||||||
|
@assert channels <= 2
|
||||||
|
|
||||||
sfinfo = SF_INFO(0, 0, 0, 0, 0, 0)
|
sfinfo = SF_INFO(0, 0, 0, 0, 0, 0)
|
||||||
file_mode = SFM_READ
|
file_mode = SFM_READ
|
||||||
|
|
||||||
|
@ -120,6 +122,7 @@ function Base.read(file::AudioFile, nframes::Integer = file.sfinfo.frames,
|
||||||
end
|
end
|
||||||
|
|
||||||
function Base.write{T}(file::AudioFile, frames::Array{T})
|
function Base.write{T}(file::AudioFile, frames::Array{T})
|
||||||
|
@assert file.sfinfo.channels <= 2
|
||||||
nframes = int(length(frames) / file.sfinfo.channels)
|
nframes = int(length(frames) / file.sfinfo.channels)
|
||||||
|
|
||||||
if T == Int16
|
if T == Int16
|
||||||
|
|
Loading…
Reference in a new issue