Ajouts de musique et irrKlang.
This commit is contained in:
32
SQCSim2021/external/irrKlang-1.6.0/examples.net/VisualBasic.02.3DSound/AssemblyInfo.vb
vendored
Normal file
32
SQCSim2021/external/irrKlang-1.6.0/examples.net/VisualBasic.02.3DSound/AssemblyInfo.vb
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' General Information about an assembly is controlled through the following
|
||||
' set of attributes. Change these attribute values to modify the information
|
||||
' associated with an assembly.
|
||||
|
||||
' Review the values of the assembly attributes
|
||||
|
||||
<Assembly: AssemblyTitle("")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("")>
|
||||
<Assembly: AssemblyCopyright("")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: CLSCompliant(True)>
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("38FD6193-1EF1-42FA-A6C8-D843B89BFABE")>
|
||||
|
||||
' Version information for an assembly consists of the following four values:
|
||||
'
|
||||
' Major Version
|
||||
' Minor Version
|
||||
' Build Number
|
||||
' Revision
|
||||
'
|
||||
' You can specify all the values or you can default the Build and Revision Numbers
|
||||
' by using the '*' as shown below:
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.*")>
|
122
SQCSim2021/external/irrKlang-1.6.0/examples.net/VisualBasic.02.3DSound/Module1.vb
vendored
Normal file
122
SQCSim2021/external/irrKlang-1.6.0/examples.net/VisualBasic.02.3DSound/Module1.vb
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
Imports IrrKlang
|
||||
|
||||
Module Module1
|
||||
|
||||
Sub Main()
|
||||
|
||||
' start up the engine
|
||||
Dim engine As New ISoundEngine
|
||||
|
||||
' Now play some sound stream as music in 3d space, looped.
|
||||
' We play it at position (0,0,0) in 3d space
|
||||
|
||||
Dim music As ISound = engine.Play3D("../../media/ophelia.mp3", 0, 0, 0, True)
|
||||
|
||||
' the following step isn't necessary, but to adjust the distance where
|
||||
' the 3D sound can be heard, we set some nicer minimum distance
|
||||
' (the default min distance is 1, for a small object). The minimum
|
||||
' distance simply is the distance in which the sound gets played
|
||||
' at maximum volume.
|
||||
|
||||
If Not (music Is Nothing) Then
|
||||
music.MinDistance = 5.0F
|
||||
End If
|
||||
|
||||
' Print some help text and start the display loop
|
||||
|
||||
Console.Out.Write(ControlChars.CrLf & "Playing streamed sound in 3D.")
|
||||
Console.Out.WriteLine(ControlChars.CrLf & "Press ESCAPE to quit, any other key to play sound at random position." & ControlChars.CrLf)
|
||||
|
||||
Console.Out.WriteLine("+ = Listener position")
|
||||
Console.Out.WriteLine("o = Playing sound")
|
||||
|
||||
Dim rand As Random = New Random
|
||||
Dim radius As Single = 5
|
||||
Dim posOnCircle As Single = 5
|
||||
|
||||
While (True) ' endless loop until user exits
|
||||
|
||||
' Each step we calculate the position of the 3D music.
|
||||
' For this example, we let the
|
||||
' music position rotate on a circle:
|
||||
|
||||
posOnCircle += 0.0399999991F
|
||||
Dim pos3D As Vector3D = New Vector3D(radius * Math.Cos(posOnCircle), 0, _
|
||||
radius * Math.Sin(posOnCircle * 0.5F))
|
||||
|
||||
' After we know the positions, we need to let irrKlang know about the
|
||||
' listener position (always position (0,0,0), facing forward in this example)
|
||||
' and let irrKlang know about our calculated 3D music position
|
||||
|
||||
engine.SetListenerPosition(0, 0, 0, 0, 0, 1)
|
||||
|
||||
If Not (music Is Nothing) Then
|
||||
music.Position = pos3D
|
||||
End If
|
||||
|
||||
' Now print the position of the sound in a nice way to the console
|
||||
' and also print the play position
|
||||
|
||||
Dim stringForDisplay As String = " + "
|
||||
Dim charpos As Integer = Math.Floor((CSng(pos3D.X + radius) / radius * 10.0F))
|
||||
If (charpos >= 0 And charpos < 20) Then
|
||||
stringForDisplay = stringForDisplay.Remove(charpos, 1)
|
||||
stringForDisplay = stringForDisplay.Insert(charpos, "o")
|
||||
End If
|
||||
|
||||
Dim playPos As Integer
|
||||
If Not (music Is Nothing) Then
|
||||
playPos = Integer.Parse(music.PlayPosition.ToString) ' how to convert UInt32 to Integer in visual basic?
|
||||
End If
|
||||
|
||||
Dim output As String = ControlChars.Cr & String.Format("x:({0}) 3dpos: {1:f} {2:f} {3:f}, playpos:{4}:{5:00} ", _
|
||||
stringForDisplay, pos3D.X, pos3D.Y, pos3D.Z, _
|
||||
playPos \ 60000, (playPos Mod 60000) / 1000)
|
||||
|
||||
Console.Write(output)
|
||||
|
||||
System.Threading.Thread.Sleep(100)
|
||||
|
||||
' Handle user input: Every time the user presses a key in the console,
|
||||
' play a random sound or exit the application if he pressed ESCAPE.
|
||||
|
||||
If _kbhit() <> 0 Then
|
||||
Dim key As Integer = _getch()
|
||||
|
||||
If (key = 27) Then
|
||||
Return ' user pressed ESCAPE key
|
||||
Else
|
||||
|
||||
' Play random sound at some random position.
|
||||
|
||||
Dim pos As Vector3D = New Vector3D((rand.NextDouble() Mod radius * 2.0F) - radius, 0, 0)
|
||||
|
||||
Dim filename As String
|
||||
|
||||
If (rand.Next() Mod 2 <> 0) Then
|
||||
filename = "../../media/bell.wav"
|
||||
Else
|
||||
filename = "../../media/explosion.wav"
|
||||
End If
|
||||
|
||||
engine.Play3D(filename, pos.X, pos.Y, pos.Z)
|
||||
|
||||
Console.WriteLine(ControlChars.CrLf & "playing {0} at {1:f} {2:f} {3:f}", _
|
||||
filename, pos.X, pos.Y, pos.Z)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End While
|
||||
|
||||
End Sub
|
||||
|
||||
' some simple function for reading keys from the console
|
||||
<System.Runtime.InteropServices.DllImport("msvcrt")> _
|
||||
Public Function _getch() As Integer
|
||||
End Function
|
||||
<System.Runtime.InteropServices.DllImport("msvcrt")> _
|
||||
Public Function _kbhit() As Integer
|
||||
End Function
|
||||
|
||||
End Module
|
@@ -0,0 +1,19 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VisualBasic.02.3DSound", "VisualBasic.02.3DSound.vbproj", "{C03B0E11-9BB1-4E8E-AF4D-5374AC9E47EE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C03B0E11-9BB1-4E8E-AF4D-5374AC9E47EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C03B0E11-9BB1-4E8E-AF4D-5374AC9E47EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C03B0E11-9BB1-4E8E-AF4D-5374AC9E47EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C03B0E11-9BB1-4E8E-AF4D-5374AC9E47EE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
108
SQCSim2021/external/irrKlang-1.6.0/examples.net/VisualBasic.02.3DSound/VisualBasic.02.3DSound.vbproj
vendored
Normal file
108
SQCSim2021/external/irrKlang-1.6.0/examples.net/VisualBasic.02.3DSound/VisualBasic.02.3DSound.vbproj
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{C03B0E11-9BB1-4E8E-AF4D-5374AC9E47EE}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>VisualBasic.02.3DSound</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
<AssemblyOriginatorKeyMode>None</AssemblyOriginatorKeyMode>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Exe</OutputType>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
<RootNamespace>VisualBasic._02._3DSound</RootNamespace>
|
||||
<StartupObject>VisualBasic._02._3DSound.Module1</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<MyType>Console</MyType>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>..\..\bin\dotnet-1.1\</OutputPath>
|
||||
<DocumentationFile>VisualBasic.02.3DSound.xml</DocumentationFile>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>1</WarningLevel>
|
||||
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>..\..\bin\dotnet-1.1\</OutputPath>
|
||||
<DocumentationFile>VisualBasic.02.3DSound.xml</DocumentationFile>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>1</WarningLevel>
|
||||
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="irrKlang.NET">
|
||||
<Name>irrKlang.NET</Name>
|
||||
<HintPath>..\..\bin\dotnet-1.1\irrKlang.NET.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<Name>System.Data</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<Name>System.XML</Name>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AssemblyInfo.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Module1.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
Reference in New Issue
Block a user