/**
@file mic_input.h
@brief offers the functionality for recording audio data from a microphone 
*/
#ifndef MIC_INPUT_H
#define MIC_INPUT_H
#endif

#ifndef _WIN32 //the following is a recording class for Linux systems only
               //a Windows recording will be possible when SDL support is made
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/soundcard.h>
#include <stdio.h>
//#include <iostream.h>
#include <stdlib.h>
#include <SDL/SDL_rwops.h>
#include "../include/wav_def.h"

#define HEADER_SIZE 44
#define BUF_SIZE 4096-HEADER_SIZE


namespace iwear{
    namespace voicetransmission{

static int audio_fd;
static FILE* fdp;

static int fd;       /* sound device file descriptor */
static int arg;      /* argument for ioctl calls */
static int status;   /* return status of system calls */




void playAudio();
void recordAudio(int input_fs_hz, char *dateiname, bool debug);

/** recording audio data from the microphone and saving the data to a file */
void convertRingToWav(SDL_RWops* audio_ring, int input_fs, char *dateiname, bool debug, int sampleNr);

int initRecording();
int recPlay(char *dateiname, bool debug);
void setSAMPLINGRATE(int sr);

    }
}

#endif //!_WIN32
