public static void DisposeOf(ModelRaw model)
        {
            VaOs.Remove(model.VaoID);

            GL.DeleteVertexArray(model.VaoID);

            foreach (int vbo in model.BufferIDs)
            {
                VbOs.Remove(vbo);

                GL.DeleteBuffer(vbo);
            }
        }
        public void Load(string file)
        {
            if (file == null || !File.Exists(file))
            {
                return;
            }

            Bass.BASS_StreamFree(streamID);
            Bass.BASS_StreamFree(streamFileID);

            if (lastFile != file)
            {
                lastFile = file;

                WaveModel?.Dispose();

                var wf = new WaveForm(file);
                wf.FrameResolution = 0.005;

                if (wf.RenderStart(false, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_STREAM_PRESCAN | BASSFlag.BASS_FX_FREESOURCE))
                {
                    var samples = new float[wf.Wave.data.Length];

                    var maxPeak = 0f;

                    for (int i = 0; i < wf.Wave.data.Length; i++)
                    {
                        var sample = wf.Wave.data[i];

                        var peakLeft  = sample.left / (float)short.MaxValue;
                        var peakRight = sample.right / (float)short.MaxValue;

                        var peak = Math.Max(Math.Abs(peakLeft), Math.Abs(peakRight));

                        maxPeak = Math.Max(peak, maxPeak);

                        samples[i] = peak;
                    }

                    var vertexes = new Queue <float>();

                    // averaging values
                    for (int i = 0; i < samples.Length; i++)
                    {
                        if (maxPeak > 0.001)
                        {
                            samples[i] /= maxPeak;
                        }
                        samples[i] *= 0.9f;

                        vertexes.Enqueue(i / (float)samples.Length * 100000);
                        vertexes.Enqueue(samples[i]);
                    }

                    WaveModel = ModelManager.LoadModel2ToVao(vertexes.ToArray());
                    wf.Reset();
                }
            }

            var stream = Bass.BASS_StreamCreateFile(file, 0, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_STREAM_PRESCAN | BASSFlag.BASS_FX_FREESOURCE);
            var tempo  = Tempo;

            streamFileID = stream;
            streamID     = BassFx.BASS_FX_TempoCreate(streamFileID, BASSFlag.BASS_STREAM_PRESCAN);

            Tempo = tempo;

            Bass.BASS_ChannelGetAttribute(streamID, BASSAttribute.BASS_ATTRIB_TEMPO_FREQ, ref originval);

            Reset();
        }