Ejemplo n.º 1
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="note"></param>
            public override SoundBase[] SoundOn(TaggedNoteOnEvent note)
            {
                List <SoundBase> rv = new List <SoundBase>();

                var bts    = parentModule.GetBaseTimbres(note);
                var ids    = parentModule.GetBaseTimbreIndexes(note);
                int tindex = 0;

                for (int i = 0; i < bts.Length; i++)
                {
                    C140Timbre timbre = (C140Timbre)bts[i];

                    tindex++;
                    var emptySlot = searchEmptySlot(note);
                    if (emptySlot.slot < 0)
                    {
                        continue;
                    }

                    C140Sound snd = new C140Sound(emptySlot.inst, this, timbre, tindex - 1, note, emptySlot.slot, (byte)ids[i]);
                    instOnSounds.Add(snd);

                    //HACK: store pcm data to local buffer to avoid "thread lock"
                    if (timbre.SoundType == SoundType.INST)
                    {
                        lock (parentModule.tmpPcmDataTable)
                            parentModule.tmpPcmDataTable[ids[i]] = timbre.PcmData;
                    }

                    /*
                     * else if (timbre.SoundType == SoundType.DRUM)
                     * {
                     *  var pct = (C140PcmTimbre)parentModule.DrumSoundTable.PcmTimbres[note.NoteNumber];
                     *  lock (parentModule.tmpPcmDataTable)
                     *      parentModule.tmpPcmDataTable[note.NoteNumber + 128] = pct.C140PcmData;
                     * }
                     */

                    FormMain.OutputDebugLog(parentModule, "KeyOn INST ch" + emptySlot + " " + note.ToString());
                    rv.Add(snd);
                }
                for (int i = 0; i < rv.Count; i++)
                {
                    var snd = rv[i];
                    if (!snd.IsDisposed)
                    {
                        ProcessKeyOn(snd);
                    }
                    else
                    {
                        rv.Remove(snd);
                        i--;
                    }
                }

                return(rv.ToArray());
            }
Ejemplo n.º 2
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="note"></param>
            public override SoundBase[] SoundOn(TaggedNoteOnEvent note)
            {
                List <SoundBase> rv = new List <SoundBase>();

                int tindex = 0;

                foreach (GBAPUTimbre timbre in parentModule.GetBaseTimbres(note))
                {
                    tindex++;
                    var emptySlot = searchEmptySlot(note, timbre);
                    if (emptySlot.slot < 0)
                    {
                        continue;
                    }

                    GbSound snd = new GbSound(emptySlot.inst, this, timbre, tindex - 1, note, emptySlot.slot);
                    switch (timbre.SoundType)
                    {
                    case SoundType.SPSG:
                        spsgOnSounds.Add(snd);
                        break;

                    case SoundType.PSG:
                        psgOnSounds.Add(snd);
                        break;

                    case SoundType.WAV:
                        wavOnSounds.Add(snd);
                        break;

                    case SoundType.NOISE:
                        noiseOnSounds.Add(snd);
                        break;
                    }

                    rv.Add(snd);
                }
                for (int i = 0; i < rv.Count; i++)
                {
                    var snd = rv[i];
                    if (!snd.IsDisposed)
                    {
                        ProcessKeyOn(snd);
                    }
                    else
                    {
                        rv.Remove(snd);
                        i--;
                    }
                }

                return(rv.ToArray());
            }
Ejemplo n.º 3
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="note"></param>
            public override SoundBase[] SoundOn(TaggedNoteOnEvent note)
            {
                List <SoundBase> rv = new List <SoundBase>();

                int tindex = 0;

                foreach (SN76496Timbre timbre in parentModule.GetBaseTimbres(note))
                {
                    tindex++;
                    var emptySlot = searchEmptySlot(note, timbre);
                    if (emptySlot.slot < 0)
                    {
                        continue;
                    }

                    SN76496Sound snd = new SN76496Sound(emptySlot.inst, this, timbre, tindex - 1, note, emptySlot.slot);
                    switch (((SN76496Timbre)timbre).SoundType)
                    {
                    case SoundType.PSG:
                        psgOnSounds.Add(snd);
                        FormMain.OutputDebugLog(parentModule, "KeyOn PSG ch" + emptySlot + " " + note.ToString());
                        break;

                    case SoundType.NOISE:
                        noiseOnSounds.Add(snd);
                        FormMain.OutputDebugLog(parentModule, "KeyOn NOISE ch" + emptySlot + " " + note.ToString());
                        break;
                    }
                    rv.Add(snd);
                }
                for (int i = 0; i < rv.Count; i++)
                {
                    var snd = rv[i];
                    if (!snd.IsDisposed)
                    {
                        ProcessKeyOn(snd);
                    }
                    else
                    {
                        rv.Remove(snd);
                        i--;
                    }
                }
                return(rv.ToArray());
            }
Ejemplo n.º 4
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="note"></param>
            public override SoundBase[] SoundOn(TaggedNoteOnEvent note)
            {
                List <SoundBase> rv = new List <SoundBase>();

                int tindex = 0;

                foreach (TMS5220Timbre timbre in parentModule.GetBaseTimbres(note))
                {
                    tindex++;
                    var emptySlot = searchEmptySlot(note);
                    if (emptySlot.slot < 0)
                    {
                        continue;
                    }

                    TMS5220Sound snd = new TMS5220Sound(emptySlot.inst, this, timbre, tindex - 1, note, emptySlot.slot);
                    psgOnSounds.Add(snd);

                    FormMain.OutputDebugLog(parentModule, "KeyOn SP0256 ch" + emptySlot + " " + note.ToString());
                    rv.Add(snd);
                }
                for (int i = 0; i < rv.Count; i++)
                {
                    var snd = rv[i];
                    if (!snd.IsDisposed)
                    {
                        ProcessKeyOn(snd);
                    }
                    else
                    {
                        rv.Remove(snd);
                        i--;
                    }
                }

                return(rv.ToArray());
            }
Ejemplo n.º 5
0
        public void makesDic(ProfilProperties eingabe)
        {
            //Wichtig: Casten in das jeweilige Format

            #region Clear
            GrafikList.Clear();
            SoundList.Clear();
            SteuerungList.Clear();
            SpielereinstellungenList.Clear();

            GrafikDat.Clear();
            SoundDat.Clear();
            SteuerungDat.Clear();
            SpielereinstellungenDat.Clear();
            NamenKeysSound.Clear();
            NamenKeysGrafik.Clear();
            NamenKeysSteuerung.Clear();
            NamenKeysSpielereinstellungen.Clear();

            #endregion

            //Zuweisen der Werte
            #region Grafik
            NamenKeysGrafik.Add("Resolution");
            NamenKeysGrafik.Add("Shadow");
            NamenKeysGrafik.Add("Fog");
            NamenKeysGrafik.Add("Detail");
            NamenKeysGrafik.Add("Fullscreen");
            NamenKeysGrafik.Add("Anti Aliasing");

            GrafikDat.Add("Resolution", "string");
            GrafikDat.Add("Shadow", "bool");
            GrafikDat.Add("Fog", "bool");
            GrafikDat.Add("Detail", "float");
            GrafikDat.Add("Fullscreen", "bool");
            GrafikDat.Add("Anti Aliasing", "string");

            GrafikList.Add("Resolution", CurrentProfil.Resolution);
            GrafikList.Add("Shadow", CurrentProfil.Shadow);
            GrafikList.Add("Fog", CurrentProfil.Fog);
            GrafikList.Add("Detail", CurrentProfil.Detail);
            GrafikList.Add("Fullscreen", CurrentProfil.Fullscreen);
            GrafikList.Add("Anti Aliasing", CurrentProfil.AntiAliasing);
            #endregion

            #region Sound
            NamenKeysSound.Add("Music");
            NamenKeysSound.Add("Effect");
            NamenKeysSound.Add("Sound");

            SoundDat.Add("Music", "float");
            SoundDat.Add("Effect", "float");
            SoundDat.Add("Sound", "bool");

            SoundList.Add("Music", CurrentProfil.Music);
            SoundList.Add("Effect", CurrentProfil.Effect);
            SoundList.Add("Sound", CurrentProfil.Sound);
            #endregion

            #region Steuerung

            NamenKeysSteuerung.Add("Translation");
            NamenKeysSteuerung.Add("Acceleration Level");
            NamenKeysSteuerung.Add("Brake");
            NamenKeysSteuerung.Add("Banking");
            NamenKeysSteuerung.Add("Drift");
            NamenKeysSteuerung.Add("Auto Level");
            NamenKeysSteuerung.Add("Rolling");
            NamenKeysSteuerung.Add("Mouse Intensity");
            NamenKeysSteuerung.Add("Primary Fire");
            NamenKeysSteuerung.Add("Secondary Fire");
            NamenKeysSteuerung.Add("Left Drift");
            NamenKeysSteuerung.Add("Right Drift");
            NamenKeysSteuerung.Add("Brakes");
            NamenKeysSteuerung.Add("Acceleration");
            NamenKeysSteuerung.Add("Boost");
            NamenKeysSteuerung.Add("Primary Weapon 1");
            NamenKeysSteuerung.Add("Primary Weapon 2");
            NamenKeysSteuerung.Add("Secondary Weapon 1");
            NamenKeysSteuerung.Add("Secondary Weapon 2");

            SteuerungDat.Add("Translation", "float");
            SteuerungDat.Add("Acceleration Level", "float");
            SteuerungDat.Add("Brake", "float");
            SteuerungDat.Add("Banking", "float");
            SteuerungDat.Add("Drift", "float");
            SteuerungDat.Add("Auto Level", "float");
            SteuerungDat.Add("Rolling", "float");
            SteuerungDat.Add("Mouse Intensity", "float");
            SteuerungDat.Add("Primary Fire", "MouseButton");
            SteuerungDat.Add("Secondary Fire", "MouseButton");
            SteuerungDat.Add("Left Drift", "Keys");
            SteuerungDat.Add("Right Drift", "Keys");
            SteuerungDat.Add("Brakes", "Keys");
            SteuerungDat.Add("Acceleration", "Keys");
            SteuerungDat.Add("Boost", "Keys");
            SteuerungDat.Add("Primary Weapon 1", "Keys");
            SteuerungDat.Add("Primary Weapon 2", "Keys");
            SteuerungDat.Add("Secondary Weapon 1", "Keys");
            SteuerungDat.Add("Secondary Weapon 2", "Keys");

            SteuerungList.Add("Translation", CurrentProfil.Translation);
            SteuerungList.Add("Acceleration Level", CurrentProfil.Acceleration);
            SteuerungList.Add("Brake", CurrentProfil.Brake);
            SteuerungList.Add("Banking", CurrentProfil.Banking);
            SteuerungList.Add("Drift", CurrentProfil.Drift);
            SteuerungList.Add("Auto Level", CurrentProfil.AutoLevel);
            SteuerungList.Add("Rolling", CurrentProfil.Rolling);
            SteuerungList.Add("Mouse Intensity", CurrentProfil.mouseIntensity);
            SteuerungList.Add("Primary Fire", CurrentProfil.PlayerFirePrim);
            SteuerungList.Add("Secondary Fire", CurrentProfil.PlayerFireSek);
            SteuerungList.Add("Left Drift", CurrentProfil.PlayerLeftDrift);
            SteuerungList.Add("Right Drift", CurrentProfil.PlayerRightDrift);
            SteuerungList.Add("Brakes", CurrentProfil.PlayerBrake);
            SteuerungList.Add("Acceleration", CurrentProfil.PlayerAcceleration);
            SteuerungList.Add("Boost", CurrentProfil.PlayerBoost);
            SteuerungList.Add("Primary Weapon 1", CurrentProfil.PlayerPrimWeapon1);
            SteuerungList.Add("Primary Weapon 2", CurrentProfil.PlayerPrimWeapon2);
            SteuerungList.Add("Secondary Weapon 1", CurrentProfil.PlayerSekWeapon1);
            SteuerungList.Add("Secondary Weapon 2", CurrentProfil.PlayerSekWeapon2);
            #endregion

            #region Spielereinstellungen
            NamenKeysSpielereinstellungen.Add("Difficult");
            NamenKeysSpielereinstellungen.Add("Playername");

            SpielereinstellungenDat.Add("Difficult", "int");
            SpielereinstellungenDat.Add("Playernam", "string");

            SpielereinstellungenList.Add("Difficult", CurrentProfil.Difficult);
            SpielereinstellungenList.Add("Playername", CurrentProfil.Playername);
            #endregion
        }
Ejemplo n.º 6
0
        private void LoadSoundNames()
        {
            var soundList = SoundPlayerUtilities.Instance.GetSoundList();

            soundList.ToList().ForEach(s => SoundList.Add(s));
        }
Ejemplo n.º 7
0
    public static void Main()
    {
        //ThreadedPlaySound(0);

        StartLightEffect();

        Sound[] soundFiles = new Sound[2]
        {
            new Sound(AppDomain.CurrentDomain.BaseDirectory + "175944__litruv__ghost-whispers.wav", 0.1f, 0.3f, false, false),
            new Sound(AppDomain.CurrentDomain.BaseDirectory + "252042__andy19__snake-pit.wav", 0.0f, 0.1f, true, true)
        };

        int soundCounter = 0;
        int deviceNumber = -1;

        for (int i = 0; i < WaveOut.DeviceCount; i++)
        {
            var cap = WaveOut.GetCapabilities(i);
            if (cap.ProductName.ToLower().Contains("headset") ||
                cap.ProductName.ToLower().Contains("speakers")
                )
            {
                //if (deviceNumber == -1)
                deviceNumber = i;
                if (soundCounter < 5)
                {
                    if (cap.ProductName.ToLower().Contains("speakers"))
                    {
                        sl.Add(soundFiles[1]);
                        soundFiles[1].Init(deviceNumber);
                    }
                    else
                    {
                        sl.Add(soundFiles[0]);
                        soundFiles[0].Init(deviceNumber);
                    }
                }

                if (soundCounter == soundFiles.Length)
                {
                    break;
                }
            }
        }
        sl.Silence(true);
        soundFiles[0].Play();
        soundFiles[1].Play();



        btPort.BaudRate = 9600;
        btPort.PortName = "COM8"; // Set in Windows
        int counter = 0;



        while (true)
        {
            counter++;
            try
            {
                btPort.Open();
                break;
            }
            catch (Exception ex)
            {
                if (counter == 10)
                {
                    throw;
                }
                System.Threading.Thread.Sleep(500);
            }
        }



        string response = "";

        while (btPort.IsOpen)// && serialIncomingPort.IsOpen)
        {
            while (btPort.BytesToRead > 0)
            {
                while (btPort.BytesToRead > 0)
                {
                    response += Convert.ToChar(btPort.ReadChar());
                }
            }
            response = ParseResponse(response);
            WriteToPort("D");

            // WRITE THE INCOMING BUFFER TO CONSOLE


            //Thread.Sleep(400);
            // SEND
        }
    }