/*
 * HA_interface.h
 *
 */

#ifndef HA_INTERFACE_H_
#define HA_INTERFACE_H_

#include "HA_config.h"

#ifdef ENABLE_JNI_FOR_ANDROID
#include <jni.h>
#endif // ENABLE_JNI_FOR_ANDROID

#ifdef __cplusplus
extern "C" {
#endif

#ifdef ENABLE_JNI_FOR_ANDROID
//extern jvoid Java_jp_hark_embeddedhark_EmbeddedHARKMainActivity_callbackJNI(JNIEnv* env, jobject thiz);

extern jint HACreate(JNIEnv *env, jobject thiz);
extern jint HAStart(JNIEnv *env, jobject thiz);
extern jint HAStop(JNIEnv *env, jobject thiz);
extern jint HASetParam(JNIEnv *env, jobject thiz);
extern jint HAGetParam(JNIEnv *env, jobject thiz);

extern jint HASetJuliusMFTServer(JNIEnv *env, jobject thiz, jstring serveraddr);

// 2013.07.09 K.Takagi
//extern jint HASetRaspZXServer(JNIEnv *env, jobject thiz, jboolean connect, jstring serveraddr);
extern jint HASetSocketMicServer(JNIEnv *env, jobject thiz, jboolean connect, jstring serveraddr);

//extern jint HASetRaspLCDevice(JNIEnv *env, jobject thiz, jint channels, jint bits);
//extern jint HASetRaspLCInterface(JNIEnv *env, jobject thiz, jint if_no, jint ep_addr, jint max_packet_size);
//extern jint HASetRaspLCFd(JNIEnv *env, jobject thiz, jint fd);
extern jint HASetUSBMicDeviceType(JNIEnv *env, jobject thiz, jint device_type);
extern jint HASetUSBMicDevice(JNIEnv *env, jobject thiz, jint channels, jint bits);
extern jint HASetUSBMicInterface(JNIEnv *env, jobject thiz, jint if_no, jint ep_addr, jint max_packet_size);
extern jint HASetUSBMicFd(JNIEnv *env, jobject thiz, jint fd);

extern jint HASetParamSendPort(JNIEnv *env, jobject thiz, jint send_port);

extern jint HASetAudioParam(JNIEnv *env, jobject thiz, jint input_channels, jint advance);

// K.Takagi
extern jint HASetLocalizeMusicParamNumSource(JNIEnv *env, jobject thiz, jint num_source);
extern jint HASetLocalizeMusicParamPeriod(JNIEnv *env, jobject thiz, jint period);
extern jint HASetLocalizeMusicParamFrequency(JNIEnv *env, jobject thiz, jint low_bound_freq, jint upper_bound_freq);
extern jint HASetLocalizeMusicParamDeg(JNIEnv *env, jobject thiz, jint min_deg, jint max_deg);
extern jint HASetLocalizeMusicParamFilePath(JNIEnv *env, jobject thiz, jstring file_name);

extern jint HASetSourceTrackerParamThresh(JNIEnv *env, jobject thiz, jfloat thresh);
extern jint HASetSourceTrackerParamPauseLength(JNIEnv *env, jobject thiz, jfloat pause_length);
extern jint HASetSourceTrackerParamMinSrcInterval(JNIEnv *env, jobject thiz, jfloat min_src_interval);

extern jint HASetSourceIntervalExtenderParam(JNIEnv *env, jobject thiz, jint preroll_length);

extern jint HASetGhdssParamFilePath(JNIEnv *env, jobject thiz, jstring file_name);

extern jint HASetEstimateLeakParamFactor(JNIEnv *env, jobject thiz, jfloat factor);

extern jint HASetHrleParamLx(JNIEnv *env, jobject thiz, jfloat lx);
extern jint HASetHrleParamTr(JNIEnv *env, jobject thiz, jfloat tr);
extern jint HASetHrleParamMinLv(JNIEnv *env, jobject thiz, jfloat min_lv);
extern jint HASetHrleParamStepLv(JNIEnv *env, jobject thiz, jfloat step_lv);
extern jint HASetHrleParamNumBin(JNIEnv *env, jobject thiz, jint num_bin);

extern jint HASetNoneSeparationParamTargetChannel(JNIEnv *env, jobject thiz, jint target_channel);

extern jint HASetWhiteNoiseAdderParamLevel(JNIEnv *env, jobject thiz, jfloat wn_level);

extern jint HASetPreEmphasisParamCutoff(JNIEnv *env, jobject thiz, jint cut_off);
extern jint HASetPreEmphasisParamCoef(JNIEnv *env, jobject thiz, jfloat coef);

extern jint HASetMelFilterParamCutoff(JNIEnv *env, jobject thiz, jint cut_off);
extern jint HASetMelFilterParamFreq(JNIEnv *env, jobject thiz, jint min_freq, jint max_freq);

extern jint HASetHarkPath(JNIEnv *env, jobject thiz, jstring path);

// takigahira
extern jint HASetParamOutputTypeMicRaw(JNIEnv *env, jobject thiz, jint type);
extern jint HASetParamOutputTypeMicSpec(JNIEnv *env, jobject thiz, jint type);
extern jint HASetParamOutputTypeLocalizePowSpec(JNIEnv *env, jobject thiz, jint type);
extern jint HASetParamOutputTypeSepRaw(JNIEnv *env, jobject thiz, jint type);
extern jint HASetParamOutputTypeSepSpec(JNIEnv *env, jobject thiz, jint type);
extern jint HASetParamOutputTypeSepFeature(JNIEnv *env, jobject thiz, jint type, jint sub_type);
extern jint HASetParamOutputTypeSource(JNIEnv *env, jobject thiz, jint type);
extern jint HASetParamOutputFilePathMicRaw(JNIEnv *env, jobject thiz, jstring file_name);
extern jint HASetParamOutputFilePathMicSpec(JNIEnv *env, jobject thiz, jstring file_name);
extern jint HASetParamOutputFilePathLocalizePowSpec(JNIEnv *env, jobject thiz, jstring file_name);
extern jint HASetParamOutputFilePathSepRaw(JNIEnv *env, jobject thiz, jstring file_name);
extern jint HASetParamOutputFilePathSepSpec(JNIEnv *env, jobject thiz, jstring file_name);
extern jint HASetParamOutputFilePathSepFeature(JNIEnv *env, jobject thiz, jstring file_name);
extern jint HASetParamOutputFilePathSource(JNIEnv *env, jobject thiz, jstring file_name);
extern jint HASetParamLocalizeAlgorithm(JNIEnv *env, jobject thiz, jint algorithm);
extern jint HASetParamSeparationAlgorithm(JNIEnv *env, jobject thiz, jint algorithm);
extern jint HASetParamFilterAlgorithm(JNIEnv *env, jobject thiz, jint algorithm);
extern jint HASetParamSIDAlgorithm(JNIEnv *env, jobject thiz, jint algorithm);

extern jint HASetExtendedSourceTrackerParamThresh(JNIEnv *env, jobject thiz, jfloat thresh);
extern jint HASetExtendedSourceTrackerParamPauseLength(JNIEnv *env, jobject thiz, jint pause_length);
extern jint HASetExtendedSourceTrackerParamRemoveLength(JNIEnv *env, jobject thiz, jint remove_length);
extern jint HASetExtendedSourceTrackerParamRemoveCheckLength(JNIEnv *env, jobject thiz, jint remove_check_length);
extern jint HASetExtendedSourceTrackerParamCompareMode(JNIEnv *env, jobject thiz, jint compare_mode);
extern jint HASetExtendedSourceTrackerParamMinSrcInterval(JNIEnv *env, jobject thiz, jfloat min_src_interval);
extern jint HASetExtendedSourceTrackerParamMinTFIndexInterval(JNIEnv *env, jobject thiz, jint min_tfindex_interval);
extern jint HASetExtendedSourceTrackerParamMaxNumSource(JNIEnv *env, jobject thiz, jint max_num_source);
extern jint HASetExtendedSourceTrackerParamPrerollLength(JNIEnv *env, jobject thiz, jint preroll_length);
extern jint HASetExtendedSourceTrackerParamRemovedSourceAlgorithm(JNIEnv *env, jobject thiz, jint removed_source_algorithm);
extern jint HASetExtendedSourceTrackerParamMinID(JNIEnv *env, jobject thiz, jint min_id);
extern jint HASetNormalizeMusicParamInitialThreshold(JNIEnv *env, jobject thiz, jfloat initial_threshold);
extern jint HASetNormalizeMusicParamActiveProp(JNIEnv *env, jobject thiz, jfloat active_prop);
extern jint HASetNormalizeMusicParamUpdateInterval(JNIEnv *env, jobject thiz, jint update_interval);
extern jint HASetNormalizeMusicParamPriorWeight(JNIEnv *env, jobject thiz, jfloat prior_weight);
extern jint HASetNormalizeMusicParamMaxSourceNum(JNIEnv *env, jobject thiz, jint max_source_num);
extern jint HASetNormalizeMusicParamParticleNum(JNIEnv *env, jobject thiz, jint particle_num);
extern jint HASetNormalizeMusicParamLocalPeakMargin(JNIEnv *env, jobject thiz, jfloat local_peak_margin);
extern jint HASetBeamformingParamBFMethod(JNIEnv *env, jobject thiz, jint bf_method);
extern jint HASetBeamformingParamTFConjFilePath(JNIEnv *env, jobject thiz, jstring file_name);
extern jint HASetBeamformingParamLCMethod(JNIEnv *env, jobject thiz, jint lc_method);
extern jint HASetBeamformingParamLCMyu(JNIEnv *env, jobject thiz, jfloat lc_myu);
extern jint HASetBeamformingParamSSMethod(JNIEnv *env, jobject thiz, jint ss_method);
extern jint HASetBeamformingParamSSMyu(JNIEnv *env, jobject thiz, jfloat ss_myu);
extern jint HASetBeamformingParamSSScale(JNIEnv *env, jobject thiz, jfloat ss_scale);
extern jint HASetBeamformingParamNlFunc(JNIEnv *env, jobject thiz, jint nl_func);
extern jint HASetBeamformingParamDecompositionAlgorithm(JNIEnv *env, jobject thiz, jint decomposition_algorithm);
extern jint HASetBeamformingParamAlpha(JNIEnv *env, jobject thiz, jfloat alpha);
extern jint HASetBeamformingParamRegFactor(JNIEnv *env, jobject thiz, jfloat reg_factor);







#else
extern int HACreate();
extern int HAStart();
extern int HAStop();
extern int HASetParam();
extern int HAGetParam();

extern int HASetJuliusMFTServer(const char * const serveraddr);
//extern int HASetRaspZXServer(const bool connect, const char * const serveraddr);
extern int HASetSocketMicServer(const bool connect, const char * const serveraddr);
extern int HASetParamSendPort(int send_port);
extern int HASetAudioParam(int input_channels, int advance);
extern int HASetGhdssParamFilePath(const char * const file_name);
#endif // ENABLE_JNI_FOR_ANDROID

#ifdef IS_APPLE_IOS
extern int HASetUserParamLM(const struct Param_LocalizeMUSIC_t * const);
extern int HASetUserParamSourceTracker(const struct Param_SourceTracker_t * const);
extern int HASetUserParamSourceIntervalExtender(const struct Param_SourceIntervalExtender_t * const);
extern int HASetUserParamEstimateLeak(const struct Param_EstimateLeak_t * const);
extern int HASetUserParamHrle(const struct Param_HRLE_t * const);
extern int HASetUserParamWhiteNoiseAdder(const struct Param_WhiteNoiseAdder_t * const);
extern int HASetUserParamPreEmphasis(const struct Param_PreEmphasis_t * const);
extern int HASetUserParamMelFilterBank(const struct Param_MelFilterBank_t * const);
#endif

#ifdef __cplusplus
}
#endif


#endif /* HA_INTERFACE_H_ */
