ManagedBass.Dts 0.2.2

dotnet add package ManagedBass.Dts --version 0.2.2                
NuGet\Install-Package ManagedBass.Dts -Version 0.2.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ManagedBass.Dts" Version="0.2.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ManagedBass.Dts --version 0.2.2                
#r "nuget: ManagedBass.Dts, 0.2.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ManagedBass.Dts as a Cake Addin
#addin nuget:?package=ManagedBass.Dts&version=0.2.2

// Install ManagedBass.Dts as a Cake Tool
#tool nuget:?package=ManagedBass.Dts&version=0.2.2                

BASS_DTS

A DTS decoder plugin for BASS which uses the libdcadec library with .NET bindings.

bass.dll is required for native projects. ManagedBass is required for .NET projects.

A simple example;

public void Main()
{
    if (!Bass.Init(Bass.DefaultDevice))
    {
        Assert.Fail(string.Format("Failed to initialize BASS: {0}", Enum.GetName(typeof(Errors), Bass.LastError)));
    }

    //Load as a plugin if you like.
    if (!BassDts.Load())
    {
        Assert.Fail("Failed to load DTS.");
    }

    //Use one of these.
    var sourceChannel = Bass.CreateStream(Path.Combine(CurrentDirectory, this.FileName), 0, 0, this.BassFlags);
    var sourceChannel = BassDts.CreateStream(Path.Combine(CurrentDirectory, this.FileName), 0, 0, this.BassFlags);
    if (sourceChannel == 0)
    {
        Assert.Fail(string.Format("Failed to create source stream: {0}", Enum.GetName(typeof(Errors), Bass.LastError)));
    }

    var channelInfo = default(ChannelInfo);
    if (!Bass.ChannelGetInfo(sourceChannel, out channelInfo))
    {
        Assert.Fail(string.Format("Failed to get stream info: {0}", Enum.GetName(typeof(Errors), Bass.LastError)));
    }

    if (!Bass.ChannelPlay(sourceChannel))
    {
        Assert.Fail(string.Format("Failed to play the playback stream: {0}", Enum.GetName(typeof(Errors), Bass.LastError)));
    }

    var channelLength = Bass.ChannelGetLength(sourceChannel);
    var channelLengthSeconds = Bass.ChannelBytes2Seconds(sourceChannel, channelLength);

    do
    {
        if (Bass.ChannelIsActive(sourceChannel) == PlaybackState.Stopped)
        {
            break;
        }

        var channelPosition = Bass.ChannelGetPosition(sourceChannel);
        var channelPositionSeconds = Bass.ChannelBytes2Seconds(sourceChannel, channelPosition);

        Debug.WriteLine(
            "{0}/{1}",
            TimeSpan.FromSeconds(channelPositionSeconds).ToString("g"),
            TimeSpan.FromSeconds(channelLengthSeconds).ToString("g")
        );

        Thread.Sleep(1000);
    } while (true);

    if (!Bass.StreamFree(sourceChannel))
    {
        Assert.Fail(string.Format("Failed to free the source stream: {0}", Enum.GetName(typeof(Errors), Bass.LastError)));
    }

    if (!Bass.Free())
    {
        Assert.Fail(string.Format("Failed to free BASS: {0}", Enum.GetName(typeof(Errors), Bass.LastError)));
    }
}

As of 0.2.0 (4e9f449dc0dd2b9aafecb651c0af750f6653aba0) this library is working as a BASS plugin. This means you only need to include bass_dts.dll with your application (with your other codecs, likely in the addon folder). One caviat is that BASS will prefer a built in codec if it finds a header, I have observed .dts files with WAVE/RIFF headers that cause BASS to play the file as wav. As plugin codec association is only by file extension, I don't think there's a way to prevent this behaviour.

If this is an issue to you then continue to use BASS_DTS_StreamCreateFile/BassDts.CreateStream.

Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.0

    • No dependencies.
  • .NETFramework 4.6.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.2 1,304 10/18/2022
0.2.1 662 7/3/2022
0.2.0 450 7/1/2021
0.1.1 610 5/9/2019
0.1.0 620 4/22/2019