[PR]
×
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
プログラミング、3DCGとその他いろいろについて
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
using System; using System.Runtime.InteropServices; using System.Threading; class Program { //OpenAL Utility Toolkit (Alut)の関数をインポート [DllImport("alut.dll")] static extern bool alutInit(IntPtr argcp, string[] argv); [DllImport("alut.dll")] static extern bool alutExit(); [DllImport("alut.dll")] static extern int alutCreateBufferHelloWorld(); //OpenALの関数をインポート [DllImport("OpenAL32.dll")] static extern void alGenSources(int resultSize, int[] result); [DllImport("OpenAL32.dll")] static extern void alDeleteSources(int nameCount, int[] sourceNames); [DllImport("OpenAL32.dll")] static extern void alSourcei(int sourceName, int propertyType, int value); const int AL_BUFFER = 0x1009; [DllImport("OpenAL32.dll")] static extern void alSourcePlay(int sourceName); [DllImport("OpenAL32.dll")] static extern void alSource3f( int sourceName, int propertyType, float v1, float v2, float v3 ); const int AL_POSITION = 0x1004; static void Main() { alutInit(IntPtr.Zero, null); int[] sources = new int[1]; alGenSources(sources.Length, sources); alSourcei(sources[0], AL_BUFFER, alutCreateBufferHelloWorld()); for (int i = 0; i < 4; i++) { alSource3f(sources[0], AL_POSITION, 0, 0, -i); alSourcePlay(sources[0]); Thread.Sleep(1500); } alDeleteSources(sources.Length, sources); alutExit(); } }
using System; using System.Runtime.InteropServices; using System.Threading; class Program { //OpenAL Utility Toolkit (Alut)の関数をインポート [DllImport("alut.dll")] static extern bool alutInit(IntPtr argcp, string[] argv); [DllImport("alut.dll")] static extern bool alutExit(); [DllImport("alut.dll")] static extern int alutCreateBufferHelloWorld(); //OpenALの関数をインポート [DllImport("OpenAL32.dll")] static extern void alGenSources(int resultSize, int[] result); [DllImport("OpenAL32.dll")] static extern void alDeleteSources(int nameCount, int[] sourceNames); [DllImport("OpenAL32.dll")] static extern void alSourcei(int sourceName, int propertyType, int value); const int AL_BUFFER = 0x1009; [DllImport("OpenAL32.dll")] static extern void alSourcePlay(int sourceName); const int AL_POSITION = 0x1004; [DllImport("OpenAL32.dll")] static extern void alListener3f(int propertyType, float x, float y, float z); static void Main() { alutInit(IntPtr.Zero, null); int[] sources = new int[1]; alGenSources(sources.Length, sources); alSourcei(sources[0], AL_BUFFER, alutCreateBufferHelloWorld()); for (int i = 0; i < 4; i++) { alListener3f(AL_POSITION, 0, 0, i); alSourcePlay(sources[0]); Thread.Sleep(1500); } alDeleteSources(sources.Length, sources); alutExit(); } }