Ejemplo n.º 1
0
        private void VirtualVoices_Load(object sender, System.EventArgs e)
        {
            FMOD.RESULT result;

            /*
             *  Create a System object and initialize.
             */
            result = FMOD.Factory.System_Create(ref system);
            ERRCHECK(result);

            result = system.setSoftwareChannels(NUMREALCHANNELS);
            ERRCHECK(result);

            result = system.init(NUMCHANNELS, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
            ERRCHECK(result);

            result = system.createSound("../../../../../examples/media/drumloop.wav", (FMOD.MODE.SOFTWARE | FMOD.MODE._3D | FMOD.MODE.LOOP_NORMAL), ref sound);
            ERRCHECK(result);

            result = sound.set3DMinMaxDistance(4.0f, 10000.0f);
            ERRCHECK(result);

            /*
             *  Create a listener in the middle of the window
             */
            mListener = new Listener(system, WIDTH / 2, HEIGHT / 2);

            /*
             *  Initialise all of the sound sources
             */
            Random r = new Random();

            mSoundSource = new SoundSource[NUMCHANNELS];

            for (int count = 0; count < NUMCHANNELS; count++)
            {
                mSoundSource[count] = new SoundSource(system, sound, r.Next(this.Width), r.Next(this.Height));
            }
        }
Ejemplo n.º 2
0
        private void VirtualVoices_Load(object sender, System.EventArgs e)
        {
            FMOD.RESULT result;

            /*
                Create a System object and initialize.
            */
            result = FMOD.Factory.System_Create(ref system);
            ERRCHECK(result);

            result = system.setSoftwareChannels(NUMREALCHANNELS);
            ERRCHECK(result);

            result = system.init(NUMCHANNELS, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
            ERRCHECK(result);

            result = system.createSound("../../../../../examples/media/drumloop.wav", (FMOD.MODE.SOFTWARE | FMOD.MODE._3D | FMOD.MODE.LOOP_NORMAL), ref sound);
            ERRCHECK(result);

            result = sound.set3DMinMaxDistance(4.0f, 10000.0f);
            ERRCHECK(result);

            /*
                Create a listener in the middle of the window
            */
            mListener = new Listener(system, WIDTH/2, HEIGHT/2);

            /*
                Initialise all of the sound sources
            */
            Random r = new Random();

            mSoundSource = new SoundSource[NUMCHANNELS];

            for (int count = 0; count < NUMCHANNELS; count++)
            {
                mSoundSource[count] = new SoundSource(system, sound, r.Next(this.Width), r.Next(this.Height));
            }
        }
Ejemplo n.º 3
0
        private void Form_MouseDown(object  sender, System.Windows.Forms.MouseEventArgs e)
        {
            mSelectedSource = null;

            /*
                Check if the listener was selected
            */
            if (mListener.IsSelected(e.X, e.Y))
            {
                mSelected = true;
                return;
            }

            /*
                Check if a sound source was selected
            */
            for (int count = 0; count < NUMCHANNELS; count++)
            {
                if (mSoundSource[count].IsSelected(e.X, e.Y))
                {
                    mSelectedSource = mSoundSource[count];
                    mSelected = true;
                    return;
                }
            }
        }