func TestLoadFloat32bitLittleEndian48000HzEstéreo(t *testing.T) { debug.Configure(true) testSourceSetup(48000, 2) source := New("testdata/Float32bitLittleEndian48000HzEstéreo.wav") assert.NotNil(t, source) totalSoundMovement := testSourceAssertSound(t, source, 2) assert.True(t, totalSoundMovement > .001) }
func TestLoadSigned16bitLittleEndian44100HzMono(t *testing.T) { debug.Configure(true) testSourceSetup(44100, 1) source := New("testdata/Signed16bitLittleEndian44100HzMono.wav") assert.NotNil(t, source) totalSoundMovement := testSourceAssertSound(t, source, 1) assert.True(t, totalSoundMovement > .001) }
func TestLoad_IntVsFloat(t *testing.T) { debug.Configure(true) testSourceSetup(44100, 1) sourceFloat := New("testdata/Float32bitLittleEndian48000HzEstéreo.wav") assert.NotNil(t, sourceFloat) assert.Equal(t, spec.AudioF32, sourceFloat.Spec().Format) sourceInt := New("testdata/Signed16bitLittleEndian44100HzMono.wav") assert.NotNil(t, sourceInt) assert.Equal(t, spec.AudioS16, sourceInt.Spec().Format) }
func TestLoad_FAIL(t *testing.T) { pathFail := "testdata/ThisShouldFailBecauseItDoesNotExist.wav" defer func() { msg := recover() assert.IsType(t, "", msg) assert.Equal(t, "File not found: "+pathFail, msg) }() debug.Configure(true) testSourceSetup(44100, 1) source := New(pathFail) assert.NotNil(t, source) }
// Debug ON/OFF (ripples down to all sub-modules) func Debug(isOn bool) { debug.Configure(isOn) }