Skip to content

Commit

Permalink
Merge pull request #124 from gopxl/github-actions
Browse files Browse the repository at this point in the history
Add Github workflow file
  • Loading branch information
duysqubix authored Oct 27, 2023
2 parents 800fda2 + df445d9 commit c64e515
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'

- name: Install goveralls
if: ${{ github.ref == 'refs/heads/main' }}
run: go install github.com/mattn/goveralls@latest

# Install ALSA for building Oto
- name: Install ALSA
run: sudo apt install libasound2-dev

- name: Build
run: go build -v ./...

- name: Test
run: go test -v -covermode atomic -coverprofile=covprofile ./...

- name: Gofmt
# Run gofmt, print the output and exit with status code 1 if it isn't empty.
run: |
OUTPUT=$(gofmt -d ./)
echo "$OUTPUT"
test -z "$OUTPUT"
- name: Send coverage
if: ${{ github.ref == 'refs/heads/main' }}
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: goveralls -coverprofile=covprofile -service=github
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Beep [![GoDoc](https://godoc.org/github.com/gopxl/beep?status.svg)](https://godoc.org/github.com/gopxl/beep) [![Go Report Card](https://goreportcard.com/badge/github.com/gopxl/beep)](https://goreportcard.com/report/github.com/gopxl/beep) [![Discord Chat](https://img.shields.io/discord/1158461233121468496)](https://discord.gg/erpa32cB) [![Coverage Status](https://coveralls.io/repos/github/gopxl/beep/badge.svg?branch=main)](https://coveralls.io/github/gopxl/beep?branch=main)
# Beep

[![GoDoc](https://godoc.org/github.com/gopxl/beep?status.svg)](https://godoc.org/github.com/gopxl/beep)
[![Go build status](https://github.com/gopxl/beep/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/gopxl/beep/actions/workflows/go.yml?query=branch%3Amain)
[![Coverage Status](https://coveralls.io/repos/github/gopxl/beep/badge.svg?branch=main)](https://coveralls.io/github/gopxl/beep?branch=main)
[![Go Report Card](https://goreportcard.com/badge/github.com/gopxl/beep)](https://goreportcard.com/report/github.com/gopxl/beep)
[![Discord Chat](https://img.shields.io/discord/1158461233121468496)](https://discord.gg/erpa32cB)


A little package that brings sound to any Go application. Suitable for playback and audio-processing.

Expand Down
4 changes: 2 additions & 2 deletions resample.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func ResampleRatio(quality int, ratio float64, s Streamer) *Resampler {
panic(fmt.Errorf("resample: invalid quality: %d", quality))
}
if math.IsInf(ratio, 0) || math.IsNaN(ratio) {
panic(fmt.Errorf("resample: invalid ratio: %d", ratio))
panic(fmt.Errorf("resample: invalid ratio: %f", ratio))
}
return &Resampler{
s: s,
Expand Down Expand Up @@ -155,7 +155,7 @@ func (r *Resampler) Ratio() float64 {
// SetRatio sets the resampling ratio. This does not cause any glitches in the stream.
func (r *Resampler) SetRatio(ratio float64) {
if math.IsInf(ratio, 0) || math.IsNaN(ratio) {
panic(fmt.Errorf("resample: invalid ratio: %d", ratio))
panic(fmt.Errorf("resample: invalid ratio: %f", ratio))
}
r.pos = int(float64(r.pos) * r.ratio / ratio)
r.ratio = ratio
Expand Down

0 comments on commit c64e515

Please sign in to comment.