Exemple #1
0
        IEnumerator Start()
        {
            this.gameObjectName = this.gameObject.name;

            // setup the AudioSource
            var audiosrc = this.GetComponent <AudioSource>();

            audiosrc.playOnAwake = false;
            audiosrc.Stop();
            audiosrc.clip = null;

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

            result = system.getVersion(out version);
            ERRCHECK(result, "system.getVersion");

            if (version < FMOD.VERSION.number)
            {
                var msg = string.Format("FMOD lib version {0} doesn't match header version {1}", version, FMOD.VERSION.number);

                if (this.OnError != null)
                {
                    this.OnError.Invoke(this.gameObjectName, msg);
                }

                throw new System.Exception(msg);
            }

            /*
             * System initialization
             */
            result = system.init(100, FMOD.INITFLAGS.NORMAL, System.IntPtr.Zero);
            ERRCHECK(result, "system.init");

            // wait for FMDO to catch up and pause - recordDrivers are not populated if called immediately [e.g. from Start]
            yield return(new WaitForSeconds(1f));

            if (this.recordOnStart)
            {
                StartCoroutine(this.Record());
            }

            this.ready = true;
        }
Exemple #2
0
        public Media()
        {
            uint version = 0;

            FMOD.RESULT result;

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

            result = soundsystem.getVersion(ref version);
            ERRCHECK(result);


            if (version < FMOD.VERSION.number)
            {
                MessageBox.Show("Error!  You are using an old version of FMOD " + version.ToString("X") + ".  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
                Application.Exit();
            }

            result = soundsystem.init(32, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
            ERRCHECK(result);

            LoadFromResource();
        }
Exemple #3
0
        /// <summary>
        /// Initialize The Audio Engine
        /// </summary>
        /// <param name="NbChannel">Set Number Of Maximum Channels To Use</param>
        public void Initialize()
        {
            RESULT result;

            result = Factory.System_Create(ref system);
            if (EngineError != null)
            {
                EngineError(result);
            }

            uint version = 0;

            result = system.getVersion(ref version);
            if (EngineError != null)
            {
                EngineError(result);
            }

            if (version < VERSION.number)
            {
                throw new ApplicationException("Error! You are using an old version of FMOD " + version.ToString("X") + ". This program requires " + VERSION.number.ToString("X") + ".");
            }

            result = system.init(1, INITFLAG.NORMAL, (IntPtr)null);
            if (EngineError != null)
            {
                EngineError(result);
            }
            channelCallback = new CHANNEL_CALLBACK(OnEndMusic);
        }
Exemple #4
0
        /// <summary>
        /// Initialize the sound manager and FMOD engine.
        /// </summary>
        public void Initialize()
        {
            //Initialize FMOD
            RESULT Result = m_System.init(Global.MAX_SOUNDCHANNEL, INITFLAGS.NORMAL, (System.IntPtr)null);

            //If speaker mode is not supporterd
            if (Result == RESULT.ERR_OUTPUT_CREATEBUFFER)
            {
                //Reset to stereo
                CheckError(m_System.setSpeakerMode(SPEAKERMODE.STEREO));
                CheckError(m_System.init(Global.MAX_SOUNDCHANNEL, INITFLAGS.NORMAL, (System.IntPtr)null));
            }

            //Logging
            Global.Logger.AddLine("Sound manager initialized.");
        }
Exemple #5
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            uint version = 0;

            FMOD.RESULT result;

            mBrushBlack = new SolidBrush(Color.Black);
            mBrushGreen = new SolidBrush(Color.Green);
            mBrushWhite = new SolidBrush(Color.White);

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

            result = system.getVersion(ref version);
            ERRCHECK(result);
            if (version < FMOD.VERSION.number)
            {
                MessageBox.Show("Error!  You are using an old version of FMOD " + version.ToString("X") + ".  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
                Application.Exit();
            }

            result = system.init(32, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
            ERRCHECK(result);
        }
        private void RipNetStream_Load(object sender, System.EventArgs e)
        {
            uint version = 0;

            FMOD.RESULT result;

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

            result = system.getVersion(ref version);
            ERRCHECK(result);
            if (version < FMOD.VERSION.number)
            {
                MessageBox.Show("Error!  You are using an old version of FMOD " + version.ToString("X") + ".  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
                Application.Exit();
            }
            result = system.init(100, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
            ERRCHECK(result);

            /*
             *  Bump up the file buffer size a little bit for netstreams (to account for lag).  Decode buffer is left at default.
             */
            result = system.setStreamBufferSize(128 * 1024, FMOD.TIMEUNIT.RAWBYTES);
            ERRCHECK(result);

            result = system.attachFileSystem(opencallback, closecallback, readcallback, null);
            ERRCHECK(result);
        }
Exemple #7
0
        private void PlaySound_Load(object sender, System.EventArgs e)
        {
            uint version = 0;

            FMOD.RESULT result;

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

            result = system.getVersion(ref version);
            ERRCHECK(result);
            if (version < FMOD.VERSION.number)
            {
                MessageBox.Show("Error!  You are using an old version of FMOD " + version.ToString("X") + ".  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
                Application.Exit();
            }

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

            result = system.createSound("../../../../../examples/media/drumloop.wav", FMOD.MODE.HARDWARE, ref sound1);
            ERRCHECK(result);

            result = sound1.setMode(FMOD.MODE.LOOP_OFF);
            ERRCHECK(result);

            result = system.createSound("../../../../../examples/media/jaguar.wav", FMOD.MODE.SOFTWARE, ref sound2);
            ERRCHECK(result);

            result = system.createSound("../../../../../examples/media/swish.wav", FMOD.MODE.HARDWARE, ref sound3);
            ERRCHECK(result);
        }
Exemple #8
0
        public override void Init()
        {
            base.Init();

            FMOD.Factory.System_Create(out soundSystem);
            soundSystem.init(1024, FMOD.INITFLAGS._3D_RIGHTHANDED, (IntPtr)0);
        }
Exemple #9
0
        private void UserCreatedSound_Load(object sender, System.EventArgs e)
        {
            uint version = 0;

            FMOD.RESULT result;
            uint        channels = 2, frequency = 44100;

            /*
             *  Create a System object and initialize.
             */
            result = FMOD.Factory.System_Create(ref system);
            ERRCHECK(result);
            result = system.getVersion(ref version);
            ERRCHECK(result);
            if (version < FMOD.VERSION.number)
            {
                MessageBox.Show("Error!  You are using an old version of FMOD " + version.ToString("X") + ".  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
                Application.Exit();
            }
            result = system.init(32, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
            ERRCHECK(result);

            createsoundexinfo.cbsize            = Marshal.SizeOf(createsoundexinfo);
            createsoundexinfo.fileoffset        = 0;
            createsoundexinfo.length            = frequency * channels * 2 * 2;
            createsoundexinfo.numchannels       = (int)channels;
            createsoundexinfo.defaultfrequency  = (int)frequency;
            createsoundexinfo.format            = FMOD.SOUND_FORMAT.PCM16;
            createsoundexinfo.pcmreadcallback   = pcmreadcallback;
            createsoundexinfo.pcmsetposcallback = pcmsetposcallback;
            createsoundexinfo.dlsname           = null;
        }
Exemple #10
0
        private MusicPlayer()
        {
            result = FMOD.Factory.System_Create(out FMODSystem);

            if (result != FMOD.RESULT.OK)
            {
                throw new Exception("This crap didn't work!!");
            }

            result = FMODSystem.setDSPBufferSize(1024, 10);
            result = FMODSystem.init(32, FMOD.INITFLAGS.NORMAL, (IntPtr)0);

            var info = new FMOD.CREATESOUNDEXINFO();
            var song = new FMOD.Sound();

            ChannelGroup = new FMOD.ChannelGroup();
            ChannelGroup.clearHandle();

            result = FMODSystem.createStream("rain.ogg", FMOD.MODE.DEFAULT, out song);

            result = FMODSystem.playSound(song, ChannelGroup, false, out Channel);



            bool isPlaying = false;

            Channel.isPlaying(out isPlaying);

            Channel.setVolume(1);
            Channel.setMode(FMOD.MODE.LOOP_NORMAL);
            Channel.setLoopCount(-1);

            int t = 1;
        }
Exemple #11
0
        private void comboBoxRecord_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            FMOD.CREATESOUNDEXINFO exinfo = new FMOD.CREATESOUNDEXINFO();
            FMOD.RESULT            result;
            selected = comboBoxRecord.SelectedIndex;

            comboBoxOutput.Enabled = false;
            comboBoxRecord.Enabled = false;

            /*
             *  Initialise
             */
            result = system.init(32, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
            ERRCHECK(result);

            exinfo.cbsize           = Marshal.SizeOf(exinfo);
            exinfo.numchannels      = 2;
            exinfo.format           = FMOD.SOUND_FORMAT.PCM16;
            exinfo.defaultfrequency = 44100;
            exinfo.length           = (uint)(exinfo.defaultfrequency * 2 * exinfo.numchannels * 2);

            result = system.createSound((string)null, (FMOD.MODE._2D | FMOD.MODE.SOFTWARE | FMOD.MODE.OPENUSER), ref exinfo, ref sound);
            ERRCHECK(result);

            start.Enabled = true;
        }
        private void PlayStream_Load(object sender, System.EventArgs e)
        {
            uint version = 0;

            FMOD.RESULT result;

            /*
             *  Global Settings
             */
            result = FMOD.Factory.System_Create(ref system);
            ERRCHECK(result);

            result = system.getVersion(ref version);
            ERRCHECK(result);
            if (version < FMOD.VERSION.number)
            {
                MessageBox.Show("Error!  You are using an old version of FMOD " + version.ToString("X") + ".  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
                Application.Exit();
            }

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

            result = system.createSound("../../../../../examples/media/wave.mp3", (FMOD.MODE._2D | FMOD.MODE.HARDWARE | FMOD.MODE.CREATESTREAM), ref sound);
            ERRCHECK(result);
        }
Exemple #13
0
        public GameContainer()
        {
            Graphics = new GraphicsDeviceManager(this);

            Graphics.PreferMultiSampling       = true;
            Graphics.PreferredBackBufferHeight = 600;
            Graphics.PreferredBackBufferWidth  = 800;

            Graphics.MinimumPixelShaderProfile  = ShaderProfile.PS_3_0;
            Graphics.MinimumVertexShaderProfile = ShaderProfile.VS_3_0;

            ContentManager = Content;

            Window.Title = "Shaken, not stirred.     (Jacob H. Hansen @ LD11)";

            this.IsMouseVisible = true;

            // fmod bullshit
            FMOD.Factory.System_Create(ref SoundSystem);
            SoundSystem.init(32, FMOD.INITFLAG.NORMAL, (IntPtr)null);

            SoundSystem.createSound("nectar\\music\\shrt-beat2.ogg", FMOD.MODE.HARDWARE, ref tunes[0]);
            SoundSystem.createSound("nectar\\music\\shrt-vildere_lort.ogg", FMOD.MODE.HARDWARE, ref tunes[1]);
            SoundSystem.createSound("nectar\\music\\shrt-sving_om.ogg", FMOD.MODE.HARDWARE, ref tunes[2]);
            SoundSystem.createSound("nectar\\music\\shrt-beat3.ogg", FMOD.MODE.HARDWARE, ref tunes[3]);

            foreach (FMOD.Sound s in tunes)
            {
                s.setMode(FMOD.MODE.LOOP_NORMAL);
            }
        }
        private void Form1_Load(object sender, System.EventArgs e)
        {
            uint version = 0;

            FMOD.RESULT result;
            int         length;

            FMOD.CREATESOUNDEXINFO exinfo = new FMOD.CREATESOUNDEXINFO();

            /*
             *  Global Settings
             */
            result = FMOD.Factory.System_Create(ref system);
            ERRCHECK(result);

            result = system.getVersion(ref version);
            ERRCHECK(result);
            if (version < FMOD.VERSION.number)
            {
                MessageBox.Show("Error!  You are using an old version of FMOD " + version.ToString("X") + ".  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
                Application.Exit();
            }

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

            length = LoadFileIntoMemory("../../../../../examples/media/wave.mp3");

            exinfo.cbsize = Marshal.SizeOf(exinfo);
            exinfo.length = (uint)length;

            result = system.createSound(audiodata, (FMOD.MODE.HARDWARE | FMOD.MODE.OPENMEMORY), ref exinfo, ref sound);
            ERRCHECK(result);
        }
Exemple #15
0
            public SoundLib()
            {
                if (system != null)
                {
                    return;
                }

                FMOD.RESULT result = FMOD.Factory.System_Create(out system);
                if (ERRCHECK(result, "System_Create"))
                {
                    return;
                }

                uint version;

                result = system.getVersion(out version);
                ERRCHECK(result, "system.getVersion");
                if (version < FMOD.VERSION.number)
                {
                    Report.ReportLog("Error! Old version of FMOD " + version.ToString("X") + " detected.  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
                    system.close();
                    system.release();
                    system = null;
                    return;
                }

                result = system.init(1, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
                if (ERRCHECK(result, "system.init"))
                {
                    system.close();
                    system.release();
                    system = null;
                    return;
                }
            }
Exemple #16
0
        private void initFmod()
        {
            FMOD.RESULT result = FMOD.Factory.System_Create(ref fmodSystem);

            fmodSystem.init(32, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
            fmodSystem.setFileSystem(myopen, myclose, myread, myseek, null, null, 2048);
            fmodSystem.setOutput(FMOD.OUTPUTTYPE.AUTODETECT);
        }
Exemple #17
0
        public override void Initialize()
        {
            // create and initialize the FMOD system.
            CheckFMODResult(FMOD.Factory.System_Create(ref mSystem));
            CheckFMODResult(mSystem.init(1000, FMOD.INITFLAG._3D_RIGHTHANDED, IntPtr.Zero));

            Report("AgateFMOD driver instantiated for audio.");
        }
Exemple #18
0
 public void Initialize()
 {
     m_fmodSystem.init(
         32,
         FMOD.INITFLAGS.NORMAL,
         IntPtr.Zero
         );
     m_fmodSystem.getMasterChannelGroup(out m_masterChannelGroup);
 }
Exemple #19
0
        // ========================================================================================================================================
        #region Unity lifecycle
        void Start()
        {
            this.gameObjectName = this.gameObject.name;


            result = FMOD.Factory.System_Create(out system);
            AudioStreamSupport.ERRCHECK(result, this.logLevel, this.gameObjectName, null, "FMOD.Factory.System_Create");

            result = system.getVersion(out version);
            AudioStreamSupport.ERRCHECK(result, this.logLevel, this.gameObjectName, null, "system.getVersion");

            if (version < FMOD.VERSION.number)
            {
                var msg = string.Format("FMOD lib version {0} doesn't match header version {1}", version, FMOD.VERSION.number);
                throw new System.Exception(msg);
            }

            int rate;

            FMOD.SPEAKERMODE sm;
            int sc;

            result = system.getSoftwareFormat(out rate, out sm, out sc);
            AudioStreamSupport.ERRCHECK(result, this.logLevel, this.gameObjectName, null, "system.getSoftwareFormat");

            AudioStreamSupport.LOG(LogLevel.INFO, this.logLevel, this.gameObjectName, null, "FMOD samplerate: {0}, speaker mode: {1}, num. of raw speakers {2}", rate, sm, sc);

            // TODO: evaluate maxchannels
            result = system.init(32, FMOD.INITFLAGS.NORMAL, extradriverdata);
            AudioStreamSupport.ERRCHECK(result, this.logLevel, this.gameObjectName, null, "system.init");


            this.SetOutput(this.outputDriverID);

            /* tags ERR_FILE_COULDNOTSEEK:
             *      http://stackoverflow.com/questions/7154223/streaming-mp3-from-internet-with-fmod
             *      http://www.fmod.org/docs/content/generated/FMOD_System_SetFileSystem.html
             */
            // result = system.setFileSystem(null, null, null, null, null, null, -1);
            // ERRCHECK(result, "system.setFileSystem");

            // Explicitly create the delegate object and assign it to a member so it doesn't get freed
            // by the garbage collected while it's being used
            this.pcmreadcallback   = new FMOD.SOUND_PCMREADCALLBACK(PCMReadCallback);
            this.pcmsetposcallback = new FMOD.SOUND_PCMSETPOSCALLBACK(PCMSetPosCallback);


            this.elementSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(System.Int16));


            // decodebuffersize samples worth of bytes will be called in read callback
            // createSound calls back, too
            this.pcmReadCallbackBuffer = new List <List <byte> >();
            this.pcmReadCallbackBuffer.Add(new List <byte>());
            this.pcmReadCallbackBuffer.Add(new List <byte>());
        }
Exemple #20
0
        /// <summary>
        /// Constructor
        /// </summary>
        public TagReader()
        {
            FMOD.RESULT result;

            //create an fmod instance to use for tag reading
            result = FMOD.Factory.System_Create(out _system);
            CheckError(result);
            result = _system.init(1, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
            CheckError(result);
        }
Exemple #21
0
        private void InitSoundEngine()
        {
            uint version = 0;

            FMOD.RESULT result;

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

            result = system.getVersion(ref version);
            ERRCHECK(result);
            if (version < FMOD.VERSION.number)
            {
                throw new Exception("Error!  You are using an old version of FMOD " + version.ToString("X") + ".  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
            }

            if (isPreListenSoundEngine)
            {
                system.setDriver(Big3.Hitbase.Configuration.Settings.Current.OutputDevicePreListen);
            }
            else
            {
                system.setDriver(Big3.Hitbase.Configuration.Settings.Current.OutputDevice);
            }

            switch (Big3.Hitbase.Configuration.Settings.Current.VirtualCDBufferSize)
            {
            case 0:
                system.setDSPBufferSize(100, 8);
                break;

            case 1:
                system.setDSPBufferSize(150, 8);
                break;

            case 2:
                system.setDSPBufferSize(200, 8);
                break;

            case 3:
            default:
                system.setDSPBufferSize(500, 8);
                break;
            }

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

            /*
             *  Bump up the file buffer size a bit from the 16k default for CDDA, because it is a slower medium.
             */
            result = system.setStreamBufferSize(64 * 1024, FMOD.TIMEUNIT.RAWBYTES);
            ERRCHECK(result);
        }
        private CMusicPlayer()
        {
            FMOD.Factory.System_Create(out FMODSystem);

            FMODSystem.setDSPBufferSize(1024, 10);
            FMODSystem.init(32, FMOD.INITFLAGS.NORMAL, (IntPtr)0);

            Music = new FMOD.Sound[NUM_SONGS];

            SoundFX = new FMOD.Sound[NUM_SFX];
        }
Exemple #23
0
        public ModuleIniti(AdKillerMainForm adForm)
        {
            var result = FMOD.Factory.System_Create(ref system);

            Sound.ErrorCheck(result);
            result = system.init(4, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
            Sound.ErrorCheck(result);
            this.adKillerForm = adForm;
            // result = system.setStreamBufferSize(64 * 1024, FMOD.TIMEUNIT.RAWBYTES);
            // Sound.ErrorCheck(result);
        }
        // Constructor
        CFMOD()
        {
            // Sound turned on by default
            mbSoundOn = true;

            // Create the FMOD System Object
            CheckResult(FMOD.Factory.System_Create(ref mcFMODSystem), "FMOD System Create Error");

            // Setup FMOD
            CheckResult(mcFMODSystem.init(32, FMOD.INITFLAG.NORMAL, (IntPtr)(0)), "FMOD Init Error");
        }
Exemple #25
0
        static GmfSound()
        {
            sys = new FMOD.System();
            FMOD.Factory.System_Create(ref sys);
            sys.init(64, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);

            for (int i = 0; i < sounds.Length; ++i)
            {
                sys.createStream(string.Format("Sound/{0}.wav", i), FMOD.MODE.DEFAULT, ref sounds[i]);
            }
        }
Exemple #26
0
        private void initFmod()
        {
            FMOD.RESULT res;

            res = FMOD.Factory.System_Create(ref system);

            system.setOutput(FMOD.OUTPUTTYPE.WAVWRITER);

            system.init(32, FMOD.INITFLAGS.STREAM_FROM_UPDATE, (IntPtr)null);

            system.setFileSystem(myopen, myclose, myread, myseek, null, null, 2048);
        }
Exemple #27
0
        /*---------------------------------------------*/
        /* Private AudioMaster constructor (Singleton) */
        /*---------------------------------------------*/
        private AudioMaster()
        {
            //In order to be able to use FMOD in both x86 and x64 architecture

            string pathToFMODLib = System.IO.Path.GetFullPath("..\\..\\FMOD");

            if (Environment.Is64BitProcess)
            {
                pathToFMODLib += "\\64\\fmod.dll";
            }
            else
            {
                pathToFMODLib += "\\32\\fmod.dll";
            }

            var success = LoadLibrary(pathToFMODLib);

            if (success == IntPtr.Zero)
            {
                throw new Exception($"Failed to load fmod.dll (path: '{pathToFMODLib}'");
            }

            _sounds = new Dictionary <string, FMOD.Sound>();

            //Initialize FMOD
            //---------------

            FMOD.RESULT result;

            result = FMOD.Factory.System_Create(out _fmodSystem);
            if (result != FMOD.RESULT.OK)
            {
                Console.WriteLine("[AudioMaster constructor] FMOD System_Create failed : " + result);
            }

            result = _fmodSystem.set3DSettings(1.0f, distanceFactor, 1.0f);
            if (result != FMOD.RESULT.OK)
            {
                Console.WriteLine("[AudioMaster constructor] FMOD set3DSettings failed : " + result);
            }

            result = _fmodSystem.setDSPBufferSize(1024, 10);
            if (result != FMOD.RESULT.OK)
            {
                Console.WriteLine("[AudioMaster constructor] FMOD setDSPBufferSize failed : " + result);
            }

            result = _fmodSystem.init(32, FMOD.INITFLAGS.NORMAL, (IntPtr)0);
            if (result != FMOD.RESULT.OK)
            {
                Console.WriteLine("[AudioMaster constructor] FMOD init failed : " + result);
            }
        }
Exemple #28
0
        public About()
        {
            img = Properties.Resources.nfo;
            img.MakeTransparent(Color.Black);

            InitializeComponent();

            exInfo.cbsize = Marshal.SizeOf(exInfo);
            exInfo.length = (uint)Properties.Resources.teh.Length;

            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.Opaque, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            int step = 5;

            Color color = Color.FromArgb(255, 0, 0);

            customSpectrum.AddRange(Ext.Interpolate(ColorEnum.Green, ChangeEnum.Higher, color, step));

            color = Color.FromArgb(255, 255, 0);
            customSpectrum.AddRange(Ext.Interpolate(ColorEnum.Red, ChangeEnum.Lower, color, step));

            color = Color.FromArgb(0, 255, 0);
            customSpectrum.AddRange(Ext.Interpolate(ColorEnum.Blue, ChangeEnum.Higher, color, step));

            color = Color.FromArgb(0, 255, 255);
            customSpectrum.AddRange(Ext.Interpolate(ColorEnum.Green, ChangeEnum.Lower, color, step));

            color = Color.FromArgb(0, 0, 255);
            customSpectrum.AddRange(Ext.Interpolate(ColorEnum.Red, ChangeEnum.Higher, color, step));

            color = Color.FromArgb(255, 0, 255);
            customSpectrum.AddRange(Ext.Interpolate(ColorEnum.Blue, ChangeEnum.Lower, color, step));

            DoubleBuffered = true;

            this.Width = img.Width;
            y          = -this.Height;

            FMOD.Factory.System_Create(ref soundSystem);

            soundSystem.init(32, FMOD.INITFLAG.NORMAL | FMOD.INITFLAG.WASAPI_EXCLUSIVE, IntPtr.Zero);
            soundSystem.createSound(Properties.Resources.teh, FMOD.MODE.SOFTWARE | FMOD.MODE._2D | FMOD.MODE.OPENMEMORY | FMOD.MODE.ACCURATETIME | FMOD.MODE.LOOP_NORMAL, ref exInfo, ref sound);
            soundSystem.playSound(FMOD.CHANNELINDEX.REUSE, sound, false, ref soundChannel);

            soundChannel.setVolume(.75f);

            tmr.Interval = 25;
            tmr.Tick    += new EventHandler(tmr_Tick);

            tmr.Start();
        }
        private void Form1_Load(object sender, System.EventArgs e)
        {
            uint version = 0;

            FMOD.RESULT result;

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

            result = system.getVersion(ref version);
            ERRCHECK(result);
            if (version < FMOD.VERSION.number)
            {
                MessageBox.Show("Error!  You are using an old version of FMOD " + version.ToString("X") + ".  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
                Application.Exit();
            }

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

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

            result = system.playSound(FMOD.CHANNELINDEX.FREE, sound, false, ref channel);
            ERRCHECK(result);

            /*
             *  Create DSP unit
             */

            cohar[] nameArray = new char[32];
            dspname.ToCharArray().CopyTo(nameArray, 0);

            dspdesc.name     = nameArray;
            dspdesc.channels = 0;
            dspdesc.read     = dspreadcallback;

            result = system.createDSP(ref dspdesc, ref mydsp);
            ERRCHECK(result);

            result = system.addDSP(mydsp, ref dspconnectiontemp);
            ERRCHECK(result);

            result = mydsp.setActive(true);
            ERRCHECK(result);

            result = mydsp.setBypass(true);
            ERRCHECK(result);
        }
Exemple #30
0
        protected override void Initialize()
        {
            Space = new Physics.Space(new Physics.PersistentUniformGrid(10));
            Space.simulationSettings.gravity = new Vector3(0, -9.81f, 0);

            FMOD.Factory.System_Create(ref SoundSystem);
            SoundSystem.init(32, FMOD.INITFLAG.NORMAL, (IntPtr)null);

            InitializeModules();
            InitializeBehaviors();

            base.Initialize();
        }