Skip to content

Commit d2dbdae

Browse files
Add files via upload
1 parent 888f899 commit d2dbdae

5 files changed

Lines changed: 184 additions & 0 deletions

File tree

BASSdotNetExample.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34525.116
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BASSdotNetExample", "BASSdotNetExample\BASSdotNetExample.csproj", "{66EDCBE2-4C6C-4150-9FD8-1F3FA7911737}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{66EDCBE2-4C6C-4150-9FD8-1F3FA7911737}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{66EDCBE2-4C6C-4150-9FD8-1F3FA7911737}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{66EDCBE2-4C6C-4150-9FD8-1F3FA7911737}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{66EDCBE2-4C6C-4150-9FD8-1F3FA7911737}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {9A5695FB-16A9-4F0F-981D-ABA11CC6549F}
24+
EndGlobalSection
25+
EndGlobal

BASSdotNetExample/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
5+
</startup>
6+
</configuration>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{66EDCBE2-4C6C-4150-9FD8-1F3FA7911737}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>BASSdotNetExample</RootNamespace>
10+
<AssemblyName>BASSdotNetExample</AssemblyName>
11+
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>x64</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>0</WarningLevel>
34+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<Reference Include="BASSdotNET, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
38+
<SpecificVersion>False</SpecificVersion>
39+
<HintPath>..\..\BASSdotNET\BASSdotNET\bin\Release\BASSdotNET.dll</HintPath>
40+
</Reference>
41+
<Reference Include="System" />
42+
<Reference Include="System.Core" />
43+
<Reference Include="System.Xml.Linq" />
44+
<Reference Include="System.Data.DataSetExtensions" />
45+
<Reference Include="Microsoft.CSharp" />
46+
<Reference Include="System.Data" />
47+
<Reference Include="System.Net.Http" />
48+
<Reference Include="System.Xml" />
49+
</ItemGroup>
50+
<ItemGroup>
51+
<Compile Include="Program.cs" />
52+
<Compile Include="Properties\AssemblyInfo.cs" />
53+
</ItemGroup>
54+
<ItemGroup>
55+
<None Include="App.config" />
56+
</ItemGroup>
57+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
58+
</Project>

BASSdotNetExample/Program.cs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Runtime.InteropServices;
6+
using System.Text;
7+
using System.Threading;
8+
using System.Threading.Tasks;
9+
using BASSdotNET;
10+
11+
namespace BASSdotNetExample
12+
{
13+
internal class Program
14+
{
15+
[DllImport("kernel32.dll")]
16+
private static extern Int32 WideCharToMultiByte(UInt32 CodePage, UInt32 dwFlags, [MarshalAs(UnmanagedType.LPWStr)] String lpWideCharStr, Int32 cchWideChar, [Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder lpMultiByteStr, Int32 cbMultiByte, IntPtr lpDefaultChar, IntPtr lpUsedDefaultChar);
17+
18+
public static string Utf16ToUtf8(string utf16String)
19+
{
20+
Int32 iNewDataLen = WideCharToMultiByte(Convert.ToUInt32(Encoding.UTF8.CodePage), 0, utf16String, utf16String.Length, null, 0, IntPtr.Zero, IntPtr.Zero);
21+
if (iNewDataLen > 1)
22+
{
23+
StringBuilder utf8String = new StringBuilder(iNewDataLen);
24+
WideCharToMultiByte(Convert.ToUInt32(Encoding.UTF8.CodePage), 0, utf16String, -1, utf8String, utf8String.Capacity, IntPtr.Zero, IntPtr.Zero);
25+
26+
return utf8String.ToString();
27+
}
28+
else
29+
{
30+
return String.Empty;
31+
}
32+
}
33+
static void Main(string[] args)
34+
{
35+
Console.WriteLine("Hello World from BASS.NET Library!!!");
36+
BASS bass = new BASS();
37+
if(bass.Init_Bass(-1, 48000, 0, 0, 0))
38+
{
39+
Console.WriteLine("Initializated Successfully");
40+
if (bass.START())
41+
{
42+
Console.WriteLine("STARTED!!!");
43+
UInt32 str = bass.CreateBASS_FileStream(0, Utf16ToUtf8("SixFeetUnderground.mp3"), 0, 0, 0x4);
44+
if(str == 0)
45+
{
46+
Console.WriteLine("BASS.DLL IS FAILED TO CREATING FILE STREAM!!!");
47+
Environment.Exit(323);
48+
}
49+
Console.WriteLine(str);
50+
bass.ChannelPlay(str, false);
51+
while(true)
52+
{
53+
Thread.Sleep(4000);
54+
}
55+
}
56+
}
57+
}
58+
}
59+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("BASSdotNetExample")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("BASSdotNetExample")]
13+
[assembly: AssemblyCopyright("Copyright © 2024")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("66edcbe2-4c6c-4150-9fd8-1f3fa7911737")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)