Esempio n. 1
0
        public static PlaylistReaderFactory GetInstance()
        {
            if (null == theFactory)
            {
                theFactory = new PlaylistReaderFactory();
                theFactory.formatListByExt = new Dictionary <string, IList <Format> >();

                Format tempFmt = new Format("PLS");
                tempFmt.ID = PL_PLS;
                tempFmt.AddExtension(".pls");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("M3U");
                tempFmt.ID = PL_M3U;
                tempFmt.AddExtension(".m3u");
                tempFmt.AddExtension(".m3u8");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("FPL (experimental)");
                tempFmt.ID = PL_FPL;
                tempFmt.AddExtension(".fpl");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("XSPF (spiff)");
                tempFmt.ID = PL_XSPF;
                tempFmt.AddExtension(".xspf");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("SMIL");
                tempFmt.ID = PL_SMIL;
                tempFmt.AddExtension(".smil");
                tempFmt.AddExtension(".smi");
                tempFmt.AddExtension(".zpl");
                tempFmt.AddExtension(".wpl");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("ASX");
                tempFmt.ID = PL_ASX;
                tempFmt.AddExtension(".asx");
                tempFmt.AddExtension(".wax");
                tempFmt.AddExtension(".wvx");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("B4S");
                tempFmt.ID = PL_B4S;
                tempFmt.AddExtension(".b4s");
                theFactory.addFormat(tempFmt);
            }

            return(theFactory);
        }
Esempio n. 2
0
        public void Factories_FormatCpy()
        {
            Format f1 = new Format(1, "AAA");

            f1.AddMimeType("ab/cd");
            f1.AddExtension("aa");

            Format f2 = new Format(f1);

            f1.AddMimeType("ef/gh");
            f1.ID = 2;
            f1.AddExtension("bb");
            f1.Name = "AA";

            Assert.AreEqual("AAA", f2.Name);
            Assert.AreEqual(1, f2.ID);
            Assert.AreEqual(1, f2.MimeList.Count);
            Assert.AreEqual(false, f2.IsValidExtension("bb"));
        }
        public static CatalogDataReaderFactory GetInstance()
        {
            if (null == theFactory)
            {
                theFactory = new CatalogDataReaderFactory();
                theFactory.formatListByExt = new Dictionary <string, IList <Format> >();

                Format tempFmt = new Format(CR_CUE, "CUE sheet");
                tempFmt.AddExtension(".cue");
                theFactory.addFormat(tempFmt);
            }

            return(theFactory);
        }
Esempio n. 4
0
        // ------------------------------------------------------------------------------------------

        /// <summary>
        /// Gets the instance of this factory (Singleton pattern)
        /// </summary>
        /// <returns>Instance of the MetaReaderFactory of the application</returns>
        public static MetaDataIOFactory GetInstance()
        {
            if (!BitConverter.IsLittleEndian)
            {
                throw new PlatformNotSupportedException("Big-endian based platforms are not supported by ATL");
            }
            lock (_lockable)
            {
                if (null == theFactory)
                {
                    theFactory                = new MetaDataIOFactory();
                    theFactory.tagPriority    = new int[TAG_TYPE_COUNT];
                    theFactory.tagPriority[0] = TAG_ID3V2;
                    theFactory.tagPriority[1] = TAG_APE;
                    theFactory.tagPriority[2] = TAG_NATIVE;
                    theFactory.tagPriority[3] = TAG_ID3V1;

                    theFactory.formatListByExt  = new Dictionary <string, IList <Format> >();
                    theFactory.formatListByMime = new Dictionary <string, IList <Format> >();

                    Format tempFmt = new Format(TAG_ID3V1 * 1000, "ID3v1");
                    tempFmt.AddExtension("id3v1");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(TAG_ID3V2 * 1000, "ID3v2");
                    tempFmt.AddExtension("id3v2");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(TAG_APE * 1000, "APEtag");
                    tempFmt.AddExtension("ape");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(TAG_NATIVE * 1000, "Native");
                    tempFmt.AddExtension("native");
                    theFactory.addFormat(tempFmt);
                }
            }

            return(theFactory);
        }
Esempio n. 5
0
        // ------------------------------------------------------------------------------------------

        /// <summary>
        /// Gets the instance of this factory (Singleton pattern)
        /// </summary>
        /// <returns>Instance of the AudioReaderFactory of the application</returns>
        public static AudioDataIOFactory GetInstance()
        {
            if (!BitConverter.IsLittleEndian)
            {
                throw new PlatformNotSupportedException("Big-endian based platforms are not supported by ATL");
            }

            lock (_lockable)
            {
                if (null == theFactory)
                {
                    theFactory = new AudioDataIOFactory();

                    theFactory.formatListByExt  = new Dictionary <string, IList <Format> >();
                    theFactory.formatListByMime = new Dictionary <string, IList <Format> >();

                    Format tempFmt = new Format(CID_MP3, "MPEG Audio", "MPEG");
                    tempFmt.AddMimeType("audio/mp3");
                    tempFmt.AddMimeType("audio/mpeg");
                    tempFmt.AddMimeType("audio/x-mpeg");
                    tempFmt.AddExtension(".mp1");
                    tempFmt.AddExtension(".mp2");
                    tempFmt.AddExtension(".mp3");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_OGG, "OGG : Vorbis, Opus", "OGG");
                    tempFmt.AddMimeType("audio/ogg");
                    tempFmt.AddMimeType("audio/vorbis");
                    tempFmt.AddMimeType("audio/opus");
                    tempFmt.AddMimeType("audio/ogg;codecs=opus");
                    tempFmt.AddExtension(".ogg");
                    tempFmt.AddExtension(".opus");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_MPC, "Musepack / MPEGplus", "MPC");
                    tempFmt.AddMimeType("audio/x-musepack");
                    tempFmt.AddMimeType("audio/musepack");
                    tempFmt.AddExtension(".mp+");
                    tempFmt.AddExtension(".mpc");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_WMA, "Windows Media Audio", "WMA");
                    tempFmt.AddMimeType("audio/x-ms-wma");
                    tempFmt.AddMimeType("video/x-ms-asf");
                    tempFmt.AddExtension(".asf");
                    tempFmt.AddExtension(".wma");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_AAC, "Advanced Audio Coding");
                    tempFmt.AddMimeType("audio/aac");
                    tempFmt.AddExtension(".aac");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_MP4, "MPEG-4 Part 14", "MPEG-4");
                    tempFmt.AddMimeType("audio/mp4");
                    tempFmt.AddMimeType("audio/mp4a-latm");
                    tempFmt.AddMimeType("audio/vnd.audible.aax");
                    tempFmt.AddExtension(".mp4");
                    tempFmt.AddExtension(".m4a");
                    tempFmt.AddExtension(".m4b");
                    tempFmt.AddExtension(".m4p");
                    tempFmt.AddExtension(".m4r");
                    tempFmt.AddExtension(".m4v");
                    tempFmt.AddExtension(".aax");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_AC3, "Dolby Digital", "Dolby");
                    tempFmt.AddMimeType("audio/ac3");
                    tempFmt.AddExtension(".ac3");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_DTS, "Digital Theatre System", "DTS");
                    tempFmt.AddMimeType("audio/vnd.dts");
                    tempFmt.AddMimeType("audio/vnd.dts.hd");
                    tempFmt.AddExtension(".dts");
                    tempFmt.Readable = false;
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_VQF, "TwinVQ");
                    tempFmt.AddExtension(".vqf");
                    tempFmt.AddMimeType("audio/x-twinvq");
                    tempFmt.Readable = false;
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_FLAC, "Free Lossless Audio Codec", "FLAC");
                    tempFmt.AddMimeType("audio/x-flac");
                    tempFmt.AddExtension(".flac");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_APE, "Monkey's Audio", "APE");
                    tempFmt.AddMimeType("audio/ape");
                    tempFmt.AddMimeType("audio/x-ape");
                    tempFmt.AddExtension(".ape");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_OFR, "OptimFROG");
                    tempFmt.AddMimeType("audio/ofr");
                    tempFmt.AddMimeType("audio/x-ofr");
                    tempFmt.AddExtension(".ofr");
                    tempFmt.AddExtension(".ofs");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_WAVPACK, "WAVPack");
                    tempFmt.AddMimeType("audio/x-wavpack");
                    tempFmt.AddMimeType("audio/wavpack");
                    tempFmt.AddExtension(".wv");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_WAV, "PCM (uncompressed audio)", "WAV");
                    tempFmt.AddMimeType("audio/x-wav");
                    tempFmt.AddMimeType("audio/wav");
                    tempFmt.AddExtension(".wav");
                    tempFmt.AddExtension(".bwf");
                    tempFmt.AddExtension(".bwav");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_MIDI, "Musical Instruments Digital Interface", "MIDI");
                    tempFmt.AddMimeType("audio/mid");
                    tempFmt.AddExtension(".mid");
                    tempFmt.AddExtension(".midi");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_DSF, "Direct Stream Digital", "DSD");
                    tempFmt.AddMimeType("audio/dsf");
                    tempFmt.AddMimeType("audio/x-dsf");
                    tempFmt.AddMimeType("audio/dsd");
                    tempFmt.AddMimeType("audio/x-dsd");
                    tempFmt.AddExtension(".dsf");
                    tempFmt.AddExtension(".dsd");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_PSF, "Portable Sound Format", "PSF");
                    tempFmt.AddMimeType("audio/psf");   // Unofficial
                    tempFmt.AddMimeType("audio/x-psf"); // Unofficial
                    tempFmt.AddExtension(".psf");
                    tempFmt.AddExtension(".psf1");
                    tempFmt.AddExtension(".minipsf");
                    tempFmt.AddExtension(".minipsf1");
                    tempFmt.AddExtension(".psf2");
                    tempFmt.AddExtension(".minipsf2");
                    tempFmt.AddExtension(".ssf");
                    tempFmt.AddExtension(".minissf");
                    tempFmt.AddExtension(".dsf");
                    tempFmt.AddExtension(".minidsf");
                    tempFmt.AddExtension(".gsf");
                    tempFmt.AddExtension(".minigsf");
                    tempFmt.AddExtension(".qsf");
                    tempFmt.AddExtension(".miniqsf");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_SPC, "SPC700 Sound Files", "SPC");
                    tempFmt.AddMimeType("audio/spc");   // Unofficial
                    tempFmt.AddMimeType("audio/x-spc"); // Unofficial
                    tempFmt.AddExtension(".spc");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_TTA, "True Audio");
                    tempFmt.AddMimeType("audio/tta");
                    tempFmt.AddMimeType("audio/x-tta");
                    tempFmt.AddExtension(".tta");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_TAK, "Tom's lossless Audio Kompressor", "TAK");
                    tempFmt.AddMimeType("audio/tak");   // Unofficial
                    tempFmt.AddMimeType("audio/x-tak"); // Unofficial
                    tempFmt.AddExtension(".tak");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_MOD, "Tracker Module", "MOD");
                    tempFmt.AddMimeType("audio/x-mod");
                    tempFmt.AddExtension(".mod");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_S3M, "ScreamTracker Module", "S3M");
                    tempFmt.AddMimeType("audio/s3m");
                    tempFmt.AddMimeType("audio/x-s3m");
                    tempFmt.AddExtension(".s3m");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_XM, "Extended Module", "XM");
                    tempFmt.AddMimeType("audio/xm");
                    tempFmt.AddMimeType("audio/x-xm");
                    tempFmt.AddExtension(".xm");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_IT, "Impulse Tracker", "IT");
                    tempFmt.AddMimeType("audio/it");
                    tempFmt.AddExtension(".it");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_AIFF, "Audio Interchange File Format", "AIFF");
                    tempFmt.AddMimeType("audio/x-aiff");
                    tempFmt.AddExtension(".aif");
                    tempFmt.AddExtension(".aiff");
                    tempFmt.AddExtension(".aifc");
                    tempFmt.AddExtension(".snd");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_VGM, "Video Game Music", "VGM");
                    tempFmt.AddMimeType("audio/vgm");   // Unofficial
                    tempFmt.AddMimeType("audio/x-vgm"); // Unofficial
                    tempFmt.AddExtension(".vgm");
                    tempFmt.AddExtension(".vgz");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_GYM, "Genesis YM2612", "GYM");
                    tempFmt.AddMimeType("audio/gym");   // Unofficial
                    tempFmt.AddMimeType("audio/x-gym"); // Unofficial
                    tempFmt.AddExtension(".gym");
                    theFactory.addFormat(tempFmt);

                    tempFmt = new Format(CID_AA, "Audible (legacy)", "AA");
                    tempFmt.AddMimeType("audio/audible");
                    tempFmt.AddMimeType("audio/x-pn-audibleaudio");
                    tempFmt.AddExtension(".aa");
                    theFactory.addFormat(tempFmt);
                }
            }

            return(theFactory);
        }
        // ------------------------------------------------------------------------------------------

        /// <summary>
        /// Gets the instance of this factory (Singleton pattern)
        /// </summary>
        /// <returns>Instance of the AudioReaderFactory of the application</returns>
        public static AudioDataIoFactory GetInstance()
        {
            if (!BitConverter.IsLittleEndian)
            {
                throw new PlatformNotSupportedException("Big-endian based platforms are not supported by ModifiedAtl");
            }

            if (null != _theFactory)
            {
                return(_theFactory);
            }
            _theFactory = new AudioDataIoFactory
            {
                formatListByExt  = new Dictionary <String, IList <Format> >(),
                formatListByMime = new Dictionary <String, IList <Format> >()
            };


            var tempFmt = new Format("MPEG Audio Layer")
            {
                ID = CidMp3
            };

            tempFmt.AddMimeType("audio/mp3");
            tempFmt.AddMimeType("audio/mpeg");
            tempFmt.AddMimeType("audio/x-mpeg");
            tempFmt.AddExtension(".mp1");
            tempFmt.AddExtension(".mp2");
            tempFmt.AddExtension(".mp3");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("OGG : Vorbis, Opus")
            {
                ID = CidOgg
            };
            tempFmt.AddMimeType("audio/ogg");
            tempFmt.AddMimeType("audio/vorbis");
            tempFmt.AddMimeType("audio/opus");
            tempFmt.AddMimeType("audio/ogg;codecs=opus");
            tempFmt.AddExtension(".ogg");
            tempFmt.AddExtension(".opus");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("Musepack / MPEGplus")
            {
                ID = CidMpc
            };
            tempFmt.AddMimeType("audio/x-musepack");
            tempFmt.AddMimeType("audio/musepack");
            tempFmt.AddExtension(".mp+");
            tempFmt.AddExtension(".mpc");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("Windows Media Audio")
            {
                ID = CidWma
            };
            tempFmt.AddMimeType("audio/x-ms-wma");
            tempFmt.AddMimeType("video/x-ms-asf");
            tempFmt.AddExtension(".asf");
            tempFmt.AddExtension(".wma");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("Advanced Audio Coding")
            {
                ID = CidAac
            };
            tempFmt.AddMimeType("audio/mp4");
            tempFmt.AddMimeType("audio/aac");
            tempFmt.AddMimeType("audio/mp4a-latm");
            tempFmt.AddExtension(".aac");
            tempFmt.AddExtension(".mp4");
            tempFmt.AddExtension(".m4a");
            tempFmt.AddExtension(".m4v");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("Dolby Digital")
            {
                ID = CidAc3
            };
            tempFmt.AddMimeType("audio/ac3");
            tempFmt.AddExtension(".ac3");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("Digital Theatre System")
            {
                ID = CidDts
            };
            tempFmt.AddMimeType("audio/vnd.dts");
            tempFmt.AddMimeType("audio/vnd.dts.hd");
            tempFmt.AddExtension(".dts");
            tempFmt.Readable = false;
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("TwinVQ")
            {
                ID = CidVqf
            };
            tempFmt.AddExtension(".vqf");
            tempFmt.AddMimeType("audio/x-twinvq");
            tempFmt.Readable = false;
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("Free Lossless Audio Codec")
            {
                ID = CidFlac
            };
            tempFmt.AddMimeType("audio/x-flac");
            tempFmt.AddExtension(".flac");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("Monkey's Audio")
            {
                ID = CidApe
            };
            tempFmt.AddMimeType("audio/ape");
            tempFmt.AddMimeType("audio/x-ape");
            tempFmt.AddExtension(".ape");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("OptimFROG")
            {
                ID = CidOfr
            };
            tempFmt.AddMimeType("audio/ofr");
            tempFmt.AddMimeType("audio/x-ofr");
            tempFmt.AddExtension(".ofr");
            tempFmt.AddExtension(".ofs");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("WAVPack")
            {
                ID = CidWavpack
            };
            tempFmt.AddMimeType("audio/x-wavpack");
            tempFmt.AddMimeType("audio/wavpack");
            tempFmt.AddExtension(".wv");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("PCM (uncompressed audio)")
            {
                ID = CidWav
            };
            tempFmt.AddMimeType("audio/x-wav");
            tempFmt.AddMimeType("audio/wav");
            tempFmt.AddExtension(".wav");
            tempFmt.AddExtension(".bwf");
            tempFmt.AddExtension(".bwav");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("Musical Instruments Digital Interface")
            {
                ID = CidMidi
            };
            tempFmt.AddMimeType("audio/mid");
            tempFmt.AddExtension(".mid");
            tempFmt.AddExtension(".midi");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("Direct Stream Digital")
            {
                ID = CidDsf
            };
            tempFmt.AddMimeType("audio/dsf");
            tempFmt.AddMimeType("audio/x-dsf");
            tempFmt.AddMimeType("audio/dsd");
            tempFmt.AddMimeType("audio/x-dsd");
            tempFmt.AddExtension(".dsf");
            tempFmt.AddExtension(".dsd");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("Portable Sound Format")
            {
                ID = CidPsf
            };
            tempFmt.AddMimeType("audio/psf");   // Unofficial
            tempFmt.AddMimeType("audio/x-psf"); // Unofficial
            tempFmt.AddExtension(".psf");
            tempFmt.AddExtension(".psf1");
            tempFmt.AddExtension(".minipsf");
            tempFmt.AddExtension(".minipsf1");
            tempFmt.AddExtension(".psf2");
            tempFmt.AddExtension(".minipsf2");
            tempFmt.AddExtension(".ssf");
            tempFmt.AddExtension(".minissf");
            tempFmt.AddExtension(".dsf");
            tempFmt.AddExtension(".minidsf");
            tempFmt.AddExtension(".gsf");
            tempFmt.AddExtension(".minigsf");
            tempFmt.AddExtension(".qsf");
            tempFmt.AddExtension(".miniqsf");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("SPC700 Sound Files")
            {
                ID = CidSpc
            };
            tempFmt.AddMimeType("audio/spc");   // Unofficial
            tempFmt.AddMimeType("audio/x-spc"); // Unofficial
            tempFmt.AddExtension(".spc");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("True Audio")
            {
                ID = CidTta
            };
            tempFmt.AddMimeType("audio/tta");
            tempFmt.AddMimeType("audio/x-tta");
            tempFmt.AddExtension(".tta");
            _theFactory.addFormat(tempFmt);

            tempFmt = new Format("Tom's lossless Audio Kompressor (TAK)")
            {
                ID = CidTak
            };
            tempFmt.AddMimeType("audio/tak");   // Unofficial
            tempFmt.AddMimeType("audio/x-tak"); // Unofficial
            tempFmt.AddExtension(".tak");
            _theFactory.addFormat(tempFmt);

            tempFmt    = new Format("Noisetracker/Soundtracker/Protracker Module");
            tempFmt.ID = CidMod;
            tempFmt.AddMimeType("audio/x-mod");
            tempFmt.AddExtension(".mod");
            _theFactory.addFormat(tempFmt);

            tempFmt    = new Format("ScreamTracker Module");
            tempFmt.ID = CidS3M;
            tempFmt.AddMimeType("audio/s3m");
            tempFmt.AddMimeType("audio/x-s3m");
            tempFmt.AddExtension(".s3m");
            _theFactory.addFormat(tempFmt);

            tempFmt    = new Format("Extended Module");
            tempFmt.ID = CidXm;
            tempFmt.AddMimeType("audio/xm");
            tempFmt.AddMimeType("audio/x-xm");
            tempFmt.AddExtension(".xm");
            _theFactory.addFormat(tempFmt);

            tempFmt    = new Format("Impulse Tracker");
            tempFmt.ID = CidIt;
            tempFmt.AddMimeType("audio/it");
            tempFmt.AddExtension(".it");
            _theFactory.addFormat(tempFmt);

            tempFmt    = new Format("Audio Interchange File Format: (Audio IFF)");
            tempFmt.ID = CidAiff;
            tempFmt.AddMimeType("audio/x-aiff");
            tempFmt.AddExtension(".aif");
            tempFmt.AddExtension(".aiff");
            tempFmt.AddExtension(".aifc");
            tempFmt.AddExtension(".snd");
            _theFactory.addFormat(tempFmt);

            tempFmt    = new Format("Video Game Music");
            tempFmt.ID = CidVgm;
            tempFmt.AddMimeType("audio/vgm");   // Unofficial
            tempFmt.AddMimeType("audio/x-vgm"); // Unofficial
            tempFmt.AddExtension(".vgm");
            tempFmt.AddExtension(".vgz");
            _theFactory.addFormat(tempFmt);

            tempFmt    = new Format("Genesis YM2612");
            tempFmt.ID = CidGym;
            tempFmt.AddMimeType("audio/gym");   // Unofficial
            tempFmt.AddMimeType("audio/x-gym"); // Unofficial
            tempFmt.AddExtension(".gym");
            _theFactory.addFormat(tempFmt);

            return(_theFactory);
        }
Esempio n. 7
0
        // ------------------------------------------------------------------------------------------

        /// <summary>
        /// Gets the instance of this factory (Singleton pattern)
        /// </summary>
        /// <returns>Instance of the AudioReaderFactory of the application</returns>
        public static AudioDataIOFactory GetInstance()
        {
            if (!BitConverter.IsLittleEndian)
            {
                throw new PlatformNotSupportedException("Big-endian based platforms are not supported by ATL");
            }

            if (null == theFactory)
            {
                theFactory = new AudioDataIOFactory();

                theFactory.formatListByExt  = new Dictionary <string, IList <Format> >();
                theFactory.formatListByMime = new Dictionary <string, IList <Format> >();

                Format tempFmt = new Format("MPEG Audio Layer");
                tempFmt.ID = CID_MP3;
                tempFmt.AddMimeType("audio/mp3");
                tempFmt.AddMimeType("audio/mpeg");
                tempFmt.AddMimeType("audio/x-mpeg");
                tempFmt.AddExtension(".mp1");
                tempFmt.AddExtension(".mp2");
                tempFmt.AddExtension(".mp3");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("OGG : Vorbis, Opus");
                tempFmt.ID = CID_OGG;
                tempFmt.AddMimeType("audio/ogg");
                tempFmt.AddMimeType("audio/vorbis");
                tempFmt.AddMimeType("audio/opus");
                tempFmt.AddMimeType("audio/ogg;codecs=opus");
                tempFmt.AddExtension(".ogg");
                tempFmt.AddExtension(".opus");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Musepack / MPEGplus");
                tempFmt.ID = CID_MPC;
                tempFmt.AddMimeType("audio/x-musepack");
                tempFmt.AddMimeType("audio/musepack");
                tempFmt.AddExtension(".mp+");
                tempFmt.AddExtension(".mpc");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Windows Media Audio");
                tempFmt.ID = CID_WMA;
                tempFmt.AddMimeType("audio/x-ms-wma");
                tempFmt.AddMimeType("video/x-ms-asf");
                tempFmt.AddExtension(".asf");
                tempFmt.AddExtension(".wma");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Advanced Audio Coding");
                tempFmt.ID = CID_AAC;
                tempFmt.AddMimeType("audio/mp4");
                tempFmt.AddMimeType("audio/aac");
                tempFmt.AddMimeType("audio/mp4a-latm");
                tempFmt.AddExtension(".aac");
                tempFmt.AddExtension(".mp4");
                tempFmt.AddExtension(".m4a");
                tempFmt.AddExtension(".m4v");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Dolby Digital");
                tempFmt.ID = CID_AC3;
                tempFmt.AddMimeType("audio/ac3");
                tempFmt.AddExtension(".ac3");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Digital Theatre System");
                tempFmt.ID = CID_DTS;
                tempFmt.AddMimeType("audio/vnd.dts");
                tempFmt.AddMimeType("audio/vnd.dts.hd");
                tempFmt.AddExtension(".dts");
                tempFmt.Readable = false;
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("TwinVQ");
                tempFmt.ID = CID_VQF;
                tempFmt.AddExtension(".vqf");
                tempFmt.AddMimeType("audio/x-twinvq");
                tempFmt.Readable = false;
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Free Lossless Audio Codec");
                tempFmt.ID = CID_FLAC;
                tempFmt.AddMimeType("audio/x-flac");
                tempFmt.AddExtension(".flac");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Monkey's Audio");
                tempFmt.ID = CID_APE;
                tempFmt.AddMimeType("audio/ape");
                tempFmt.AddMimeType("audio/x-ape");
                tempFmt.AddExtension(".ape");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("OptimFROG");
                tempFmt.ID = CID_OFR;
                tempFmt.AddMimeType("audio/ofr");
                tempFmt.AddMimeType("audio/x-ofr");
                tempFmt.AddExtension(".ofr");
                tempFmt.AddExtension(".ofs");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("WAVPack");
                tempFmt.ID = CID_WAVPACK;
                tempFmt.AddMimeType("audio/x-wavpack");
                tempFmt.AddMimeType("audio/wavpack");
                tempFmt.AddExtension(".wv");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("PCM (uncompressed audio)");
                tempFmt.ID = CID_WAV;
                tempFmt.AddMimeType("audio/x-wav");
                tempFmt.AddMimeType("audio/wav");
                tempFmt.AddExtension(".wav");
                tempFmt.AddExtension(".bwf");
                tempFmt.AddExtension(".bwav");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Musical Instruments Digital Interface");
                tempFmt.ID = CID_MIDI;
                tempFmt.AddMimeType("audio/mid");
                tempFmt.AddExtension(".mid");
                tempFmt.AddExtension(".midi");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Direct Stream Digital");
                tempFmt.ID = CID_DSF;
                tempFmt.AddMimeType("audio/dsf");
                tempFmt.AddMimeType("audio/x-dsf");
                tempFmt.AddMimeType("audio/dsd");
                tempFmt.AddMimeType("audio/x-dsd");
                tempFmt.AddExtension(".dsf");
                tempFmt.AddExtension(".dsd");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Portable Sound Format");
                tempFmt.ID = CID_PSF;
                tempFmt.AddMimeType("audio/psf");   // Unofficial
                tempFmt.AddMimeType("audio/x-psf"); // Unofficial
                tempFmt.AddExtension(".psf");
                tempFmt.AddExtension(".psf1");
                tempFmt.AddExtension(".minipsf");
                tempFmt.AddExtension(".minipsf1");
                tempFmt.AddExtension(".psf2");
                tempFmt.AddExtension(".minipsf2");
                tempFmt.AddExtension(".ssf");
                tempFmt.AddExtension(".minissf");
                tempFmt.AddExtension(".dsf");
                tempFmt.AddExtension(".minidsf");
                tempFmt.AddExtension(".gsf");
                tempFmt.AddExtension(".minigsf");
                tempFmt.AddExtension(".qsf");
                tempFmt.AddExtension(".miniqsf");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("SPC700 Sound Files");
                tempFmt.ID = CID_SPC;
                tempFmt.AddMimeType("audio/spc");   // Unofficial
                tempFmt.AddMimeType("audio/x-spc"); // Unofficial
                tempFmt.AddExtension(".spc");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("True Audio");
                tempFmt.ID = CID_TTA;
                tempFmt.AddMimeType("audio/tta");
                tempFmt.AddMimeType("audio/x-tta");
                tempFmt.AddExtension(".tta");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Tom's lossless Audio Kompressor (TAK)");
                tempFmt.ID = CID_TAK;
                tempFmt.AddMimeType("audio/tak");   // Unofficial
                tempFmt.AddMimeType("audio/x-tak"); // Unofficial
                tempFmt.AddExtension(".tak");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Noisetracker/Soundtracker/Protracker Module");
                tempFmt.ID = CID_MOD;
                tempFmt.AddMimeType("audio/x-mod");
                tempFmt.AddExtension(".mod");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("ScreamTracker Module");
                tempFmt.ID = CID_S3M;
                tempFmt.AddMimeType("audio/s3m");
                tempFmt.AddMimeType("audio/x-s3m");
                tempFmt.AddExtension(".s3m");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Extended Module");
                tempFmt.ID = CID_XM;
                tempFmt.AddMimeType("audio/xm");
                tempFmt.AddMimeType("audio/x-xm");
                tempFmt.AddExtension(".xm");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Impulse Tracker");
                tempFmt.ID = CID_IT;
                tempFmt.AddMimeType("audio/it");
                tempFmt.AddExtension(".it");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Audio Interchange File Format: (Audio IFF)");
                tempFmt.ID = CID_AIFF;
                tempFmt.AddMimeType("audio/x-aiff");
                tempFmt.AddExtension(".aif");
                tempFmt.AddExtension(".aiff");
                tempFmt.AddExtension(".aifc");
                tempFmt.AddExtension(".snd");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Video Game Music");
                tempFmt.ID = CID_VGM;
                tempFmt.AddMimeType("audio/vgm");   // Unofficial
                tempFmt.AddMimeType("audio/x-vgm"); // Unofficial
                tempFmt.AddExtension(".vgm");
                tempFmt.AddExtension(".vgz");
                theFactory.addFormat(tempFmt);

                tempFmt    = new Format("Genesis YM2612");
                tempFmt.ID = CID_GYM;
                tempFmt.AddMimeType("audio/gym");   // Unofficial
                tempFmt.AddMimeType("audio/x-gym"); // Unofficial
                tempFmt.AddExtension(".gym");
                theFactory.addFormat(tempFmt);
            }

            return(theFactory);
        }