Exemplo n.º 1
0
 public static extern int FLAC__stream_decoder_init_stream(IntPtr context,
                                                           DecoderReadCallback readCallback,
                                                           DecoderSeekCallback seekCallback,
                                                           DecoderTellCallback tellCallback,
                                                           DecoderLengthCallback lengthCallback,
                                                           DecoderEofCallback eofCallback,
                                                           DecoderWriteCallbackWithStatus writeCallback,
                                                           Decoder_MetadataCallback metadataCallback,
                                                           Decoder_ErrorCallback errorCallback,
                                                           IntPtr clientData);
Exemplo n.º 2
0
        /// <summary>
        /// Constructs a new decoder from the given stream in one of the supported formats.
        /// </summary>
        /// <param name="stream">A stream to a file or streaming audio source in one of the supported formats.</param>
        public MiniAudioDecoder(Stream stream)
        {
            _stream = stream;

            // We want signed 2 channel 16 bit audio
            var config = ma_decoder_config_init(SampleFormat.S16, (uint)AudioAdapter.Channels, (uint)AudioAdapter.SampleRate);

            // Construct decoder
            _decoder = ma_ext_alloc_decoder();
            var result = ma_decoder_init(_readProc = ReadBytes, _seekProc = SeekBytes, null, &config, _decoder);

            if (result != Result.Success)
            {
                throw new InvalidOperationException($"Unable to initialize decoder. (Error: {result})");
            }

            // The length is represented in pcm frames
            Length = (int)ma_decoder_get_length_in_pcm_frames(_decoder) * 2;
        }
Exemplo n.º 3
0
		public static extern int FLAC__stream_decoder_init_stream (IntPtr context,
			DecoderReadCallback readCallback,
			DecoderSeekCallback seekCallback,
			DecoderTellCallback tellCallback,
			DecoderLengthCallback lengthCallback,
			DecoderEofCallback eofCallback,
			DecoderWriteCallbackWithStatus writeCallback,
			Decoder_MetadataCallback metadataCallback,
			Decoder_ErrorCallback errorCallback,
			IntPtr clientData);
Exemplo n.º 4
0
 public static extern Result ma_decoder_init(DecoderReadCallback onRead, DecoderSeekCallback onSeek, void *pUserData, DecoderConfig *pConfig, void *pDecoder);