[aimc] r290 committed - Delete CARFAC::Run to tighten up the interface.

1 view
Skip to first unread message

ai...@googlecode.com

unread,
May 29, 2013, 4:33:29 PM5/29/13
to aimc...@googlegroups.com
Revision: 290
Author: ro...@google.com
Date: Wed May 29 13:33:06 2013
Log: Delete CARFAC::Run to tighten up the interface.

http://code.google.com/p/aimc/source/detail?r=290

Modified:
/trunk/carfac/carfac.cc
/trunk/carfac/carfac.h
/trunk/carfac/carfac_common.h
/trunk/carfac/carfac_test.cc

=======================================
--- /trunk/carfac/carfac.cc Wed May 29 08:37:28 2013
+++ /trunk/carfac/carfac.cc Wed May 29 13:33:06 2013
@@ -58,30 +58,6 @@
agc_coeffs);
}
}
-
-void CARFAC::Run(const vector<vector<float>>& sound_data,
- CARFACOutput* output) {
- int n_audio_channels = sound_data.size();
- int32_t seg_len = 441; // We use a fixed segment length for now.
- int32_t n_timepoints = sound_data[0].size();
- int32_t n_segs = ceil((n_timepoints * 1.0) / seg_len);
- // These values store the start and endpoints for each segment
- int32_t start;
- int32_t length = seg_len;
- // This section loops over the individual audio segments.
- for (int32_t i = 0; i < n_segs; ++i) {
- // For each segment we calculate the start point and the segment
length.
- start = i * seg_len;
- if (i == n_segs - 1) {
- // The last segment can be shorter than the rest.
- length = n_timepoints - start;
- }
- // Once we've determined the start point and segment length, we run the
- // CARFAC model on the current segment.
- RunSegment(sound_data, start,
- length, false, output);
- }
-}

void CARFAC::RunSegment(const vector<vector<float>>& sound_data,
const int32_t start, const int32_t length,
=======================================
--- /trunk/carfac/carfac.h Wed May 29 08:37:28 2013
+++ /trunk/carfac/carfac.h Wed May 29 13:33:06 2013
@@ -60,10 +60,6 @@
// model.
void Design(const int n_ears, const FPType fs, const CARParams&
car_params,
const IHCParams& ihc_params, const AGCParams& agc_params);
- // The 'Run' method processes an entire file with the current model,
using
- // subsequent calls to the 'RunSegment' method
- void Run(const std::vector<std::vector<float>>& sound_data,
- CARFACOutput* seg_output);
// The 'RunSegment' method processes individual sound segments
void RunSegment(const std::vector<std::vector<float>>& sound_data,
const int32_t start, const int32_t length,
@@ -78,6 +74,7 @@
std::vector<AGCCoeffs>* agc_coeffs);
void CrossCouple();
void CloseAGCLoop();
+
int n_ears_; // This is the number of ears.
FPType fs_; // This is our current sample rate.
int n_ch_; // This is the number of channels in the CARFAC model.
=======================================
--- /trunk/carfac/carfac_common.h Wed May 29 08:37:28 2013
+++ /trunk/carfac/carfac_common.h Wed May 29 13:33:06 2013
@@ -42,7 +42,7 @@
// point data is consistent.
//
// The functions 'ERBHz' and 'CARFACDetect' are defined here, and are used
-// during the design stage of a CARFAC model.
+// during the design stage of a CARFAC model.

#ifndef CARFAC_CARFAC_COMMON_H
#define CARFAC_CARFAC_COMMON_H
@@ -75,6 +75,6 @@
// Function CARFACDetect
// This returns the IHC detection nonilnearity function of the filter
output
// values. This is here because it is called both in design and run
phases.
-FloatArray CARFACDetect (const FloatArray& x);
+FloatArray CARFACDetect(const FloatArray& x);

#endif // CARFAC_CARFAC_COMMON_H
=======================================
--- /trunk/carfac/carfac_test.cc Wed May 29 08:37:28 2013
+++ /trunk/carfac/carfac_test.cc Wed May 29 13:33:06 2013
@@ -146,7 +146,9 @@
agc_params);
CARFACOutput my_output;
my_output.Init(n_ears, true, false, true, false, false);
- mycf.Run(sound_data, &my_output);
+ const bool kOpenLoop = false;
+ const int length = sound_data[0].size();
+ mycf.RunSegment(sound_data, 0, length, kOpenLoop, &my_output);
filename = "cpp_nap_output_1_binaural_test.txt";
WriteNAPOutput(my_output, filename, 0);
filename = "cpp_nap_output_2_binaural_test.txt";
@@ -199,7 +201,9 @@
agc_params);
CARFACOutput my_output;
my_output.Init(n_ears, true, false, true, false, false);
- mycf.Run(sound_data, &my_output);
+ const bool kOpenLoop = false;
+ const int length = sound_data[0].size();
+ mycf.RunSegment(sound_data, 0, length, kOpenLoop, &my_output);
filename = "cpp_nap_output_1_long_test.txt";
WriteNAPOutput(my_output, filename, 0);
filename = "cpp_nap_output_2_long_test.txt";
Reply all
Reply to author
Forward
0 new messages