-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from wsc1/master
cb cleanup/test
- Loading branch information
Showing
6 changed files
with
274 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package libsio | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"zikichombo.org/sound" | ||
"zikichombo.org/sound/sample" | ||
) | ||
|
||
func TestCbCapture(t *testing.T) { | ||
N := 1024 | ||
v := sound.MonoCd() | ||
c := sample.SFloat32L | ||
b := 512 | ||
cb := NewCb(v, c, b) | ||
go runcbsCapture(cb, N, b, c.Bytes()) | ||
d := make([]float64, b) | ||
for i := 0; i < N; i++ { | ||
fmt.Printf("cb receive %d\n", i) | ||
n, err := cb.Receive(d) | ||
if err != nil { | ||
t.Error(err) | ||
} else if n != b { | ||
t.Errorf("expected %d got %d\n", b, n) | ||
} | ||
} | ||
} | ||
|
||
func TestCbPlay(t *testing.T) { | ||
N := 1024 | ||
v := sound.MonoCd() | ||
c := sample.SFloat32L | ||
b := 512 | ||
cb := NewCb(v, c, b) | ||
go runcbsPlay(cb, N, b, c.Bytes()) | ||
d := make([]float64, b) | ||
for i := 0; i < N; i++ { | ||
fmt.Printf("cb send %d\n", i) | ||
err := cb.Send(d) | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Copyright 2018 The ZikiChombo Authors. All rights reserved. Use of this source | ||
// code is governed by a license that can be found in the License file. | ||
|
||
// Package libsio provides support for the different ports. | ||
// Package libsio provides some support for implementing the different ports. | ||
// | ||
// Package libsio is part of http://zikichombo.org | ||
package libsio /* import "zikichombo.org/sio/libsio" */ |
Oops, something went wrong.