Esempio n. 1
0
        /// <summary>Sends the request off. Callbacks such as onreadystatechange will be triggered.</summary>
        public void send()
        {
            if (readyState_ == 0)
            {
                // Act like it just opened:
                readyState = 1;
            }

            // Do we have a file protocol handler available?
            FileProtocol fileProtocol = location.Handler;

            if (fileProtocol == null)
            {
                return;
            }

            // Some protocols enforce a particular content type.
            string fileType = fileProtocol.ContentType(location);

            // Some file formats internally cache.
            // This means we can entirely avoid hitting the protocol system.

            // Get the format for the type:
            Contents = AudioFormats.GetInstance(fileType);

            // Did it internally cache?
            if (Contents.InternallyCached(location, this))
            {
                // Yes it did!
                return;
            }

            fileProtocol.OnGetAudio(this);
        }
Esempio n. 2
0
        /// <summary>Assign the given clip to this package.</summary>
        public void AssignClip(AudioClip clip)
        {
            // Get the contents as an ogg block:
            OggFormat ogg = Contents as OggFormat;

            if (ogg == null)
            {
                // Clear the package:
                Clear();

                // Get the audio format:
                Contents = AudioFormats.GetInstance("ogg");

                // Update ogg var:
                ogg = Contents as OggFormat;
            }

            // Apply the clip:
            ogg.Clip = clip;
        }