- write frames to files
git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@438 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -53,6 +53,8 @@ namespace gr {
|
|||||||
memset(m_pPeakCount, 0, vlen*sizeof(int));
|
memset(m_pPeakCount, 0, vlen*sizeof(int));
|
||||||
memset(m_pXs, 0, vlen*sizeof(float));
|
memset(m_pXs, 0, vlen*sizeof(float));
|
||||||
memset(m_pXm, 0, vlen*sizeof(float));
|
memset(m_pXm, 0, vlen*sizeof(float));
|
||||||
|
|
||||||
|
m_pFile_frames = fopen("/home/jens/frames2.dat", "w");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -60,6 +62,8 @@ namespace gr {
|
|||||||
*/
|
*/
|
||||||
peak_detect_impl::~peak_detect_impl()
|
peak_detect_impl::~peak_detect_impl()
|
||||||
{
|
{
|
||||||
|
fclose(m_pFile_frames);
|
||||||
|
|
||||||
delete [] m_pXm;
|
delete [] m_pXm;
|
||||||
delete [] m_pXs;
|
delete [] m_pXs;
|
||||||
delete [] m_pPeakCount;
|
delete [] m_pPeakCount;
|
||||||
@@ -71,7 +75,6 @@ namespace gr {
|
|||||||
gr_vector_void_star &output_items)
|
gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
int k=0;
|
int k=0;
|
||||||
fprintf(stderr, "Peak at");
|
|
||||||
for(int i = 0; i < (noutput_items * m_vlen); i++)
|
for(int i = 0; i < (noutput_items * m_vlen); i++)
|
||||||
{
|
{
|
||||||
float x = ((float*)input_items[k])[i];
|
float x = ((float*)input_items[k])[i];
|
||||||
@@ -84,12 +87,10 @@ namespace gr {
|
|||||||
|
|
||||||
((float*)output_items[k])[i] = m_pXm[i];
|
((float*)output_items[k])[i] = m_pXm[i];
|
||||||
|
|
||||||
if (peak > 0.5)
|
fprintf(m_pFile_frames, "%0.3f ", x);
|
||||||
{
|
|
||||||
fprintf(stderr, " %d", i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(m_pFile_frames, "\n");
|
||||||
|
|
||||||
// Tell runtime system how many output items we produced.
|
// Tell runtime system how many output items we produced.
|
||||||
return noutput_items;
|
return noutput_items;
|
||||||
|
|||||||
@@ -24,30 +24,29 @@
|
|||||||
#include <jay/peak_detect.h>
|
#include <jay/peak_detect.h>
|
||||||
|
|
||||||
namespace gr {
|
namespace gr {
|
||||||
namespace jay {
|
namespace jay {
|
||||||
|
|
||||||
class peak_detect_impl : public peak_detect
|
class peak_detect_impl : public peak_detect
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// Nothing to declare in this block.
|
// Nothing to declare in this block.
|
||||||
float m_alpha_s;
|
float m_alpha_s;
|
||||||
float m_alpha_m;
|
float m_alpha_m;
|
||||||
int m_vlen;
|
int m_vlen;
|
||||||
int *m_pPeakCount;
|
int *m_pPeakCount;
|
||||||
float *m_pXs;
|
float *m_pXs;
|
||||||
float *m_pXm;
|
float *m_pXm;
|
||||||
|
FILE *m_pFile_frames;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
peak_detect_impl(float alpha_s, float alpha_m, int vlen);
|
peak_detect_impl(float alpha_s, float alpha_m, int vlen);
|
||||||
~peak_detect_impl();
|
~peak_detect_impl();
|
||||||
|
|
||||||
// Where all the action really happens
|
// Where all the action really happens
|
||||||
int work(int noutput_items,
|
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||||
gr_vector_const_void_star &input_items,
|
|
||||||
gr_vector_void_star &output_items);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace jay
|
} // namespace jay
|
||||||
} // namespace gr
|
} // namespace gr
|
||||||
|
|
||||||
#endif /* INCLUDED_JAY_PEAK_DETECT_IMPL_H */
|
#endif /* INCLUDED_JAY_PEAK_DETECT_IMPL_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user