This commit is contained in:
parent
c3d290f512
commit
d668ae6286
|
@ -25,7 +25,7 @@ const TestSingleSample24 = "resources/samples/cYsmix - Haunted House/11. The Gre
|
|||
const TestSingleSample16 = "resources/samples/Babbe Music - RADIANT DANCEFLOOR/01. ENTER.flac"
|
||||
const TestSingleSample16TTA = "resources/samples/Babbe Music - RADIANT DANCEFLOOR/01. ENTER.tta"
|
||||
|
||||
func doTest(format format.Format, ext string, t *testing.T) {
|
||||
func doTest(format format.Decoder, ext string, t *testing.T) {
|
||||
for _, location := range TestSampleLocations {
|
||||
entries, err := os.ReadDir(location)
|
||||
if err != nil {
|
||||
|
|
10
README.md
10
README.md
|
@ -24,6 +24,16 @@ sudo apt install libflac-dev
|
|||
sudo apt install libopus-dev libopusfile-dev
|
||||
```
|
||||
|
||||
### [libopusenc](https://github.com/xiph/libopusenc) (required by [go-pus](https://git.gammaspectra.live/S.O.N.G/go-pus))
|
||||
```shell
|
||||
git clone --depth https://github.com/xiph/libopusenc.git
|
||||
cd libopusenc
|
||||
./autogen.sh
|
||||
./configure --prefix /usr
|
||||
make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
### [LAME](https://lame.sourceforge.io/) (required by [go-lame](hhttps://github.com/viert/go-lame))
|
||||
```shell
|
||||
sudo apt install libmp3lame-dev
|
||||
|
|
|
@ -9,10 +9,18 @@ import (
|
|||
|
||||
const chanBuf = 16
|
||||
|
||||
type AnalyzerPacket struct {
|
||||
//Samples interleaved samples
|
||||
Samples []int32
|
||||
Channels int
|
||||
SampleRate int
|
||||
BitDepth int
|
||||
}
|
||||
|
||||
type AnalyzerChannel chan *AnalyzerPacket
|
||||
|
||||
type AnalyzerFormat interface {
|
||||
Format
|
||||
type AnalyzerDecoder interface {
|
||||
Decoder
|
||||
// OpenAnalyzer Opens a stream and decodes it into an audio.Source, and additionally copy AnalyzerPacket back
|
||||
OpenAnalyzer(r io.ReadSeekCloser) (audio.Source, AnalyzerChannel, error)
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
type Format struct {
|
||||
format.AnalyzerFormat
|
||||
format.AnalyzerDecoder
|
||||
format.Encoder
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,6 @@ import (
|
|||
type Format interface {
|
||||
// Identify checks whether a format is of a type. peek includes a few first bytes, extension is the lowercase file extension without a dot.
|
||||
Identify(peek []byte, extension string) bool
|
||||
|
||||
// Open Opens a stream and decodes it into an audio.Source
|
||||
Open(r io.ReadSeekCloser) (audio.Source, error)
|
||||
}
|
||||
|
||||
type WriteSeekCloser interface {
|
||||
|
@ -19,16 +16,14 @@ type WriteSeekCloser interface {
|
|||
io.Seeker
|
||||
}
|
||||
|
||||
type Decoder interface {
|
||||
Format
|
||||
// Open a stream and decodes it into an audio.Source
|
||||
Open(r io.ReadSeekCloser) (audio.Source, error)
|
||||
}
|
||||
|
||||
type Encoder interface {
|
||||
Format
|
||||
// Encode Receives an audio.Source and encodes it into a writer. Some formats can do special operations if writer is also an io.Seeker
|
||||
Encode(source audio.Source, writer io.WriteCloser, options map[string]interface{}) error
|
||||
}
|
||||
|
||||
type AnalyzerPacket struct {
|
||||
//Samples interleaved samples
|
||||
Samples []int32
|
||||
Channels int
|
||||
SampleRate int
|
||||
BitDepth int
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
const BlockSize = 1024 * 128
|
||||
|
||||
type Format struct {
|
||||
format.Format
|
||||
format.Decoder
|
||||
format.Encoder
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ const FixedSampleRate int = 48000
|
|||
const BlockSize = 1024 * 128
|
||||
|
||||
type Format struct {
|
||||
format.Format
|
||||
format.Decoder
|
||||
format.Encoder
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,7 @@ import (
|
|||
const BlockSize = 1024 * 128
|
||||
|
||||
type Format struct {
|
||||
format.Format
|
||||
format.Encoder
|
||||
format.AnalyzerDecoder
|
||||
}
|
||||
|
||||
func NewFormat() Format {
|
||||
|
|
Loading…
Reference in a new issue