示例#1
0
    public void LoadBank(PatchBank bank)
    {
        this.bank = bank;

        synthesizer.UnloadBank();
        synthesizer.LoadBank(bank);
        Debug.LogFormat("Loaded bank: {0}", bank.GetBank(0).Length);//[0].Name
        // for(int i=0;i< bank.GetBank(0).Length;i++)
        //{
        //   Debug.LogFormat("{0}: {1}",i, bank.GetPatch(0,i).Name);
        // }
    }
示例#2
0
        public void TestLoadSf2PatchBank()
        {
            var data      = TestPlatform.LoadFile("TestFiles/Audio/default.sf2");
            var patchBank = new PatchBank();
            var input     = ByteBuffer.FromBuffer(data);

            patchBank.LoadSf2(input);

            Assert.AreEqual("GS sound set (16 bit)", patchBank.Name);
            Assert.AreEqual("960920 ver. 1.00.16", patchBank.Comments);
            Assert.AreEqual("0,1,2,3,4,5,6,7,8,9,16,24,32,128", string.Join(",", patchBank.LoadedBanks));

            var gmBank          = patchBank.GetBank(0);
            var expectedPatches = new string[]
            {
                "Piano 1", "Piano 2", "Piano 3", "Honky-tonk", "E.Piano 1", "E.Piano 2", "Harpsichord", "Clav.",
                "Celesta", "Glockenspiel", "Music Box", "Vibraphone", "Marimba", "Xylophone", "Tubular-bell", "Santur", "Organ 1",
                "Organ 2", "Organ 3", "Church Org.1", "Reed Organ", "Accordion Fr", "Harmonica", "Bandoneon",
                "Nylon-str.Gt", "Steel-str.Gt", "Jazz Gt.", "Clean Gt.", "Muted Gt.", "Overdrive Gt", "DistortionGt", "Gt.Harmonics",
                "Acoustic Bs.", "Fingered Bs.", "Picked Bs.", "Fretless Bs.", "Slap Bass 1", "Slap Bass 2", "Synth Bass 1",
                "Synth Bass 2", "Violin", "Viola", "Cello", "Contrabass", "Tremolo Str", "PizzicatoStr", "Harp", "Timpani", "Strings",
                "Slow Strings", "Syn.Strings1", "Syn.Strings2", "Choir Aahs", "Voice Oohs", "SynVox", "OrchestraHit", "Trumpet", "Trombone", "Tuba",
                "MutedTrumpet", "French Horns", "Brass 1", "Synth Brass1", "Synth Brass2", "Soprano Sax", "Alto Sax", "Tenor Sax", "Baritone Sax",
                "Oboe", "English Horn", "Bassoon", "Clarinet", "Piccolo", "Flute", "Recorder", "Pan Flute", "Bottle Blow", "Shakuhachi", "Whistle",
                "Ocarina", "Square Wave", "Saw Wave", "Syn.Calliope", "Chiffer Lead", "Charang", "Solo Vox", "5th Saw Wave",
                "Bass & Lead", "Fantasia", "Warm Pad", "Polysynth", "Space Voice", "Bowed Glass", "Metal Pad", "Halo Pad", "Sweep Pad",
                "Ice Rain", "Soundtrack", "Crystal", "Atmosphere", "Brightness", "Goblin", "Echo Drops", "Star Theme", "Sitar",
                "Banjo", "Shamisen", "Koto", "Kalimba", "Bagpipe", "Fiddle", "Shanai", "Tinkle Bell", "Agogo", "Steel Drums", "Woodblock",
                "Taiko", "Melo. Tom 1", "Synth Drum", "Reverse Cym.", "Gt.FretNoise", "Breath Noise", "Seashore", "Bird", "Telephone 1",
                "Helicopter", "Applause", "Gun Shot"
            };
            var actualPatches = new FastList <string>();

            foreach (var patch in gmBank)
            {
                if (patch != null)
                {
                    actualPatches.Add(patch.Name);
                }
            }
            Assert.AreEqual(string.Join(",", expectedPatches), string.Join(",", actualPatches));
        }
    void Start()
    {
        ftrack.eid         = new KeyValuePair <int, int>(132974, 67924813);
        ftrack.frc         = new trackData();
        ftrack.frc.azi_rad = 3.00769365471949f;
        ftrack.frc.dec_rad = 0.016708671281222f;
        ftrack.frc.mjd     = 58714.7322249641;
        ftrack.frc.ra_rad  = 2.59716876080088;
        ftrack.frc.rec_t0  = 10983.2956250753f;
        ftrack.frc.rec_x   = -83.0575967774025f;
        ftrack.frc.rec_y   = 93.7020767723102f;
        ftrack.frc.rec_z   = -46.6655356299309f;
        ftrack.frc.zen_rad = 1.5858330048395f;



        curEvent = new List <eventData>();
        GameObject timeCon = GameObject.Find("timeController");

        if (timeCon != null)
        {
            timeController     = timeCon.GetComponent <Slider>();
            playbackController = timeCon.GetComponent <TimeSlider>();
            if (playbackController != null)
            {
                playbackController.OnStartPlaying.AddListener(delegate { StartedPlaying(); });
                playbackController.OnStopPlaying.AddListener(delegate { StoppedPlaying(); });
            }
        }
        GameObject gapCon = GameObject.Find("deltaController");

        if (gapCon != null)
        {
            deltaController = gapCon.GetComponent <Slider>();
        }
        if (timeController != null)
        {
            timeController.onValueChanged.AddListener(delegate { ValueChange(); });
        }
        if (deltaController != null)
        {
            deltaController.onValueChanged.AddListener(delegate { ValueChange(); });
        }
        GameObject tspn = GameObject.Find("timeSpan");

        if (tspn != null)
        {
            timeSpan = tspn.GetComponent <RangeSlider>();
            if (timeSpan != null)
            {
                timeSpan.onValueChanged.AddListener(delegate { ValueChange(); });
            }
        }
        GameObject zCon = GameObject.Find("zoomController");

        if (zCon != null)
        {
            zoomControl = zCon.GetComponent <Slider>();
            if (zoomControl != null)
            {
                zoomControl.onValueChanged.AddListener(delegate { zoomChange(); });
            }
        }
        GameObject hCon = GameObject.Find("hairController");

        if (hCon != null)
        {
            hairControl = hCon.GetComponent <Slider>();
            hairCover   = hCon.transform.parent.gameObject;
            if (hairControl != null)
            {
                hairControl.onValueChanged.AddListener(delegate { hairChange(); });
                hairChange();
            }
        }

        GameObject tCon = GameObject.Find("towerToggle");

        if (tCon != null)
        {
            towerControl = tCon.GetComponent <Toggle>();
            if (towerControl != null)
            {
                towerControl.onValueChanged.AddListener(delegate { towerChange(); });
            }
        }
        GameObject czCon = GameObject.Find("zillaToggle");

        if (czCon != null)
        {
            czillaControl = czCon.GetComponent <Toggle>();
            if (czillaControl != null)
            {
                czillaControl.onValueChanged.AddListener(delegate { czillaChange(); });
            }
        }
        foreach (singleBallList lst in ballArray)
        {
            foreach (singleBall bl in lst.balls)
            {
                if (bl != null)
                {
                    bl.setColor(new Color(0.9f, 0.9f, 0.9f));
                    bl.setScale(baseScale);
                }
            }
        }

        bank = new PatchBank(bankSource);
        if (bank == null)
        {
            Debug.LogFormat("Couldn't load music bank: {0}", bankSource);
        }
        else
        {
            int     maxPatch = 0;
            Patch[] arr      = bank.GetBank(0);
            while (maxPatch < arr.Length)
            {
                if (arr[maxPatch] == null)
                {
                    break;
                }
                maxPatch++;
            }
            for (int i = 0; i < stringArray.Length; i++)
            {
                if (stringArray[i] != null)
                {
                    //Debug.Log(ballArray[i].balls.Length);
                    stringArray[i].SetupWithBank(bank, i, maxPatch, 20, 85, ballArray[i + 1].balls.Length, stringArray.Length);
                }
            }
        }
        // size = scale * ( 0.2 * accum ) ** power
        updateToSet(true);
        updateTrackRot();
    }