diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..cad1027 --- /dev/null +++ b/LICENSE @@ -0,0 +1,25 @@ +BSD 2-Clause License + +Copyright (c) [2017], [Tobias Wellnitz] +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/gosamplerate.go b/gosamplerate.go index 7173323..c1dd1dd 100644 --- a/gosamplerate.go +++ b/gosamplerate.go @@ -1,6 +1,6 @@ // +build linux,cgo darwin,cgo -// Golang binding for libsamplerate (audio sample rate converter) +// Package gosamplerate is a golang binding for libsamplerate (audio sample rate converter) package gosamplerate /* @@ -26,6 +26,7 @@ import ( "fmt" ) +// Src struct holding the data for the full API type Src struct { srcState *C.SRC_STATE srcData *C.SRC_DATA @@ -43,7 +44,7 @@ const ( ) //New initializes the converter object and returns a reference to it. -func New(converterType int, channels int, buffer_len int) (Src, error) { +func New(converterType int, channels int, bufferLen int) (Src, error) { cConverter := C.int(converterType) cChannels := C.int(channels) var cErr *C.int @@ -53,8 +54,8 @@ func New(converterType int, channels int, buffer_len int) (Src, error) { return Src{}, errors.New("Could not initialize samplerate converter object") } - inputBuffer := make([]C.float, buffer_len) - outputBuffer := make([]C.float, buffer_len) + inputBuffer := make([]C.float, bufferLen) + outputBuffer := make([]C.float, bufferLen) cData := C.alloc_src_data() cData.data_in = &inputBuffer[0] @@ -215,7 +216,7 @@ func (src *Src) Process(dataIn []float32, ratio float64, endOfInput bool) ([]flo } // SetRatio sets the samplerate conversion ratio between input and output samples. -// Normally, when using (src *SRC) Process or the callback, the libary will try to smoothly +// Normally, when using (src *SRC) Process or the callback, the library will try to smoothly // transition between the conversion ratio of the last call and the conversion ratio of the next // call. This function bypasses this behaviour and achieves a step response in the conversion rate. func (src *Src) SetRatio(ratio float64) error {