예제 #1
0
파일: example.cs 프로젝트: ssh352/codec
    static void Main(string[] args)
    {
        Cdr d = new Cdr();

        d.setString(codecBinding.MessageType, "A");
        d.setString(codecBinding.UserName, "username");
        d.setString(codecBinding.Password, "password");
        d.setString(codecBinding.NewPassword, "password1");
        d.setInteger(codecBinding.MessageVersion, 0);

        Console.WriteLine(d.toString());

        CodecFactory cf       = new CodecFactory();
        Codec        lseCodec = cf.getCodec("lse");

        Neueda.Codecs.Buffer b = lseCodec.encode(d);

        Console.WriteLine(b);

        Cdr decoded = lseCodec.decodeBuffer(b).getCdr();

        Console.WriteLine(decoded.toString());
    }
예제 #2
0
        private bool read(int codecType, sceAtrac3plus.AtracFileInfo atracFileInfo)
        {
            codec = CodecFactory.getCodec(codecType);
            if (codec == null)
            {
                return(false);
            }

            int result = codec.init(atracFileInfo.atracBytesPerFrame, atracFileInfo.atracChannels, atracFileInfo.atracChannels, atracFileInfo.atracCodingMode);

            if (result < 0)
            {
                return(false);
            }

            AudioFormat audioFormat = new AudioFormat(44100, 16, atracFileInfo.atracChannels, true, false);

            DataLine.Info info = new DataLine.Info(typeof(SourceDataLine), audioFormat);
            try
            {
                mLine = (SourceDataLine)AudioSystem.getLine(info);
                mLine.open(audioFormat);
            }
            catch (LineUnavailableException)
            {
                return(false);
            }
            mLine.start();

            inputOffset        = atracFileInfo.inputFileDataOffset;
            inputPosition      = inputOffset;
            inputBytesPerFrame = atracFileInfo.atracBytesPerFrame;
            channels           = atracFileInfo.atracChannels;

            return(true);
        }
예제 #3
0
 public virtual void initCodec(int codecType)
 {
     codec            = CodecFactory.getCodec(codecType);
     CodecInitialized = false;
 }