Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VS2015 IDE support #12

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,10 @@ libtool
speexdsp.pc
stamp-*
patches
m4
win32/VS20*/Win32
Win32/VS20*/tests/Debug
win32/VS20*/libspeexdsp/Debug
win32/VS20*/*.open*
*.bak
win32/testfile
Binary file modified doc/manual.pdf
Binary file not shown.
23 changes: 14 additions & 9 deletions libspeexdsp/mdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ EXPORT SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_lengt
st->beta_max = DIV32_16(SHL32(EXTEND32(st->frame_size), 14), st->sampling_rate);
#else
st->beta0 = (2.0f*st->frame_size)/st->sampling_rate;
st->beta_max = (.5f*st->frame_size)/st->sampling_rate;
st->beta_max = (0.5f*st->frame_size)/st->sampling_rate;
#endif
st->leak_estimate = 0;

Expand Down Expand Up @@ -470,12 +470,15 @@ EXPORT SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_lengt
}
#else
for (i=0;i<N;i++)
st->window[i] = .5-.5*cos(2*M_PI*i/N);
st->window[i] = 0.5-0.5*cos(2*M_PI*i/N);
#endif

for (i=0;i<=st->frame_size;i++)
st->power_1[i] = FLOAT_ONE;

for (i=0;i<N*M*K*C;i++)
st->W[i] = 0;

{
spx_word32_t sum = 0;
/* Ratio of ~10 between adaptation rate of first and last block */
Expand All @@ -496,13 +499,14 @@ EXPORT SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_lengt
st->memX = (spx_word16_t*)speex_alloc(K*sizeof(spx_word16_t));
st->memD = (spx_word16_t*)speex_alloc(C*sizeof(spx_word16_t));
st->memE = (spx_word16_t*)speex_alloc(C*sizeof(spx_word16_t));
st->preemph = QCONST16(.9,15);
st->preemph = QCONST16(0.9,15);

if (st->sampling_rate<12000)
st->notch_radius = QCONST16(.9, 15);
st->notch_radius = QCONST16(0.9, 15);
else if (st->sampling_rate<24000)
st->notch_radius = QCONST16(.982, 15);
st->notch_radius = QCONST16(0.982, 15);
else
st->notch_radius = QCONST16(.992, 15);
st->notch_radius = QCONST16(0.992, 15);

st->notch_mem = (spx_mem_t*)speex_alloc(2*C*sizeof(spx_mem_t));
st->adapted = 0;
Expand Down Expand Up @@ -1029,6 +1033,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
/* Everything's fine */
st->screwed_up=0;
}

if (st->screwed_up>=50)
{
speex_warning("The echo canceller started acting funny and got slapped (reset). It swears it will behave now.");
Expand Down Expand Up @@ -1239,11 +1244,11 @@ EXPORT int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr)
st->beta_max = (.5f*st->frame_size)/st->sampling_rate;
#endif
if (st->sampling_rate<12000)
st->notch_radius = QCONST16(.9, 15);
st->notch_radius = QCONST16(0.9, 15);
else if (st->sampling_rate<24000)
st->notch_radius = QCONST16(.982, 15);
st->notch_radius = QCONST16(0.982, 15);
else
st->notch_radius = QCONST16(.992, 15);
st->notch_radius = QCONST16(0.992, 15);
break;
case SPEEX_ECHO_GET_SAMPLING_RATE:
(*(int*)ptr) = st->sampling_rate;
Expand Down
12 changes: 9 additions & 3 deletions libspeexdsp/testdenoise.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
#include "speex/speex_preprocess.h"
#include <stdio.h>

#define NN 160
#define NN 160*6

int main()
int main(int argc, char *argv[])
{
short in[NN];
int i;
SpeexPreprocessState *st;
int count=0;
float f;

st = speex_preprocess_state_init(NN, 8000);
freopen(argv[1], "rb", stdin);
freopen(argv[2], "wb", stdout);

st = speex_preprocess_state_init(NN, 8000*6);
i=1;
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DENOISE, &i);
i=0;
Expand All @@ -28,17 +31,20 @@ int main()
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &f);
f=.0;
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &f);

while (1)
{
int vad;
fread(in, sizeof(short), NN, stdin);
if (feof(stdin))
break;

vad = speex_preprocess_run(st, in);
/*fprintf (stderr, "%d\n", vad);*/
fwrite(in, sizeof(short), NN, stdout);
count++;
}

speex_preprocess_state_destroy(st);
return 0;
}
25 changes: 14 additions & 11 deletions libspeexdsp/testecho.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,46 @@
#include <fcntl.h>


#define NN 128
#define TAIL 1024
#define NN (128*6)
#define TAIL (1024*4)

int main(int argc, char **argv)
{
FILE *echo_fd, *ref_fd, *e_fd;
short echo_buf[NN], ref_buf[NN], e_buf[NN];
SpeexEchoState *st;
SpeexPreprocessState *den;
int sampleRate = 8000;
const int sampleRate = 8000*6;

if (argc != 4)
{
fprintf(stderr, "testecho mic_signal.sw speaker_signal.sw output.sw\n");
exit(1);
}
echo_fd = fopen(argv[2], "rb");
ref_fd = fopen(argv[1], "rb");
e_fd = fopen(argv[3], "wb");

st = speex_echo_state_init(NN, TAIL);
den = speex_preprocess_state_init(NN, sampleRate);
FILE *echo_fd = fopen(argv[2], "rb");//FAR-end file(to speaker)
FILE *ref_fd = fopen(argv[1], "rb");//mic capture file
FILE *e_fd = fopen(argv[3], "wb");//output file

SpeexEchoState *st = speex_echo_state_init(NN, TAIL);
SpeexPreprocessState *den = speex_preprocess_state_init(NN, sampleRate);

speex_echo_ctl(st, SPEEX_ECHO_SET_SAMPLING_RATE, &sampleRate);
speex_preprocess_ctl(den, SPEEX_PREPROCESS_SET_ECHO_STATE, st);

while (!feof(ref_fd) && !feof(echo_fd))
{
fread(ref_buf, sizeof(short), NN, ref_fd);
fread(echo_buf, sizeof(short), NN, echo_fd);

speex_echo_cancellation(st, ref_buf, echo_buf, e_buf);
speex_preprocess_run(den, e_buf);

fwrite(e_buf, sizeof(short), NN, e_fd);
}

speex_echo_state_destroy(st);
speex_preprocess_state_destroy(den);
fclose(e_fd);
fclose(echo_fd);
fclose(ref_fd);

return 0;
}
22 changes: 14 additions & 8 deletions libspeexdsp/testresample.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,38 +44,44 @@
int main()
{
spx_uint32_t i;
short *in;
short *out;
float *fin, *fout;
int count = 0;

SpeexResamplerState *st = speex_resampler_init(1, 8000, 12000, 10, NULL);
speex_resampler_set_rate(st, 96000, 44100);
speex_resampler_skip_zeros(st);

in = malloc(NN*sizeof(short));
out = malloc(2*NN*sizeof(short));
fin = malloc(NN*sizeof(float));
fout = malloc(2*NN*sizeof(float));
float *in = malloc(NN*sizeof(short));
float *out = malloc(2*NN*sizeof(short));
float *fin = malloc(NN*sizeof(float));
float *fout = malloc(2*NN*sizeof(float));
int count = 0;

while (1)
{
spx_uint32_t in_len;
spx_uint32_t out_len;
fread(in, sizeof(short), NN, stdin);
if (feof(stdin))
break;

for (i=0;i<NN;i++)
fin[i]=in[i];

in_len = NN;
out_len = 2*NN;

/*if (count==2)
speex_resampler_set_quality(st, 10);*/

speex_resampler_process_float(st, 0, fin, &in_len, fout, &out_len);

for (i=0;i<out_len;i++)
out[i]=floor(.5+fout[i]);

/*speex_warning_int("writing", out_len);*/
fwrite(out, sizeof(short), out_len, stdout);
count++;
}

speex_resampler_destroy(st);
free(in);
free(out);
Expand Down
Binary file added win32/VS2015/.vs/libspeexdsp/v14/.suo
Binary file not shown.
8 changes: 8 additions & 0 deletions win32/VS2015/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Process this file with automake to produce Makefile.in. -*-Makefile-*-

# Disable automatic dependency tracking if using other tools than gcc and gmake
#AUTOMAKE_OPTIONS = no-dependencies

SUBDIRS = libspeexdsp tests

EXTRA_DIST = libspeexdsp.sln
Binary file added win32/VS2015/UpgradeLog.htm
Binary file not shown.
Binary file added win32/VS2015/libspeexdsp.VC.db
Binary file not shown.
Loading