public IAudioDataIO GetFromMimeType(String mimeType, String path, Int32 alternate = 0)
        {
            IList <Format> formats;

            if (mimeType.StartsWith("."))
            {
                formats = getFormatsFromPath(mimeType);
            }
            else
            {
                formats = getFormatsFromMimeType(mimeType);
            }

            var formatId = NO_FORMAT;

            if (formats != null && formats.Count > alternate)
            {
                formatId = formats[alternate].ID;
            }

            IAudioDataIO theDataReader = null;

            switch (formatId)
            {
            case CidMp3:
                theDataReader = new IO.MPEGaudio(path);
                break;

            case CidAac:
                theDataReader = new IO.AAC(path);
                break;

            case CidWma:
                theDataReader = new IO.WMA(path);
                break;

            case CidOgg:
                theDataReader = new IO.Ogg(path);
                break;

            case CidFlac:
                theDataReader = new IO.FLAC(path);
                break;

            case CidMpc:
                theDataReader = new IO.MPEGplus(path);
                break;

            case CidAc3:
                theDataReader = new IO.AC3(path);
                break;

            case CidDsf:
                theDataReader = new IO.DSF(path);
                break;

            case CidDts:
                theDataReader = new IO.DTS(path);
                break;

            case CidIt:
                theDataReader = new IO.IT(path);
                break;

            case CidMidi:
                theDataReader = new IO.Midi(path);
                break;

            case CidMod:
                theDataReader = new IO.MOD(path);
                break;

            case CidApe:
                theDataReader = new IO.APE(path);
                break;

            case CidOfr:
                theDataReader = new IO.OptimFrog(path);
                break;

            case CidWavpack:
                theDataReader = new IO.WAVPack(path);
                break;

            case CidWav:
                theDataReader = new IO.WAV(path);
                break;

            case CidPsf:
                theDataReader = new IO.PSF(path);
                break;

            case CidSpc:
                theDataReader = new IO.SPC(path);
                break;

            case CidTak:
                theDataReader = new IO.TAK(path);
                break;

            case CidS3M:
                theDataReader = new IO.S3M(path);
                break;

            case CidXm:
                theDataReader = new IO.XM(path);
                break;

            case CidTta:
                theDataReader = new IO.TTA(path);
                break;

            case CidVqf:
                theDataReader = new IO.TwinVQ(path);
                break;

            case CidAiff:
                theDataReader = new IO.AIFF(path);
                break;

            case CidVgm:
                theDataReader = new IO.VGM(path);
                break;

            case CidGym:
                theDataReader = new IO.GYM(path);
                break;

            default:
                theDataReader = new IO.DummyReader(path);
                break;
            }

            return(theDataReader);
        }
示例#2
0
        public IAudioDataIO GetFromMimeType(String mimeType, String path, int alternate = 0)
        {
            IList <Format> formats;

            if (mimeType.StartsWith("."))
            {
                formats = getFormatsFromPath(mimeType);
            }
            else
            {
                formats = getFormatsFromMimeType(mimeType);
            }

            Format theFormat;

            if (formats != null && formats.Count > alternate)
            {
                theFormat = formats[alternate];
            }
            else
            {
                theFormat = UNKNOWN_FORMAT;
            }

            int formatId = theFormat.ID;

            IAudioDataIO theDataReader;

            switch (formatId)
            {
            case CID_MP3:
                theDataReader = new IO.MPEGaudio(path, theFormat);
                break;

            case CID_AAC:
                theDataReader = new IO.AAC(path, theFormat);
                break;

            case CID_MP4:
                theDataReader = new IO.MP4(path, theFormat);
                break;

            case CID_WMA:
                theDataReader = new IO.WMA(path, theFormat);
                break;

            case CID_OGG:
                theDataReader = new IO.Ogg(path, theFormat);
                break;

            case CID_FLAC:
                theDataReader = new IO.FLAC(path, theFormat);
                break;

            case CID_MPC:
                theDataReader = new IO.MPEGplus(path, theFormat);
                break;

            case CID_AC3:
                theDataReader = new IO.AC3(path, theFormat);
                break;

            case CID_DSF:
                theDataReader = new IO.DSF(path, theFormat);
                break;

            case CID_DTS:
                theDataReader = new IO.DTS(path, theFormat);
                break;

            case CID_IT:
                theDataReader = new IO.IT(path, theFormat);
                break;

            case CID_MIDI:
                theDataReader = new IO.Midi(path, theFormat);
                break;

            case CID_MOD:
                theDataReader = new IO.MOD(path, theFormat);
                break;

            case CID_APE:
                theDataReader = new IO.APE(path, theFormat);
                break;

            case CID_OFR:
                theDataReader = new IO.OptimFrog(path, theFormat);
                break;

            case CID_WAVPACK:
                theDataReader = new IO.WAVPack(path, theFormat);
                break;

            case CID_WAV:
                theDataReader = new IO.WAV(path, theFormat);
                break;

            case CID_PSF:
                theDataReader = new IO.PSF(path, theFormat);
                break;

            case CID_SPC:
                theDataReader = new IO.SPC(path, theFormat);
                break;

            case CID_TAK:
                theDataReader = new IO.TAK(path, theFormat);
                break;

            case CID_S3M:
                theDataReader = new IO.S3M(path, theFormat);
                break;

            case CID_XM:
                theDataReader = new IO.XM(path, theFormat);
                break;

            case CID_TTA:
                theDataReader = new IO.TTA(path, theFormat);
                break;

            case CID_VQF:
                theDataReader = new IO.TwinVQ(path, theFormat);
                break;

            case CID_AIFF:
                theDataReader = new IO.AIFF(path, theFormat);
                break;

            case CID_VGM:
                theDataReader = new IO.VGM(path, theFormat);
                break;

            case CID_GYM:
                theDataReader = new IO.GYM(path, theFormat);
                break;

            case CID_AA:
                theDataReader = new IO.AA(path, theFormat);
                break;

            default:
                theDataReader = new IO.DummyReader(path);
                break;
            }

            return(theDataReader);
        }
示例#3
0
        public IAudioDataIO GetFromPath(String path, int alternate = 0)
        {
            IList <Format> formats  = getFormatsFromPath(path);
            int            formatId = NO_FORMAT;

            if (formats != null && formats.Count > alternate)
            {
                formatId = formats[alternate].ID;
            }

            IAudioDataIO theDataReader = null;

            switch (formatId)
            {
            case CID_MP3:
                theDataReader = new IO.MPEGaudio(path);
                break;

            case CID_AAC:
                theDataReader = new IO.AAC(path);
                break;

            case CID_WMA:
                theDataReader = new IO.WMA(path);
                break;

            case CID_OGG:
                theDataReader = new IO.Ogg(path);
                break;

            case CID_FLAC:
                theDataReader = new IO.FLAC(path);
                break;

            case CID_MPC:
                theDataReader = new IO.MPEGplus(path);
                break;

            case CID_AC3:
                theDataReader = new IO.AC3(path);
                break;

            case CID_DSF:
                theDataReader = new IO.DSF(path);
                break;

            case CID_DTS:
                theDataReader = new IO.DTS(path);
                break;

            case CID_IT:
                theDataReader = new IO.IT(path);
                break;

            case CID_MIDI:
                theDataReader = new IO.Midi(path);
                break;

            case CID_MOD:
                theDataReader = new IO.MOD(path);
                break;

            case CID_APE:
                theDataReader = new IO.APE(path);
                break;

            case CID_OFR:
                theDataReader = new IO.OptimFrog(path);
                break;

            case CID_WAVPACK:
                theDataReader = new IO.WAVPack(path);
                break;

            case CID_WAV:
                theDataReader = new IO.WAV(path);
                break;

            case CID_PSF:
                theDataReader = new IO.PSF(path);
                break;

            case CID_SPC:
                theDataReader = new IO.SPC(path);
                break;

            case CID_TAK:
                theDataReader = new IO.TAK(path);
                break;

            case CID_S3M:
                theDataReader = new IO.S3M(path);
                break;

            case CID_XM:
                theDataReader = new IO.XM(path);
                break;

            case CID_TTA:
                theDataReader = new IO.TTA(path);
                break;

            case CID_VQF:
                theDataReader = new IO.TwinVQ(path);
                break;

            case CID_AIFF:
                theDataReader = new IO.AIFF(path);
                break;

            case CID_VGM:
                theDataReader = new IO.VGM(path);
                break;

            case CID_GYM:
                theDataReader = new IO.GYM(path);
                break;

            default:
                theDataReader = new IO.DummyReader(path);
                break;
            }

            return(theDataReader);
        }