Skip to content

Commit

Permalink
Merge pull request #161 from oakmound/release/3.0.0-final
Browse files Browse the repository at this point in the history
Release/3.0.0 final
  • Loading branch information
200sc committed Sep 18, 2021
2 parents a950e70 + 427aae8 commit 314b923
Show file tree
Hide file tree
Showing 183 changed files with 1,937 additions and 2,216 deletions.
2 changes: 1 addition & 1 deletion alg/doc.go
@@ -1,2 +1,2 @@
// Package alg stores useful algorithms and math functions
// Package alg provides algorithms and math utilities.
package alg
2 changes: 1 addition & 1 deletion alg/floatgeom/doc.go
@@ -1,2 +1,2 @@
// Package floatgeom stores primitives for floating point geometry
// Package floatgeom provides primitives for floating point geometry.
package floatgeom
2 changes: 1 addition & 1 deletion alg/intgeom/doc.go
@@ -1,2 +1,2 @@
// Package intgeom stores primitives for integer geometry
// Package intgeom provides primitives for integer geometry.
package intgeom
2 changes: 1 addition & 1 deletion alg/range/colorrange/range.go
@@ -1,4 +1,4 @@
// Package colorrange holds distributions that accept and return color.Colors
// Package colorrange provides distributions that accept and return color.Colors.
package colorrange

import (
Expand Down
2 changes: 1 addition & 1 deletion alg/range/floatrange/range.go
@@ -1,4 +1,4 @@
// Package floatrange holds distributions that accept and return float64s
// Package floatrange provides distributions that accept and return float64s.
package floatrange

// Range represents a range of floating point numbers
Expand Down
2 changes: 1 addition & 1 deletion alg/range/intrange/range.go
@@ -1,4 +1,4 @@
// Package intrange holds distributions that return ints
// Package intrange provides distributions that return ints.
package intrange

// Range represents a range of integer numbers
Expand Down
5 changes: 4 additions & 1 deletion audio/audio.go
Expand Up @@ -55,7 +55,10 @@ func (a *Audio) Play() <-chan error {
return errChannel(err)
}
a.toStop = a4
a.toStop.SetVolume(a.setVolume)
err = a.toStop.SetVolume(a.setVolume)
if err != nil {
return errChannel(err)
}
return a4.Play()
}

Expand Down
5 changes: 4 additions & 1 deletion audio/audio_test.go
Expand Up @@ -58,7 +58,10 @@ func TestAudioFuncs(t *testing.T) {
a.Play()
time.Sleep(a.PlayLength())
// Assert yet quieter audio is playing
a.SetVolume(-2000)
err = a.SetVolume(-2000)
if err != nil {
t.Fatalf("unexpected error on set volume: %v", err)
}
a.Play()
time.Sleep(a.PlayLength())
// Assert yet quieter audio is playing
Expand Down
53 changes: 53 additions & 0 deletions audio/cache.go
@@ -0,0 +1,53 @@
package audio

import (
"path/filepath"
"sync"
)

// DefaultCache is the receiver for package level loading operations.
var DefaultCache = NewCache()

// Cache is a simple audio data cache
type Cache struct {
mu sync.RWMutex
data map[string]Data
}

// NewCache returns an empty Cache
func NewCache() *Cache {
return &Cache{
data: make(map[string]Data),
}
}

// ClearAll will remove all elements from a Cache
func (c *Cache) ClearAll() {
c.mu.Lock()
c.data = make(map[string]Data)
c.mu.Unlock()
}

// Clear will remove elements matching the given key from the Cache.
func (c *Cache) Clear(key string) {
c.mu.Lock()
delete(c.data, key)
c.mu.Unlock()
}

func (c *Cache) setLoaded(file string, data Data) {
c.mu.Lock()
c.data[file] = data
c.data[filepath.Base(file)] = data
c.mu.Unlock()
}

// Load calls Load on the Default Cache.
func Load(file string) (Data, error) {
return DefaultCache.Load(file)
}

// Get calls Get on the Default Cache.
func Get(file string) (Data, error) {
return DefaultCache.Get(file)
}
4 changes: 1 addition & 3 deletions audio/doc.go
@@ -1,4 +1,2 @@
// Package audio provides audio types, font types for filtering audio
// reactively, and channels to allow constant audio play signals to be
// restricted to play at variable frequencies.
// Package audio provides audio playing utilities.
package audio
2 changes: 1 addition & 1 deletion audio/flac/flac.go
@@ -1,4 +1,4 @@
// Package flac provides functionality to handle .flac files and .flac encoded data
// Package flac provides functionality to handle .flac files and .flac encoded data.
package flac

import (
Expand Down
2 changes: 1 addition & 1 deletion audio/font/ceol/ceol.go
@@ -1,4 +1,4 @@
// Package ceol provides functionality to handle .ceol files and .ceol encoded data (Bosca Ceoil files)
// Package ceol provides functionality to handle .ceol files and .ceol encoded data (Bosca Ceoil files).
package ceol

import (
Expand Down
4 changes: 2 additions & 2 deletions audio/font/dls/dls.go
@@ -1,4 +1,4 @@
// Package dls contains data structures for DLS (.dls) file types
// Package dls contains data structures for DLS (.dls) file types.
package dls

import "github.com/oakmound/oak/v3/audio/font/riff"
Expand Down Expand Up @@ -41,7 +41,7 @@ type ID struct {
// if a user wanted access to a DLSID it would no longer be there to get.
type Wave struct {
Dlid ID `riff:"dlid"`
Guid []byte `riff:"guid"`
GUID []byte `riff:"guid"`
Wavu []byte `riff:"wavu"`
Fmt PCMFormat `riff:"fmt "`
Wavh []byte `riff:"wavh"`
Expand Down
2 changes: 1 addition & 1 deletion audio/font/font.go
@@ -1,5 +1,5 @@
// Package font provides utilities to package together audio manipulations as
// a 'font'
// a 'font'.
package font

import audio "github.com/oakmound/oak/v3/audio/klang"
Expand Down
2 changes: 1 addition & 1 deletion audio/font/riff/riff.go
@@ -1,4 +1,4 @@
// Package riff reads and umarshalls RIFF files
// Package riff reads and umarshalls RIFF files.
package riff

import (
Expand Down
48 changes: 0 additions & 48 deletions audio/fontManager.go

This file was deleted.

23 changes: 0 additions & 23 deletions audio/fontManager_test.go

This file was deleted.

16 changes: 0 additions & 16 deletions audio/globals.go

This file was deleted.

2 changes: 1 addition & 1 deletion audio/klang/audio.go
@@ -1,4 +1,4 @@
// Package audio provides audio playing and encoding support
// Package klang provides audio playing and encoding support
package klang

import (
Expand Down
2 changes: 1 addition & 1 deletion audio/klang/filter/encoding.go
Expand Up @@ -3,7 +3,7 @@ package filter
import (
"github.com/oakmound/oak/v3/audio/klang"
"github.com/oakmound/oak/v3/audio/klang/filter/supports"
"github.com/oakmound/oak/v3/audio/klang/manip"
"github.com/oakmound/oak/v3/audio/klang/internal/manip"
)

// Encoding filters are functions on any combination of the values
Expand Down
2 changes: 1 addition & 1 deletion audio/klang/filter/guarantees.go
@@ -1,5 +1,5 @@
// Package filter provides various audio filters to be applied to audios through the
// Filter() function
// Filter function.
package filter

import (
Expand Down
4 changes: 2 additions & 2 deletions audio/klang/filter/pitchshift.go
Expand Up @@ -4,7 +4,7 @@ import (
"math"

"github.com/oakmound/oak/v3/audio/klang/filter/supports"
"github.com/oakmound/oak/v3/audio/klang/manip"
"github.com/oakmound/oak/v3/audio/klang/internal/manip"
)

/*****************************************************************************
Expand Down Expand Up @@ -239,7 +239,7 @@ func (ps FFTShifter) PitchShift(shiftBy float64) Encoding {
}
// remap this f64in to the output
for i := c * int(byteDepth); i < len(data); i += int(byteDepth * 2) {
manip.SetInt16_f64(out, i, f64in[i/int(byteDepth*2)])
manip.SetInt16F64(out, i, f64in[i/int(byteDepth*2)])
}
}
datap := senc.GetData()
Expand Down
3 changes: 0 additions & 3 deletions audio/klang/filter/resample.go
@@ -1,8 +1,6 @@
package filter

import (
"fmt"

"github.com/oakmound/oak/v3/audio/klang/filter/supports"
)

Expand All @@ -11,7 +9,6 @@ import (
func Speed(ratio float64, pitchShifter PitchShifter) Encoding {
return func(senc supports.Encoding) {
r := ratio
fmt.Println(ratio)
for r < .5 {
r *= 2
pitchShifter.PitchShift(.5)(senc)
Expand Down
2 changes: 1 addition & 1 deletion audio/klang/filter/supports/supports.go
@@ -1,4 +1,4 @@
// Package supports holds interface types for filter supports
// Package supports holds interface types for filter supports.
package supports

// Data types support filters that manipulate their raw audio data
Expand Down
2 changes: 1 addition & 1 deletion audio/klang/filter/volume.go
Expand Up @@ -2,7 +2,7 @@ package filter

import (
"github.com/oakmound/oak/v3/audio/klang/filter/supports"
"github.com/oakmound/oak/v3/audio/klang/manip"
"github.com/oakmound/oak/v3/audio/klang/internal/manip"
)

// Volume will magnify the data by mult, increasing or reducing the volume
Expand Down
File renamed without changes.
Expand Up @@ -26,7 +26,7 @@ func GetFloat64(d []byte, i int, byteDepth uint16) float64 {
return 0.0
}

func SetInt16_f64(d []byte, i int, in float64) {
func SetInt16F64(d []byte, i int, in float64) {
SetInt16(d, i, int64(in*32768))
}

Expand Down

0 comments on commit 314b923

Please sign in to comment.