/// <summary> /// Sets the movie player back to default state. Use when exiting or otherwise it shouldn't be required. /// </summary> public static void Reset() { if (FfccAudio != null) { FfccAudio.Dispose(); } FfccAudio = null; if (FfccVideo != null) { FfccVideo.Dispose(); } FfccVideo = null; MovieState = STATE_LOAD; if (frameTex != null && !frameTex.IsDisposed) { frameTex.Dispose(); } frameTex = null; GC.Collect(); }
public static void Update() { if (Input.Button(Buttons.Okay) || Input.Button(Buttons.Cancel) || Input.Button(Keys.Space)) { Input.ResetInputLimit(); //init_debugger_Audio.StopAudio(); //Memory.module = Memory.MODULE_MAINMENU_DEBUG; MovieState = STATE_RETURN; } #if DEBUG // lets you move through all the feilds just holding left or right. it will just loop // when it runs out. if (Input.Button(Buttons.Left)) { Input.ResetInputLimit(); init_debugger_Audio.PlaySound(0); Module_main_menu_debug.MoviePointer--; Reset(); } if (Input.Button(Buttons.Right)) { Input.ResetInputLimit(); init_debugger_Audio.PlaySound(0); Module_main_menu_debug.MoviePointer++; Reset(); } #endif switch (MovieState) { case STATE_LOAD: MovieState++; LoadMovie(); break; case STATE_CLEAR: break; case STATE_STARTPLAY: MovieState++; if (FfccAudio != null) { FfccAudio.PlayInTask(); } if (FfccVideo != null) { FfccVideo.Play(); } break; case STATE_PLAYING: //if (FfccAudio != null && !FfccAudio.Ahead) //{ // // if we are behind the timer get the next frame of audio. // FfccAudio.Next(); //} if (FfccVideo == null) { MovieState = STATE_FINISHED; } else if (FfccVideo.Behind) { if (FfccVideo.Next() < 0) { MovieState = STATE_FINISHED; //Memory.SuppressDraw = true; break; } else if (frameTex != null) { frameTex.Dispose(); GC.Collect(); GC.WaitForPendingFinalizers(); frameTex = null; } } else { Memory.SuppressDraw = true; } if (frameTex == null) { if (FfccVideo != null) { frameTex = FfccVideo.Texture2D(); } } break; case STATE_PAUSED: //todo add a function to pause sound //pausing the stopwatch will cause the video to pause because it calcs the current frame based on time. break; case STATE_FINISHED: break; case STATE_RESET: Reset(); break; case STATE_RETURN: default: Reset(); Memory.module = ReturnState; ReturnState = Memory.MODULE_MAINMENU_DEBUG; break; } }