Banshee.GStreamer.PlayerEngine.OnVisualizationData C# (CSharp) Method

OnVisualizationData() private method

private OnVisualizationData ( IntPtr player, int channels, int samples, IntPtr data, int bands, IntPtr spectrum ) : void
player System.IntPtr
channels int
samples int
data System.IntPtr
bands int
spectrum System.IntPtr
return void
        private void OnVisualizationData (IntPtr player, int channels, int samples, IntPtr data, int bands, IntPtr spectrum)
        {
            VisualizationDataHandler handler = data_available;

            if (handler == null) {
                return;
            }

            float [] flat = new float[channels * samples];
            Marshal.Copy (data, flat, 0, flat.Length);

            float [][] cbd = new float[channels][];
            for (int i = 0; i < channels; i++) {
                float [] channel = new float[samples];
                Array.Copy (flat, i * samples, channel, 0, samples);
                cbd[i] = channel;
            }

            float [] spec = new float[bands];
            Marshal.Copy (spectrum, spec, 0, bands);

            try {
                handler (cbd, new float[][] { spec });
            } catch (Exception e) {
                Log.Exception ("Uncaught exception during visualization data post.", e);
            }
        }
PlayerEngine