Name="VCCLCompilerTool"\r
Optimization="0"\r
AdditionalIncludeDirectories="src"\r
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"\r
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"\r
MinimalRebuild="true"\r
BasicRuntimeChecks="3"\r
RuntimeLibrary="3"\r
Name="VCCLCompilerTool"\r
Optimization="0"\r
AdditionalIncludeDirectories="src"\r
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"\r
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"\r
MinimalRebuild="true"\r
BasicRuntimeChecks="3"\r
RuntimeLibrary="3"\r
<Tool\r
Name="VCCLCompilerTool"\r
AdditionalIncludeDirectories="src"\r
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"\r
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"\r
RuntimeLibrary="2"\r
UsePrecompiledHeader="0"\r
WarningLevel="4"\r
<Tool\r
Name="VCCLCompilerTool"\r
AdditionalIncludeDirectories="src"\r
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"\r
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"\r
RuntimeLibrary="2"\r
UsePrecompiledHeader="0"\r
WarningLevel="4"\r
Name="VCCLCompilerTool"\r
Optimization="0"\r
AdditionalIncludeDirectories="src"\r
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"\r
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"\r
MinimalRebuild="true"\r
BasicRuntimeChecks="3"\r
RuntimeLibrary="3"\r
<Tool\r
Name="VCCLCompilerTool"\r
AdditionalIncludeDirectories="src"\r
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"\r
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;TELETONE_EXPORTS"\r
RuntimeLibrary="2"\r
UsePrecompiledHeader="0"\r
WarningLevel="4"\r
#define teletone_assert(expr) assert(expr)
#endif
+#ifdef _MSC_VER
+#if defined(TT_DECLARE_STATIC)
+#define TELETONE_API(type) type __stdcall
+#define TELETONE_API_NONSTD(type) type __cdecl
+#define TELETONE_API_DATA
+#elif defined(TELETONE_EXPORTS)
+#define TELETONE_API(type) __declspec(dllexport) type __stdcall
+#define TELETONE_API_NONSTD(type) __declspec(dllexport) type __cdecl
+#define TELETONE_API_DATA __declspec(dllexport)
+#else
+#define TELETONE_API(type) __declspec(dllimport) type __stdcall
+#define TELETONE_API_NONSTD(type) __declspec(dllimport) type __cdecl
+#define TELETONE_API_DATA __declspec(dllimport)
+#endif
+#else
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY)
-#define TELETONE_API __attribute__((visibility("default")))
+#define TELETONE_API(type) __attribute__((visibility("default"))) type
+#define TELETONE_API_NONSTD(type) __attribute__((visibility("default"))) type
+#define TELETONE_API_DATA __attribute__((visibility("default")))
#else
-#define TELETONE_API
+#define TELETONE_API(type) type
+#define TELETONE_API_NONSTD(type) type
+#define TELETONE_API_DATA
+#endif
#endif
#include <libteletone_generate.h>
goertzel_state->fac = tdesc->fac;
}
-TELETONE_API void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
+TELETONE_API(void) teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
int16_t sample_buffer[],
int samples)
{
#define teletone_goertzel_result(gs) (double)(((gs)->v3 * (gs)->v3 + (gs)->v2 * (gs)->v2 - (gs)->v2 * (gs)->v3 * (gs)->fac))
-TELETONE_API void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate)
+TELETONE_API(void) teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate)
{
int i;
float theta;
dtmf_detect_state->mhit = 0;
}
-TELETONE_API void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map)
+TELETONE_API(void) teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map)
{
float theta = 0;
int x = 0;
}
-TELETONE_API int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
+TELETONE_API(int) teletone_multi_tone_detect (teletone_multi_tone_t *mt,
int16_t sample_buffer[],
int samples)
{
}
-TELETONE_API int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API(int) teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
int16_t sample_buffer[],
int samples)
{
}
-TELETONE_API int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API(int) teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
char *buf,
int max)
{
\param mt the multi-frequency tone descriptor
\param map a representation of the multi-frequency tone
*/
-TELETONE_API void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map);
+TELETONE_API(void) teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map);
/*!
\brief Check a sample buffer for the presence of the mulit-frequency tone described by mt
\param samples the number of samples present in sample_buffer
\return true when the tone was detected or false when it is not
*/
-TELETONE_API int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
+TELETONE_API(int) teletone_multi_tone_detect (teletone_multi_tone_t *mt,
int16_t sample_buffer[],
int samples);
\param dtmf_detect_state the DTMF detection state to initilize
\param sample_rate the desired sample rate
*/
-TELETONE_API void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate);
+TELETONE_API(void) teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate);
/*!
\brief Check a sample buffer for the presence of DTMF digits
\param samples the number of samples present in sample_buffer
\return true when DTMF was detected or false when it is not
*/
-TELETONE_API int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API(int) teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
int16_t sample_buffer[],
int samples);
/*!
\param max the maximum length of buf
\return the number of characters written to buf
*/
-TELETONE_API int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API(int) teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
char *buf,
int max);
\param sample_buffer an array aof 16 bit signed linear samples
\param samples the number of samples present in sample_buffer
*/
-TELETONE_API void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
+TELETONE_API(void) teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
int16_t sample_buffer[],
int samples);
#pragma warning(disable:4706)
#endif
-TELETONE_API int16_t TELETONE_SINES[SINE_TABLE_MAX] = {
+TELETONE_API_DATA int16_t TELETONE_SINES[SINE_TABLE_MAX] = {
0x00c9, 0x025b, 0x03ed, 0x057f, 0x0711, 0x08a2, 0x0a33, 0x0bc4,
0x0d54, 0x0ee4, 0x1073, 0x1201, 0x138f, 0x151c, 0x16a8, 0x1833,
0x19be, 0x1b47, 0x1cd0, 0x1e57, 0x1fdd, 0x2162, 0x22e5, 0x2467,
};
-TELETONE_API int teletone_set_tone(teletone_generation_session_t *ts, int index, ...)
+TELETONE_API(int) teletone_set_tone(teletone_generation_session_t *ts, int index, ...)
{
va_list ap;
int i = 0;
}
-TELETONE_API int teletone_set_map(teletone_tone_map_t *map, ...)
+TELETONE_API(int) teletone_set_map(teletone_tone_map_t *map, ...)
{
va_list ap;
int i = 0;
}
-TELETONE_API int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data)
+TELETONE_API(int) teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data)
{
memset(ts, 0, sizeof(*ts));
ts->rate = 8000;
return 0;
}
-TELETONE_API int teletone_destroy_session(teletone_generation_session_t *ts)
+TELETONE_API(int) teletone_destroy_session(teletone_generation_session_t *ts)
{
if (ts->buffer) {
free(ts->buffer);
return 0;
}
-TELETONE_API int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map)
+TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map)
{
/*teletone_process_t period = (1.0 / ts->rate) / ts->channels;*/
int i, c;
return (char *) memcpy (new, s, len);
}
-TELETONE_API int teletone_run(teletone_generation_session_t *ts, const char *cmd)
+TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cmd)
{
char *data = NULL, *cur = NULL, *end = NULL;
int var = 0, LOOPING = 0;
/* 3.02 represents twice the power */
#define DBM0_MAX_POWER (3.14f + 3.02f)
-TELETONE_API extern int16_t TELETONE_SINES[SINE_TABLE_MAX];
+TELETONE_API_DATA extern int16_t TELETONE_SINES[SINE_TABLE_MAX];
static __inline__ int32_t teletone_dds_phase_rate(teletone_process_t tone, uint32_t rate)
{
\param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0
\return 0
*/
-TELETONE_API int teletone_set_tone(teletone_generation_session_t *ts, int index, ...);
+TELETONE_API(int) teletone_set_tone(teletone_generation_session_t *ts, int index, ...);
/*!
\brief Assign a set of tones to a single tone map
\param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0
\return 0
*/
-TELETONE_API int teletone_set_map(teletone_tone_map_t *map, ...);
+TELETONE_API(int) teletone_set_map(teletone_tone_map_t *map, ...);
/*!
\brief Initilize a tone generation session
\param user_data optional user data to send
\return 0
*/
-TELETONE_API int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data);
+TELETONE_API(int) teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data);
/*!
\brief Free the buffer allocated by a tone generation session
\param ts the tone generation session to destroy
\return 0
*/
-TELETONE_API int teletone_destroy_session(teletone_generation_session_t *ts);
+TELETONE_API(int) teletone_destroy_session(teletone_generation_session_t *ts);
/*!
\brief Execute a single tone generation instruction
\param map the tone mapping to use for the frequencies
\return 0
*/
-TELETONE_API int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map);
+TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map);
/*!
\brief Execute a tone generation script and call callbacks after each instruction
\param cmd the script to execute
\return 0
*/
-TELETONE_API int teletone_run(teletone_generation_session_t *ts, const char *cmd);
+TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cmd);
#ifdef __cplusplus
}