Browse Source

sync_tx and more unit test added

master v0.0.5-alpha
Eray Arslan 12 months ago
parent
commit
e13dfd5ff0
  1. 8
      README.md
  2. 80
      bladerf.go
  3. 1954
      bladerf_test.go
  4. 7
      enums.go
  5. 3
      go.mod
  6. 56
      go.sum
  7. 10
      macro_wrapper.c
  8. 10
      macro_wrapper.h
  9. 12
      macros.go
  10. 32
      structs.go

8
README.md

@ -9,11 +9,3 @@ @@ -9,11 +9,3 @@
## Tested On
`libbladeRF 2.2.1-MacPorts-20191220-45521019`
## Notes
```shell
brew install pkg-config
brew install portaudio
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/Cellar/portaudio/19.6.0/lib/pkgconfig"
```

80
bladerf.go

@ -37,8 +37,20 @@ func StreamCallback( @@ -37,8 +37,20 @@ func StreamCallback(
)
}
userData.callback(userData.results)
return samples
defer C.free(samples)
status := userData.callback(userData.results)
if status == GoStreamNoData {
return StreamNoData
} else if status == GoStreamShutdown {
return StreamShutdown
} else {
return unsafe.Pointer(
(*C.uint16_t)(
C.malloc((C.size_t)(C.sizeof_uint16_t * uintptr(numSamples) * 2 * 1)),
),
)
}
}
func GetVersion() Version {
@ -182,8 +194,6 @@ func GetDeviceList() ([]DeviceInfo, error) { @@ -182,8 +194,6 @@ func GetDeviceList() ([]DeviceInfo, error) {
(*C.struct_bladerf_devinfo)(unsafe.Pointer(uintptr(unsafe.Pointer(deviceInfo))+(uintptr(i)*size))),
))
}
devices[0].FreeDeviceList()
}
return devices, nil
@ -213,8 +223,6 @@ func GetBootloaderList() ([]DeviceInfo, error) { @@ -213,8 +223,6 @@ func GetBootloaderList() ([]DeviceInfo, error) {
(*C.struct_bladerf_devinfo)(unsafe.Pointer(uintptr(unsafe.Pointer(deviceInfo))+(uintptr(i)*size))),
))
}
devices[0].FreeDeviceList()
}
return devices, nil
@ -578,7 +586,7 @@ func (bladeRF *BladeRF) SetCorrection(channel Channel, correction Correction, co @@ -578,7 +586,7 @@ func (bladeRF *BladeRF) SetCorrection(channel Channel, correction Correction, co
)
}
func (bladeRF *BladeRF) GetCorrection(channel Channel, correction Correction) (uint16, error) {
func (bladeRF *BladeRF) GetCorrection(channel Channel, correction Correction) (int16, error) {
var correctionValue C.int16_t
err := GetError(C.bladerf_get_correction(
bladeRF.ref,
@ -591,7 +599,7 @@ func (bladeRF *BladeRF) GetCorrection(channel Channel, correction Correction) (u @@ -591,7 +599,7 @@ func (bladeRF *BladeRF) GetCorrection(channel Channel, correction Correction) (u
return 0, err
}
return uint16(correctionValue), nil
return int16(correctionValue), nil
}
func (backend *Backend) String() string {
@ -803,23 +811,52 @@ func (trigger *Trigger) SetRole(role TriggerRole) { @@ -803,23 +811,52 @@ func (trigger *Trigger) SetRole(role TriggerRole) {
(*trigger.ref).role = C.bladerf_trigger_role(role)
}
func (bladeRF *BladeRF) SyncRX(bufferSize uintptr) ([]int16, error) {
var metadata C.struct_bladerf_metadata
func (bladeRF *BladeRF) SyncTX(input []int16, metadata Metadata) (Metadata, error) {
if metadata.ref == nil {
var ref C.struct_bladerf_metadata
metadata.ref = &ref
}
numberOfSample := len(input)
buf := (*C.uint16_t)(C.malloc((C.size_t)(C.sizeof_uint16_t * uintptr(numberOfSample))))
defer C.free(unsafe.Pointer(buf))
for i := 0; i < numberOfSample; i++ {
addr := (*C.uint16_t)(unsafe.Pointer(uintptr(unsafe.Pointer(buf)) + (C.sizeof_uint16_t * uintptr(i))))
*addr = (C.uint16_t)(input[i])
}
err := GetError(C.bladerf_sync_tx(bladeRF.ref, unsafe.Pointer(buf), C.uint(numberOfSample/2), metadata.ref, 5000))
if err != nil {
return metadata, err
}
return LoadMetadata(metadata.ref), nil
}
func (bladeRF *BladeRF) SyncRX(bufferSize uintptr, metadata Metadata) ([]int16, Metadata, error) {
if metadata.ref == nil {
var ref C.struct_bladerf_metadata
metadata.ref = &ref
}
start := C.malloc(C.size_t(C.sizeof_int16_t * bufferSize * 2 * 1))
err := GetError(C.bladerf_sync_rx(bladeRF.ref, start, C.uint(bufferSize), &metadata, 32))
defer C.free(unsafe.Pointer(start))
err := GetError(C.bladerf_sync_rx(bladeRF.ref, start, C.uint(bufferSize), metadata.ref, 5000))
if err != nil {
return nil, err
return nil, metadata, err
}
var results []int16
for i := 0; i < (int(metadata.actual_count)); i++ {
for i := 0; i < (int(metadata.ref.actual_count)); i++ {
n := (*C.int16_t)(unsafe.Pointer(uintptr(start) + (C.sizeof_int16_t * uintptr(i))))
results = append(results, int16(*n))
}
return results, nil
return results, LoadMetadata(metadata.ref), nil
}
func (bladeRF *BladeRF) InitStream(
@ -827,7 +864,7 @@ func (bladeRF *BladeRF) InitStream( @@ -827,7 +864,7 @@ func (bladeRF *BladeRF) InitStream(
numBuffers int,
samplesPerBuffer int,
numTransfers int,
callback func(data []int16),
callback func(data []int16) GoStream,
) (Stream, error) {
var buffers *unsafe.Pointer
var rxStream *C.struct_bladerf_stream
@ -910,7 +947,7 @@ func (bladeRF *BladeRF) GetAttachedExpansionBoard() (ExpansionBoard, error) { @@ -910,7 +947,7 @@ func (bladeRF *BladeRF) GetAttachedExpansionBoard() (ExpansionBoard, error) {
return ExpansionBoard(expansionBoard), nil
}
func (bladeRF *BladeRF) SetGetVctcxoTamerMode(mode VctcxoTamerMode) error {
func (bladeRF *BladeRF) SetVctcxoTamerMode(mode VctcxoTamerMode) error {
return GetError(C.bladerf_set_vctcxo_tamer_mode(bladeRF.ref, C.bladerf_vctcxo_tamer_mode(mode)))
}
@ -966,6 +1003,17 @@ func (bladeRF *BladeRF) GetTuningMode() (TuningMode, error) { @@ -966,6 +1003,17 @@ func (bladeRF *BladeRF) GetTuningMode() (TuningMode, error) {
return TuningMode(mode), nil
}
func (bladeRF *BladeRF) GetTimestamp(direction Direction) (Timestamp, error) {
var timestamp C.bladerf_timestamp
err := GetError(C.bladerf_get_timestamp(bladeRF.ref, C.bladerf_direction(direction), &timestamp))
if err != nil {
return 0, err
}
return Timestamp(timestamp), err
}
func (bladeRF *BladeRF) ReadTrigger(channel Channel, signal TriggerSignal) (uint8, error) {
var val C.uint8_t
err := GetError(C.bladerf_read_trigger(

1954
bladerf_test.go

File diff suppressed because it is too large Load Diff

7
enums.go

@ -24,9 +24,16 @@ type TriggerSignal int @@ -24,9 +24,16 @@ type TriggerSignal int
type ExpansionBoard int
type VctcxoTamerMode int
type TuningMode int
type GoStream int
const FlashPageSize = 256 // BLADERF_FLASH_PAGE_SIZE - Size of the SPI flash, in pages
const (
GoStreamNext GoStream = 0
GoStreamNoData GoStream = 1
GoStreamShutdown GoStream = 2
)
const (
BackendAny Backend = C.BLADERF_BACKEND_ANY
BackendLinux Backend = C.BLADERF_BACKEND_LINUX

3
go.mod

@ -3,8 +3,5 @@ module github.com/erayarslan/go-bladerf @@ -3,8 +3,5 @@ module github.com/erayarslan/go-bladerf
go 1.13
require (
github.com/gordonklaus/portaudio v0.0.0-20180817120803-00e7307ccd93
github.com/mattn/go-pointer v0.0.1
github.com/racerxdl/go.fifo v0.0.0-20180604061744-c6aa83afe374
github.com/racerxdl/segdsp v0.0.0-20190413213320-dfaea7c39d3a
)

56
go.sum

@ -1,58 +1,2 @@ @@ -1,58 +1,2 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-gl/gl v0.0.0-20180407155706-68e253793080/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk=
github.com/go-gl/glfw v0.0.0-20180426074136-46a8d530c326/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/gordonklaus/portaudio v0.0.0-20180817120803-00e7307ccd93 h1:TSG+DyZBnazM22ZHyHLeUkzM34ClkJRjIWHTq4btvek=
github.com/gordonklaus/portaudio v0.0.0-20180817120803-00e7307ccd93/go.mod h1:HfYnZi/ARQKG0dwH5HNDmPCHdLiFiBf+SI7DbhW7et4=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/llgcode/draw2d v0.0.0-20180825133448-f52c8a71aff0/go.mod h1:mVa0dA29Db2S4LVqDYLlsePDzRJLDfdhVZiI15uY0FA=
github.com/llgcode/ps v0.0.0-20150911083025-f1443b32eedb/go.mod h1:1l8ky+Ew27CMX29uG+a2hNOKpeNYEQjjtiALiBlFQbY=
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
github.com/mattetti/audio v0.0.0-20190404201502-c6aebeb78429 h1:5YWANgpchDSYJ0R6i3ODpZ4KN/1Jm9MZcFDtAtegjNM=
github.com/mattetti/audio v0.0.0-20190404201502-c6aebeb78429/go.mod h1:LlQmBGkOuV/SKzEDXBPKauvN2UqCgzXO2XjecTGj40s=
github.com/mattn/go-pointer v0.0.0-20180825124634-49522c3f3791/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc=
github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0=
github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc=
github.com/myriadrf/limedrv v0.0.0-20190225221912-8583a26e3fce/go.mod h1:/SXVBJBHAVLlvLU1B1n0a0QPcZBtqF1VpH5POPZzuBw=
github.com/oov/audio v0.0.0-20171004131523-88a2be6dbe38 h1:4Upfs5rLQdx7KwBct3bmPYAhWsDDJdx660gYb7Lv9TQ=
github.com/oov/audio v0.0.0-20171004131523-88a2be6dbe38/go.mod h1:Xj06yMta9R1RSKiHmxL0Bo2TB8wiKVnMgA0KVopHHkk=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/quan-to/slog v0.0.0-20190317205605-56a2b4159924/go.mod h1:xc9X6JvWjqAAIox9u4uuolisjwl/GbfkktH6f+nOgqU=
github.com/racerxdl/fastconvert v0.0.0-20190129064530-871b6f6cd82a/go.mod h1:V4kP6uu5nqjDVGhlYMtT/7JG7WJjXnipMGcQ8PFeUqU=
github.com/racerxdl/go.fifo v0.0.0-20180604061744-c6aa83afe374 h1:P2TDDsGEWzzfhAnthdQc+Vwmv/+xEKHwoNFF3Swl6X0=
github.com/racerxdl/go.fifo v0.0.0-20180604061744-c6aa83afe374/go.mod h1:CvYWG6Py4TRzGCUVX2n8+CjE6mrME/+kHkkGmbDA5zw=
github.com/racerxdl/radioserver v0.0.0-20190316070955-f8953f368ce1/go.mod h1:cSQupBUlkn/QhajTmf6QMErp3PbTVT5Xdd5DSiE0hAI=
github.com/racerxdl/radioserver v0.0.0-20190324175745-bd3bd7179419/go.mod h1:N4ejKokz1jnGfAd3KNgO8E6YMCMP4ZgaHXBEdHBQrP8=
github.com/racerxdl/segdsp v0.0.0-20190321214158-1cd3e325e91a/go.mod h1:nQDTqJjqr+YsSQw+CVY58Xag4KVqfoi6TgkSXMHlUO4=
github.com/racerxdl/segdsp v0.0.0-20190413213320-dfaea7c39d3a h1:2QJXxaBOGMsjoZ++ecsek0SE/V4bbraCITBNVji4+4M=
github.com/racerxdl/segdsp v0.0.0-20190413213320-dfaea7c39d3a/go.mod h1:NXNN9LqX1oeK6+o+xm+Dz8ANz+i1uILw4HsL0sq5tzE=
github.com/racerxdl/spy2go v0.0.0-20190103011754-14102c047be5/go.mod h1:ioS4oIwJsgrSeKKPATMpsbJQdi4p2Xsbg3V5j2nCOzM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190322120337-addf6b3196f6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

10
macro_wrapper.c

@ -1,10 +1,20 @@ @@ -1,10 +1,20 @@
#include "macro_wrapper.h"
uint64_t ReTuneNow = BLADERF_RETUNE_NOW;
uint32_t MetaFlagTxBurstStart = BLADERF_META_FLAG_TX_BURST_START;
uint32_t MetaFlagTxBurstEnd = BLADERF_META_FLAG_TX_BURST_END;
uint32_t MetaFlagTxNow = BLADERF_META_FLAG_TX_NOW;
uint32_t MetaFlagTxUpdateTimestamp = BLADERF_META_FLAG_TX_UPDATE_TIMESTAMP;
uint32_t MetaFlagRxNow = BLADERF_META_FLAG_RX_NOW;
uint32_t MetaFlagRxHwUnderflow = BLADERF_META_FLAG_RX_HW_UNDERFLOW;
uint32_t MetaFlagRxHwMiniexp1 = BLADERF_META_FLAG_RX_HW_MINIEXP1;
uint32_t MetaFlagRxHwMiniexp2 = BLADERF_META_FLAG_RX_HW_MINIEXP2;
uint8_t TriggerRegArm = BLADERF_TRIGGER_REG_ARM;
uint8_t TriggerRegFire = BLADERF_TRIGGER_REG_FIRE;
uint8_t TriggerRegMaster = BLADERF_TRIGGER_REG_MASTER;
uint8_t TriggerRegLine = BLADERF_TRIGGER_REG_LINE;
void* StreamNoData = BLADERF_STREAM_NO_DATA;
void* StreamShutdown = BLADERF_STREAM_SHUTDOWN;
int ChannelRx(const int ch) {
return BLADERF_CHANNEL_RX(ch);

10
macro_wrapper.h

@ -1,10 +1,20 @@ @@ -1,10 +1,20 @@
#include <libbladeRF.h>
extern uint64_t ReTuneNow;
extern uint32_t MetaFlagTxBurstStart;
extern uint32_t MetaFlagTxBurstEnd;
extern uint32_t MetaFlagTxNow;
extern uint32_t MetaFlagTxUpdateTimestamp;
extern uint32_t MetaFlagRxNow;
extern uint32_t MetaFlagRxHwUnderflow;
extern uint32_t MetaFlagRxHwMiniexp1;
extern uint32_t MetaFlagRxHwMiniexp2;
extern uint8_t TriggerRegArm;
extern uint8_t TriggerRegFire;
extern uint8_t TriggerRegMaster;
extern uint8_t TriggerRegLine;
extern void* StreamNoData;
extern void* StreamShutdown;
int ChannelRx(const int ch);
int ChannelTx(const int ch);

12
macros.go

@ -2,13 +2,23 @@ package bladerf @@ -2,13 +2,23 @@ package bladerf
// #include "macro_wrapper.h"
import "C"
import "unsafe"
var ReTuneNow = Timestamp(C.ReTuneNow)
var MetaFlagTxBurstStart = uint32(C.MetaFlagTxBurstStart)
var MetaFlagTxBurstEnd = uint32(C.MetaFlagTxBurstEnd)
var MetaFlagTxNow = uint32(C.MetaFlagTxNow)
var MetaFlagTxUpdateTimestamp = uint32(C.MetaFlagTxUpdateTimestamp)
var MetaFlagRxNow = uint32(C.MetaFlagRxNow)
var MetaFlagRxHwUnderflow = uint32(C.MetaFlagRxHwUnderflow)
var MetaFlagRxHwMiniexp1 = uint32(C.MetaFlagRxHwMiniexp1)
var MetaFlagRxHwMiniexp2 = uint32(C.MetaFlagRxHwMiniexp2)
var TriggerRegArm = C.TriggerRegArm
var TriggerRegFire = C.TriggerRegFire
var TriggerRegMaster = C.TriggerRegMaster
var TriggerRegLine = C.TriggerRegLine
var StreamNoData = unsafe.Pointer(C.StreamNoData)
var StreamShutdown = unsafe.Pointer(C.StreamShutdown)
func ChannelRx(ch int) Channel {
return Channel(C.ChannelRx(C.int(ch)))

32
structs.go

@ -156,12 +156,40 @@ func NewGainModes(ref *C.struct_bladerf_gain_modes) GainModes { @@ -156,12 +156,40 @@ func NewGainModes(ref *C.struct_bladerf_gain_modes) GainModes {
return gainModes
}
type Metadata struct {
ref *C.struct_bladerf_metadata
Timestamp Timestamp
Flags uint32
Status uint32
ActualCount uint
}
func LoadMetadata(ref *C.struct_bladerf_metadata) Metadata {
metadata := Metadata{ref: ref}
metadata.Timestamp = Timestamp(metadata.ref.timestamp)
metadata.Flags = uint32(metadata.ref.flags)
metadata.Status = uint32(metadata.ref.status)
metadata.ActualCount = uint(metadata.ref.actual_count)
return metadata
}
func NewMetadata(timestamp Timestamp, flags uint32) Metadata {
ref := C.struct_bladerf_metadata{
timestamp: C.uint64_t(timestamp),
flags: C.uint32_t(flags),
}
return LoadMetadata(&ref)
}
type UserData struct {
callback func(data []int16)
callback func(data []int16) GoStream
results []int16
bufferSize int
}
func NewUserData(callback func(data []int16), bufferSize int) UserData {
func NewUserData(callback func(data []int16) GoStream, bufferSize int) UserData {
return UserData{callback: callback, results: make([]int16, bufferSize), bufferSize: bufferSize}
}

Loading…
Cancel
Save