/***************************************************************************
 *   							                   *
 *                          iWear Voice Recording                          *
 *                                    by                                   *
 *                    Andreas Hoelke and Dennis Rohlfing                   *
 *                                                                         *
 ***************************************************************************/

#ifndef IW_AUDIOIN_H
#define IW_AUDIOIN_H

#include <stdio.h>
#include <string.h>

#include <SDL/SDL.h>
#include <SDL/SDL_thread.h>
#include <SDL/SDL_audio.h>
#include <SDL/SDL_timer.h>
#include <SDL/SDL_audioin.h>

#include "mic_input.h"

extern "C"
{
#include "SDL_rwring.h"

#include "encode.h"
#include "decode.h"
}


//#include "encode.c"
//#include "mic_input.cpp"


namespace iwear{
    namespace voicetransmission{



#define AUDIO_SAMPLERATE		32000 //32000 // 11025 // 8000 // 22050
#define AUDIO_SAMPLES			8192 //16384 //8192 // 4096//32768 //1024
#define AUDIO_FORMAT			AUDIO_S16
#define BLOCKSIZE                       (AUDIO_SAMPLES/2)

static bool debug = true; 

static char *sArg[5]; 
static char *decArg[5];

static bool newEncoding = true;

int initVoicetransAudioSubsystem();
void callback_record(void *userdata, Uint8 *stream, int len);
void callback_play(void *userdata, Uint8 *stream, int len);

static SDL_AudioSpec spec, result;
static SDL_AudioSpec expect;  


} // namespace voicetransmission
} // namespace iwear


#endif

