コード例 #1
0
        /// <summary>
        /// サウンドファイルを読み込む
        /// </summary>
        /// <param name="filename">ファイル名</param>
        /// <param name="ch">読み込むチャンネル
        /// -1	 : musicチャンネル
        /// 0	 : 1~8のchunkのうち再生時(play)に再生していないチャンネルをおまかせで
        /// 1~8 : chunkに読み込む
        /// </param>
        /// <returns>読み込みエラーならばYanesdkResult.no_error以外</returns>
        public YanesdkResult Load(string filename, int ch)
        {
            Release();

            YanesdkResult result;

            if (ch == -1)
            {
                result = LoadMusic(filename);
            }
            else if (ch == 0)
            {
                result = LoadChunk(filename);
            }
            else if (1 <= ch && ch <= 8)
            {
                result = LoadChunk(filename, ch);
            }
            else
            {
                result = YanesdkResult.InvalidParameter;
            }                                                                   //	errorですよ、と。

            if (result == YanesdkResult.NoError)
            {
                loaded        = true;
                this.fileName = filename;

                // もし、ローダー以外からファイルを単に読み込んだだけならば、Reconstructableにしておく。
                if (constructInfo == null)
                {
                    constructInfo = new SoundConstructAdaptor(filename, ch);
                }

                // リソースサイズが変更になったことをcache systemに通知する
                // Releaseのときに0なのは通知しているので通知するのは正常終了時のみでok.
                CacheSystem.OnResourceChanged(this);
            }

            return(result);
        }
コード例 #2
0
        protected override YanesdkResult OnReconstruct(object param)
        {
            SoundConstructAdaptor info = param as SoundConstructAdaptor;

            return(Load(info.FileName, info.ChunkNo));
        }