Example #1
0
        /// <summary>
        /// Open Audio Codec Manager MP3 decoder.
        /// ACM��g����MP3��f�R�[�h����B
        /// </summary>
        /// <param name="maxBufferSize">Max decode bytes per calling Decode.</param>
        public AcmMp3Decoder(int maxBufferSize)
        {
            this.maxBufferSize = maxBufferSize;

            Win32.MPEGLayer3WaveFormat src = new Win32.MPEGLayer3WaveFormat(44100, 16, 2);
            Win32.WaveFormatEx dst = new Win32.WaveFormatEx(44100, 16, 2);
            int mmret = Win32.acmFormatSuggest(IntPtr.Zero, ref src, ref dst, (uint)Win32.WaveFormatEx.SizeOfWaveFormatEx, Win32.ACM_FORMATSUGGESTF_WFORMATTAG);
            if (mmret != 0)
                throw new Exception("Error on acmFormatSuggest. (ret=" + mmret + ") no mp3 codec found...?");

            mmret = Win32.acmStreamOpen(out deviceHandle, IntPtr.Zero, ref src, ref dst, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0);
            if (mmret != 0)
                throw new Exception("Error on acmStreamOpen. (ret=" + mmret + ")");
        }
Example #2
0
        /// <summary>
        /// Open Audio Codec Manager MP3 decoder.
        /// ACM��g����MP3��f�R�[�h����B
        /// </summary>
        /// <param name="maxBufferSize">Max decode bytes per calling Decode.</param>
        public AcmMp3Decoder(int maxBufferSize)
        {
            this.maxBufferSize = maxBufferSize;

            Win32.MPEGLayer3WaveFormat src = new Win32.MPEGLayer3WaveFormat(44100, 16, 2);
            Win32.WaveFormatEx dst = new Win32.WaveFormatEx(44100, 16, 2);
            int mmret = Win32.acmFormatSuggest(IntPtr.Zero, ref src, ref dst, (uint)Win32.WaveFormatEx.SizeOfWaveFormatEx, Win32.ACM_FORMATSUGGESTF_WFORMATTAG);
            if (mmret != 0)
                throw new Exception("���̃}�V���AMP3�f�R�[�h�ł��Ȃ����Č����Ă܂� (" + mmret + ")");

            mmret = Win32.acmStreamOpen(out deviceHandle, IntPtr.Zero, ref src, ref dst, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0);
            if (mmret != 0)
                throw new Exception("�f�o�C�X���J���܂���ł����B(" + mmret + ")");
        }
Example #3
0
        /// <summary>
        /// Open Audio Codec Manager MP3 decoder.
        /// ACMを使ってMP3をデコードする。
        /// </summary>
        /// <param name="maxBufferSize">Max decode bytes per calling Decode.</param>
        public AcmMp3Decoder(int maxBufferSize)
        {
            this.maxBufferSize = maxBufferSize;

            Win32.MPEGLayer3WaveFormat src = new Win32.MPEGLayer3WaveFormat(44100, 16, 2);
            Win32.WaveFormatEx         dst = new Win32.WaveFormatEx(44100, 16, 2);
            int mmret = Win32.acmFormatSuggest(IntPtr.Zero, ref src, ref dst, (uint)Win32.WaveFormatEx.SizeOfWaveFormatEx, Win32.ACM_FORMATSUGGESTF_WFORMATTAG);

            if (mmret != 0)
            {
                throw new Exception("Error on acmFormatSuggest. (ret=" + mmret + ") no mp3 codec found...?");
            }

            mmret = Win32.acmStreamOpen(out deviceHandle, IntPtr.Zero, ref src, ref dst, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0);
            if (mmret != 0)
            {
                throw new Exception("Error on acmStreamOpen. (ret=" + mmret + ")");
            }
        }