Skip to content

Commit bc201bc

Browse files
committed
Update files for go usage
1 parent 3e76fb9 commit bc201bc

File tree

5 files changed

+38
-15
lines changed

5 files changed

+38
-15
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,23 @@ public static class VadResult {
474474

475475
<br>
476476

477+
478+
### **Go (Golang) Usage**
479+
#### **Usage with compilation**
480+
```
481+
cd examples/go-tenvad
482+
go build -o tenvad .
483+
./tenvad
484+
```
485+
#### **Usage without compilation**
486+
```
487+
cd examples/go-tenvad
488+
export LD_LIBRARY_PATH=../../lib/Linux/x64:$LD_LIBRARY_PATH # For Windows and macOS, export the corresponding lib path instead
489+
go run .
490+
```
491+
492+
<br>
493+
477494
### **C Usage**
478495

479496
#### **Build Scripts**

examples/go-tenvad/README.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

examples/go-tenvad/go.mod

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//
2+
// Copyright © 2025 Agora
3+
// This file is part of TEN Framework, an open source project.
4+
// Licensed under the Apache License, Version 2.0, with certain conditions.
5+
// Refer to the "LICENSE" file in the root directory for more information.
6+
//
7+
18
module tenvad
29

310
go 1.23.6

examples/go-tenvad/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
//
2+
// Copyright © 2025 Agora
3+
// This file is part of TEN Framework, an open source project.
4+
// Licensed under the Apache License, Version 2.0, with certain conditions.
5+
// Refer to the "LICENSE" file in the root directory for more information.
6+
//
17
package main
28

39
import (

examples/go-tenvad/vad.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
//
2+
// Copyright © 2025 Agora
3+
// This file is part of TEN Framework, an open source project.
4+
// Licensed under the Apache License, Version 2.0, with certain conditions.
5+
// Refer to the "LICENSE" file in the root directory for more information.
6+
//
17
package main
28

39
/*
@@ -8,15 +14,12 @@ package main
814
#cgo darwin LDFLAGS: -F${SRCDIR}/../../lib/macOS -framework ten_vad -Wl,-rpath,${SRCDIR}/../../lib/macOS
915
1016
// Linux AMD64
11-
#cgo linux,amd64 LDFLAGS: -L${SRCDIR}/../../lib/Linux/amd64 -lten_vad -Wl,-rpath,'$ORIGIN'/../../lib/Linux/amd64
12-
13-
// Linux ARM64
14-
#cgo linux,arm64 LDFLAGS: -L${SRCDIR}/../../lib/Linux/arm64 -lten_vad -Wl,-rpath,'$ORIGIN'/../../lib/Linux/arm64
17+
#cgo linux,amd64 LDFLAGS: -L${SRCDIR}/../../lib/Linux/x64 -lten_vad -Wl,-rpath,'$ORIGIN'/../../lib/Linux/x64
1518
1619
// Windows AMD64
1720
// For Windows, the .dll needs to be in the PATH or alongside the .exe at runtime.
1821
// The .lib file is used for linking.
19-
#cgo windows,amd64 LDFLAGS: -L${SRCDIR}/../../lib/Windows/amd64 -lten_vad
22+
#cgo windows,amd64 LDFLAGS: -L${SRCDIR}/../../lib/Windows/x64 -lten_vad
2023
2124
#include "ten_vad.h"
2225
#include <stdlib.h> // Required for C.free if ever used directly for strings (not in this API but good practice)

0 commit comments

Comments
 (0)