Skip to content

Commit

Permalink
added license and fixed linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dh1tw committed Dec 26, 2016
1 parent bbfb69e commit 6da5d91
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
25 changes: 25 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
11 changes: 6 additions & 5 deletions gosamplerate.go
Original file line number Diff line number Diff line change
@@ -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

/*
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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]
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6da5d91

Please sign in to comment.