public PlayerMidi(string aFilePath)
        {
            FilePath = aFilePath;
            Music    = ConstructorCollection.ConstructMusic(aFilePath);

            sequencer = new MidiSequencer(( MusicMidi )Music, new MidiSynthesizer());

            updatePlayCurrent = sequencer.UpdatePlay;
        }
Exemple #2
0
        private void UpdateFileList(object sender, FileSystemEventArgs e)
        {
            string[]      lFilePathArray   = PoolFilePath.Get(directoryInfo);
            List <string> lFilePathNewList = new List <string>();

            // Check New File.
            for (int i = 0; i < lFilePathArray.Length; i++)
            {
                string lFilePath       = lFilePathArray[i];
                long   lTimeStampTicks = File.GetLastWriteTime(lFilePath).Ticks;

                if (timeStampTicksDictionary.ContainsKey(lFilePath) == false)
                {
                    timeStampTicksDictionary.Add(lFilePath, lTimeStampTicks);
                    lFilePathNewList.Add(lFilePath);
                }
                else if (lTimeStampTicks != timeStampTicksDictionary[lFilePath])
                {
                    timeStampTicksDictionary[lFilePath] = lTimeStampTicks;
                    lFilePathNewList.Add(lFilePath);
                }
            }

            for (int i = 0; i < lFilePathNewList.Count; i++)
            {
                string lFilePath = lFilePathNewList[i];
                //Logger.BreakDebug( "Input:" + lFilePath );

                if (Path.GetExtension(lFilePath) == ".meta")
                {
                    continue;
                }

                try
                {
                    IMusic lMusic = ConstructorCollection.ConstructMusic(lFilePath);

                    if (lMusic != null)
                    {
                        if (musicInformationDictionary.ContainsKey(lFilePath) == false)
                        {
                            filePathList.Add(lFilePath);
                            musicInformationDictionary.Add(lFilePath, new InputMusicInformation(timeStampTicksDictionary[lFilePath], false, lMusic, 0.0d));
                        }
                        else
                        {
                            musicInformationDictionary[lFilePath] = new InputMusicInformation(timeStampTicksDictionary[lFilePath], false, lMusic, 0.0d);
                        }
                    }
                }
                catch (Exception aExpection)
                {
                    Logger.BreakError("LoopPlaylist Exception:" + aExpection.ToString() + ":" + lFilePath);
                }
            }
        }
Exemple #3
0
        /*
         * public PlayerPcm()
         * {
         *      Volume = 0.5f;
         *      IsMute = false;
         *      IsLoop = true;
         * }
         */

        public PlayerPcm(string aFilePath)
            : this(aFilePath, ( MusicPcm )ConstructorCollection.ConstructMusic(aFilePath))
        {
        }