Exemplo n.º 1
0
 //Javascript response
 void WebFileSelected(string url)
 {
     //url is a blob that we can do IO on
     //todo some way to parse song meta
     song = new song_meta_struct("web", "web", "web");
     songNameText.text = song.title + " by " + song.artist;
     path  = url;
     state = STATE.AUDIO_CLIP_LOADING;
 }
Exemplo n.º 2
0
 public BeatMap(bga_settings bga_settings, song_info_struct song_info, song_meta_struct song_meta, string songFilePath)
 {
     this.song_meta    = song_meta;
     this.bga_settings = bga_settings;
     this.song_info    = song_info;
     this.state        = STATE.SAMPLES_LOADED;
     //this.name = name;
     this.fileName     = song_meta.title + "~" + song_meta.artist + "~" + song_meta.album + ";" + bga_settings.rng_seed.ToString() + ".dat";
     this.songFilePath = songFilePath;
     this.timesPlayed  = 0;
     laneObjectStore   = new List <LaneObject>();
     scoreboard        = new List <WinDataClass>();
 }
Exemplo n.º 3
0
    public void StartBGA(ref AudioClip audioClip, ref WebInfo webInfo, bga_settings settings, song_meta_struct song, string songFilePath)
    {
        this.songFilePath = songFilePath;
        this.song_meta    = song;
        if (this.state != STATE.READY)
        {
            throw new Exception("Cannot start the beat generating algorithim if it is already being run! State: " + this.state);
        }
        this.state = STATE.ACTIVE;
        Debug.Log("Threshold, multiplier:");
        Debug.Log(settings.threshold_time);
        Debug.Log(settings.threshold_multiplier);
        this.settings = settings;
        if (settings.rng_seed == 0)
        {
            this.settings.rng_seed = generateNewRandomSeed();
            Debug.Log(this.settings.rng_seed);
        }

        bga_random = new System.Random(settings.rng_seed);

        song_info              = new song_info_struct(audioClip);
        song_info.samples      = new float[song_info.sampleCount * song_info.channels];
        song_info.sampleLength = song_info.length / (float)song_info.sampleCount;
        //GetData returns samples for both the L(eft) and R(ight) channels
        //audioClip.GetData(song_info.samples, 0);
        song_info.samples = webInfo.samples;

        output = new output_struct();

        persistentDataPath = Application.persistentDataPath; //We can't use unity specific calls in the bga thread, and we need this variable for later

        //Create the background thread and run the BGA algorithim
        //The algorthim will have access to all the public structs
        Debug.Log("make thread");
        //Thread BGAThread = new Thread(new ThreadStart(algorithimWrapper));
        //BGAThread.Start();
        // crash the ui thread #yolo
        algorithimWrapper();
    }