Example #1
0
        public void InitDecoder(bool useJitterBuffer, int stepSize, int frameSize)
        {
            this.frameSize = frameSize;
            decodedBits    = new SpeexBits();
            decoderState   = speex_decoder_init_new(0);
            fixed(SpeexBits *bitsDecode = &decodedBits)
            {
                speex_bits_init(bitsDecode);
            }

            if (useJitterBuffer)
            {
                jitterBuffer    = jitter_buffer_init(stepSize);
                validJitterBits = false;
            }
        }
Example #2
0
        public int InitEncoder(int maxFrameSize, int samplesPerFrame, int samplingRate)
        {
            this.maxFrameSize = maxFrameSize;
            encodedBits       = new SpeexBits();
            encoderState      = speex_encoder_init_new(0);
            // Don't set VAD in the codec, because we're setting it in
            // the preprocessor instead
            fixed(int *fSize = &frameSize)
            {
                speex_encoder_ctl(encoderState, (int)SpeexCtlCode.SPEEX_GET_FRAME_SIZE, fSize);
            }

            fixed(SpeexBits *bitsAdd = &encodedBits)
            {
                speex_bits_init(bitsAdd);
            }

            preprocessState = speex_preprocess_state_init(samplesPerFrame, samplingRate);
            return(frameSize);
        }
Example #3
0
 public static extern int speex_bits_remaining(ref SpeexBits bits);
Example #4
0
 public static extern void speex_bits_destroy(ref SpeexBits bits);
Example #5
0
 public static extern uint speex_bits_peek(ref SpeexBits bits);
Example #6
0
 public static extern void speex_bits_insert_terminator(ref SpeexBits bits);
Example #7
0
 public extern static int Speex_bits_unpack_signed(ref SpeexBits bits, int nbBits);
Example #8
0
/** Frees all resources associated to a SpeexBits struct. Right now this does nothing since no resources are allocated, but this could change in the future.*/
void speex_bits_destroy(SpeexBits *bits);
Example #9
0
/** Append bytes to the bit-stream
 * 
 * @param bits Bit-stream to operate on
 * @param bytes pointer to the bytes what will be appended
 * @param len Number of bytes of append
 */
void speex_bits_read_whole_bytes(SpeexBits *bits, char *bytes, int len);
Example #10
0
 public static extern int speex_bits_remaining(ref SpeexBits bits);
Example #11
0
 public static extern void speex_bits_rewind(ref SpeexBits bits);
Example #12
0
 public static extern void speex_bits_read_from(ref SpeexBits bits, byte[] bytes, int len);
Example #13
0
 public static extern void speex_bits_read_whole_bytes(ref SpeexBits bits, IntPtr bytes, int len);
Example #14
0
 public static extern int speex_bits_peek(ref SpeexBits bits);
Example #15
0
 public static extern void speex_bits_pack(ref SpeexBits bits, int data, int nbBits);
Example #16
0
 public static extern int speex_bits_nbytes(ref SpeexBits bits);
Example #17
0
 public static extern void speex_bits_insert_terminator(ref SpeexBits bits);
Example #18
0
 public static extern void speex_bits_set_bit_buffer(ref SpeexBits bits, IntPtr buff, int buf_size);
Example #19
0
   IntPtr reserved2; /**< Reserved for future use */

/** Initializes and allocates resources for a SpeexBits struct */
void speex_bits_init(SpeexBits bits);
Example #20
0
/** Uses an existing decoder state to decode one frame of speech from
 * bit-stream bits. The output speech is saved written to out.
 *
 * @param state Decoder state
 * @param bits Bit-stream from which to decode the frame (NULL if the packet was lost)
 * @param out Where to write the decoded frame
 * @return return status (0 for no error, -1 for end of stream, -2 corrupt stream)
 */
int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out);
Example #21
0
/** Rewind the bit-stream to the beginning (ready for read) without erasing the content */
void speex_bits_rewind(SpeexBits *bits);
Example #22
0
 public extern static IntPtr Speex_bits_init_buffer(ref SpeexBits bits, byte[] ouput, int len);
Example #23
0
 public static extern uint speex_bits_unpack_unsigned(ref SpeexBits bits, int nbBits);
Example #24
0
 public static extern void speex_bits_init(ref SpeexBits bits);
Example #25
0
 public extern static void Speex_bits_reset(ref SpeexBits bits);
Example #26
0
 public static extern int speex_bits_write(ref SpeexBits bits, byte[] bytes, int max_len);
Example #27
0
 public extern static void Speex_bits_set_bit_buffer(ref SpeexBits bits, byte[] buff, int buffSize);
Example #28
0
 public static extern int speex_bits_write_whole_bytes(ref SpeexBits bits, IntPtr bytes, int max_len);
Example #29
0
 public extern static void Speex_bits_read_from(ref SpeexBits bits, byte[] bytes, int len);
Example #30
0
 public static extern int speex_decode(IntPtr state, ref SpeexBits bits, IntPtr outFloat);
Example #31
0
 public static extern uint speex_bits_peek_unsigned(ref SpeexBits bits, int nbBits);
Example #32
0
 public static extern int speex_decode_int(IntPtr state, ref SpeexBits bits, byte[] outShort);
Example #33
0
 public static extern void speex_bits_advance(ref SpeexBits bits, int n);
Example #34
0
 public static extern int speex_encode(IntPtr state, IntPtr inFloat, ref SpeexBits bits);
Example #35
0
 public static extern void speex_bits_init(ref SpeexBits bits);
Example #36
0
 public static extern int speex_encode_int(IntPtr state, IntPtr inShort, ref SpeexBits bits);
Example #37
0
 public static extern void speex_bits_init_buffer(ref SpeexBits bits, byte[] buff, int buf_size);
Example #38
0
 public static extern void speex_encode_stereo(float[] data, int frame_size, ref SpeexBits bits);
Example #39
0
/** Sets the bits in a SpeexBits struct to use data from an existing buffer (for decoding without copying data) */
void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size);
Example #40
0
 public static extern void speex_encode_stereo_int(Int16[] data, int frame_size, ref SpeexBits bits);
Example #41
0
/** Resets bits to initial value (just after initialization, erasing content)*/
void speex_bits_reset(SpeexBits *bits);
Example #42
0
 public static extern int speex_std_stereo_request_handler(ref SpeexBits bits, IntPtr state, IntPtr data);
Example #43
0
/** Initializes the bit-stream from the data in an area of memory */
void speex_bits_read_from(SpeexBits *bits, char *bytes, int len);
Example #44
0
/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits);
Example #45
0
/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits);
Example #46
0
/** Callback handler for intensity stereo info */
int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data);
Example #47
0
/** Uses an existing decoder state to decode one frame of speech from
 * bit-stream bits. The output speech is saved written to out.
 *
 * @param state Decoder state
 * @param bits Bit-stream from which to decode the frame (NULL if the packet was lost)
 * @param out Where to write the decoded frame
 * @return return status (0 for no error, -1 for end of stream, -2 corrupt stream)
 */
int speex_decode(void *state, SpeexBits *bits, float *out);
Example #48
0
 public static extern void speex_bits_destroy(ref SpeexBits bits);
Example #49
0
 public extern static void Speex_bits_init(ref SpeexBits bits);
Example #50
0
 public static extern void speex_bits_rewind(ref SpeexBits bits);
Example #51
0
 public extern static int Speex_bits_write(ref SpeexBits bits, byte[] ouput, int len);
Example #52
0
 public static extern void speex_bits_read_whole_bytes(ref SpeexBits bits, byte[] bytes, int len);
Example #53
0
 public extern static int Speex_bits_peek(ref SpeexBits bits);
Example #54
0
 public static extern int speex_bits_write_whole_bytes(ref SpeexBits bits, byte[] bytes, int max_len);
Example #55
0
 public extern static int Speex_bits_rewind(ref SpeexBits bits);
Example #56
0
 public static extern void speex_bits_pack(ref SpeexBits bits, int data, int nbBits);
Example #57
0
 public extern static void Speex_bits_destroy(ref SpeexBits bits);
Example #58
0
 public static extern int speex_bits_nbytes(ref SpeexBits bits);
Example #59
0
 public extern static int Speex_bits_nbytes(ref SpeexBits bits);
Example #60
0
 public extern static int Speex_decode_int(IntPtr state, ref SpeexBits bits, short[] output);