-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #159 from oakmound/release/3.0.0-2-perf
Release/3.0.0 Beta 1
- Loading branch information
Showing
277 changed files
with
7,968 additions
and
3,489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Package flac provides functionality to handle .flac files and .flac encoded data | ||
package flac | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
|
||
"github.com/eaburns/flac" | ||
audio "github.com/oakmound/oak/v3/audio/klang" | ||
) | ||
|
||
// def flac format | ||
var format = audio.Format{ | ||
SampleRate: 44100, | ||
Bits: 16, | ||
Channels: 2, | ||
} | ||
|
||
// Load loads flac data from the incoming reader as an audio | ||
func Load(r io.Reader) (audio.Audio, error) { | ||
data, meta, err := flac.Decode(r) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to load flac: %w", err) | ||
} | ||
|
||
fformat := audio.Format{ | ||
SampleRate: uint32(meta.SampleRate), | ||
Channels: uint16(meta.NChannels), | ||
Bits: uint16(meta.BitsPerSample), | ||
} | ||
return audio.EncodeBytes( | ||
audio.Encoding{ | ||
Data: data, | ||
Format: fformat, | ||
}) | ||
} | ||
|
||
// Save will eventually save an audio encoded as flac to the given writer | ||
func Save(r io.ReadWriter, a audio.Audio) error { | ||
return fmt.Errorf("unsupported Functionality") | ||
} | ||
|
||
// Format returns the default flac formatting | ||
func Format() audio.Format { | ||
return format | ||
} |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.