unsafe static bool LoadModel(byte[] modelData, REVEnginePlayer player)
        {
            fixed(byte *p = modelData)
            {
                IntPtr ptr = (IntPtr)p;

                var rawData = new SWIGTYPE_p_void(ptr, false);

                Wrappers.ModelFixupError error = ModelFixupError.ModelFixupError_HeaderInvalid;
                var errorPtr = new Wrappers.SWIGTYPE_p_CrankcaseAudio__ModelFixupError((IntPtr)error, false);
                var voidPtr  = new SWIGTYPE_p_p_void(SWIGTYPE_p_void.getCPtr(new SWIGTYPE_p_void(IntPtr.Zero, true)).Handle, true);


                if (!Wrappers.CrankcaseAudio.FixupModel(rawData, voidPtr, errorPtr))
                {
                    throw new Exception("CRANKCASEAUDIO:  Failed to fixup Model file. Error type:" + errorPtr.ToString());
                }


                int    footprint = IREVPlayer.getMemoryFootprint();
                IntPtr mem       = Marshal.AllocHGlobal(footprint);

                player.Player = IREVPlayer.construct(new SWIGTYPE_p_void(mem, false), footprint);


                //do your stu
                player.modelFileBytes = modelData;

                var modelVoid = new SWIGTYPE_p_void(ptr, false);

                player.Player.LoadData(modelVoid);


                player.modelChannels   = (int)player.Player.getNumberChannels();
                player.modelSampleRate = (int)player.Player.getSampleRate();

                Debug.Log("CRANKCASEAUDIO:  HW rate:" + AudioSettings.outputSampleRate + " Model:" + player.modelSampleRate);
                if (player.modelSampleRate != AudioSettings.outputSampleRate)
                {
                    Debug.LogWarning("CRANKCASEAUDIO: Warning, will resample file. Performance hit. HW rate:" + AudioSettings.outputSampleRate + " Model:" + player.modelSampleRate);
                }

                var physicsControlData = Wrappers.CrankcaseAudio.GetREVPhysicsControlData(modelVoid);

                player.PhysicsControlData = physicsControlData;

                var logMessage = "Loading Engine: PlayerRate:" + player.modelSampleRate + " HWRate:" + AudioSettings.outputSampleRate;

                Debug.Log(logMessage);
                player.State = eState.Initialized;
                return(true);
            }
        }
        private unsafe static void updatePlayerModel(byte[] modelData, float [] audioBuffer, int channels, REVEnginePlayer player)
        {
            fixed(byte *modelDataPtr = modelData)
            {
                fixed(float *audioBufferPtr = audioBuffer)
                {
                    var buffer = new Wrappers.Buffer();

                    buffer.Init(channels, new FloatArray((IntPtr)audioBufferPtr, false).cast(), audioBuffer.Length);

                    player.Player.Rebase(new SWIGTYPE_p_void((IntPtr)modelDataPtr, false));
                    player.Player.WriteBuffer(buffer);
                }
            }
        }