Exemplo n.º 1
0
 /// <summary>
 /// Constructor for the OggPlaylistFile object (cached)
 /// </summary>
 /// <param name="f">
 /// An <see cref="OggFile"/> containing the file associated with this OggPlaylistFile
 /// </param>
 /// <param name="Order">
 /// A <see cref="System.Int32"/> containing a value indicating it's order
 /// </param>
 public OggPlaylistFile(OggFile f, int Order)
 {
     m_File       = f;
     m_OrderNum   = Order;
     m_Played     = false;
     m_Cached     = true;
     m_FileString = m_File.GetQuickTag(OggTags.Filename);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor for the OggPlaylistFile object (non-cached)
 /// </summary>
 /// <param name="Path">
 /// A <see cref="System.String"/> containing the path to the file
 /// </param>
 /// <param name="Order">
 /// A <see cref="System.Int32"/> containg a value indicating it's order
 /// </param>
 public OggPlaylistFile(string Path, int Order)
 {
     m_File       = null;
     m_OrderNum   = Order;
     m_Played     = false;
     m_Cached     = false;
     m_FileString = Path;
 }
Exemplo n.º 3
0
 public override bool SetCurrentFile(OggFile File)
 {
     if (!((m_PlayerState == OggPlayerStatus.Stopped) || (m_PlayerState == OggPlayerStatus.Waiting)))
     {
         return(false);
     }
     m_CurrentFile = File;
     ResetPlayerCondition();
     StateChange(OggPlayerStatus.Stopped, OggPlayerStateChanger.UserRequest);
     return(true);
 }
Exemplo n.º 4
0
 public override bool  SetCurrentFile(OggFile NewFile)
 {
     // Check current state
     if (!((m_PlayerState == OggPlayerStatus.Stopped) || (m_PlayerState == OggPlayerStatus.Waiting)))
     {
         return(false);
     }
     m_CurrentFile = NewFile;
     StateChange(OggPlayerStatus.Stopped, OggPlayerStateChanger.UserRequest);
     return(true);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Uncache the file. Use this instead of OggPlaylistFile.File = null as it sets some internal flags
 /// </summary>
 /// <returns>
 /// A <see cref="System.Boolean"/> indicating whether the operation succeeded.
 /// </returns>
 public bool UnCacheFile()
 {
     if (!(m_Cached))
     {
         return(true);
     }
     try
     {
         m_File   = null;
         m_Cached = false;
     }
     catch (Exception ex)
     {
                         #if (DEBUG)
         Console.WriteLine(DateTime.Now.ToString() + ": OggPlaylistFile.UnCacheFile: " + ex.Message);
                         #endif
         return(false);
     }
     return(true);
 }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            OggPlaylist playlist = new OggPlaylist();

            // Add the guitar sound
            OggFile guitarFile = new OggFile("GuitarSample.ogg");
            OggPlaylistFile guitarPlayList = new OggPlaylistFile(guitarFile, 0);
            playlist.Add(guitarPlayList);

            // Add the boing sound after the guitar
            OggFile boingFile = new OggFile("BoingSample.ogg");
            OggPlaylistFile boingPlayList = new OggPlaylistFile(boingFile, -1);
            playlist.Add(boingPlayList);

            OggPlayerFBN player = new OggPlayerFBN();

            // Keep playing until our playlist is empty
            while(true)
            {
                while (player.PlayerState != OggPlayerStatus.Waiting
                    && player.PlayerState != OggPlayerStatus.Stopped)
                {
                    Thread.Sleep(5);
                }

                if (playlist.GetNextFile() != null)
                {
                    playlist.CurrentFile.File.ResetFile();
                    player.SetCurrentFile(playlist.CurrentFile.File);
                    player.Play();
                }
                else
                {
                    break;
                }
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Cache the file. This creates an OggFile object for the file specified by OggPlaylistFile.FileString
 /// This will return false if the filepath is invalid or if any other error occurs during creation.
 /// </summary>
 /// <returns>
 /// A <see cref="System.Boolean"/> indicating whether the operation succeeded.
 /// </returns>
 public bool CacheFile()
 {
     if (!(System.IO.File.Exists(m_FileString)))
     {
         return(false);
     }
     if (m_Cached)
     {
         UnCacheFile();
     }
     try
     {
         m_File   = new OggFile(m_FileString);
         m_Cached = true;
     }
     catch (Exception ex)
     {
                         #if (DEBUG)
         Console.WriteLine(DateTime.Now.ToString() + ": OggPlaylistFile.CacheFile: " + ex.Message);
                         #endif
         return(false);
     }
     return(true);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Set the current file. Only valid when the player is stopped or no file has been set
 /// </summary>
 /// <param name="NewFilename">
 /// A <see cref="System.String"/> containing the path to the file to set
 /// </param>
 public abstract bool SetCurrentFile(OggFile File);
Exemplo n.º 9
0
 public override bool SetCurrentFile(OggFile File)
 {
     if (!((m_PlayerState==OggPlayerStatus.Stopped)||(m_PlayerState==OggPlayerStatus.Waiting))) { return false; }
     m_CurrentFile = File;
     ResetPlayerCondition();
     StateChange(OggPlayerStatus.Stopped, OggPlayerStateChanger.UserRequest);
     return true;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Set the current file. Only valid when the player is stopped or no file has been set
 /// </summary>
 /// <param name="NewFilename">
 /// A <see cref="System.String"/> containing the path to the file to set
 /// </param>
 public abstract bool SetCurrentFile(OggFile File);
Exemplo n.º 11
0
 /// <summary>
 /// Uncache the file. Use this instead of OggPlaylistFile.File = null as it sets some internal flags
 /// </summary>
 /// <returns>
 /// A <see cref="System.Boolean"/> indicating whether the operation succeeded.
 /// </returns>
 public bool UnCacheFile()
 {
     if (!(m_Cached)) { return true; }
     try
     {
         m_File = null;
         m_Cached = false;
     }
     catch (Exception ex)
     {
         #if (DEBUG)
         Console.WriteLine(DateTime.Now.ToString() + ": OggPlaylistFile.UnCacheFile: " + ex.Message);
         #endif
         return false;
     }
     return true;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Cache the file. This creates an OggFile object for the file specified by OggPlaylistFile.FileString
 /// This will return false if the filepath is invalid or if any other error occurs during creation.
 /// </summary>
 /// <returns>
 /// A <see cref="System.Boolean"/> indicating whether the operation succeeded.
 /// </returns>
 public bool CacheFile()
 {
     if (!(System.IO.File.Exists(m_FileString))) { return false; }
     if (m_Cached) { UnCacheFile(); }
     try
     {
         m_File = new OggFile(m_FileString);
         m_Cached = true;
     }
     catch (Exception ex)
     {
         #if (DEBUG)
         Console.WriteLine(DateTime.Now.ToString() + ": OggPlaylistFile.CacheFile: " + ex.Message);
         #endif
         return false;
     }
     return true;
 }
Exemplo n.º 13
0
 /// <summary>
 /// Constructor for the OggPlaylistFile object (non-cached)
 /// </summary>
 /// <param name="Path">
 /// A <see cref="System.String"/> containing the path to the file
 /// </param>
 /// <param name="Order">
 /// A <see cref="System.Int32"/> containg a value indicating it's order
 /// </param>
 public OggPlaylistFile(string Path, int Order)
 {
     m_File = null;
     m_OrderNum = Order;
     m_Played = false;
     m_Cached = false;
     m_FileString = Path;
 }
Exemplo n.º 14
0
        private bool m_Played; // Whether the file has been played

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor for the OggPlaylistFile object (cached)
        /// </summary>
        /// <param name="f">
        /// An <see cref="OggFile"/> containing the file associated with this OggPlaylistFile
        /// </param>
        /// <param name="Order">
        /// A <see cref="System.Int32"/> containing a value indicating it's order
        /// </param>
        public OggPlaylistFile(OggFile f, int Order)
        {
            m_File = f;
            m_OrderNum = Order;
            m_Played = false;
            m_Cached = true;
            m_FileString = m_File.GetQuickTag(OggTags.Filename);
        }
Exemplo n.º 15
0
 public override bool SetCurrentFile(OggFile NewFile)
 {
     // Check current state
     if (!((m_PlayerState==OggPlayerStatus.Stopped)||(m_PlayerState==OggPlayerStatus.Waiting))) { return false; }
     m_CurrentFile = NewFile;
     StateChange(OggPlayerStatus.Stopped, OggPlayerStateChanger.UserRequest);
     return true;
 }