Skip to content

Commit 7796b2d

Browse files
authored
Adding version (#48)
* added version, running tests to check if #47 is due to os * tests on less julia v
1 parent 75f743b commit 7796b2d

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

.github/workflows/Tests.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
version:
20-
- '1.3'
21-
- '1.4'
22-
- '1.5'
20+
- '1.6'
2321
- '1'
2422
- 'nightly'
2523
os:

src/libsndfile_h.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,13 @@ sf_seek(filePtr, frames::sf_count_t, whence::Integer) =
214214
ccall((:sf_seek, libsndfile), Int64,
215215
(Ptr{Cvoid}, Int64, Int32),
216216
filePtr, frames, whence)
217+
218+
function version()
219+
SFC_GET_LIB_VERSION = 0x1000
220+
buf = zeros(Cchar,256)
221+
v = Cstring(pointer(buf))
222+
ccall((:sf_command, libsndfile), Int64,
223+
(Ptr{Cvoid}, UInt, Cstring, UInt),
224+
C_NULL, SFC_GET_LIB_VERSION, v, sizeof(buf))
225+
unsafe_string(v)
226+
end

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ reference_buf = gen_reference(srate)
6464
# Juno
6565
@testset "LibSndFile Tests" begin
6666

67+
@testset "Version" begin
68+
v = LibSndFile.version()
69+
@test v[1:10] == "libsndfile"
70+
end
71+
6772
@testset "Read errors" begin
6873
@test_throws ErrorException load_wav("doesnotexist.wav")
6974
end

0 commit comments

Comments
 (0)