- if ((sndfile = sf_open (path.c_str(), SFM_READ, &info)) == 0) {
- char errbuf[256];
- sf_error_str (0, errbuf, sizeof (errbuf) - 1);
- warning << string_compose (_("cannot open click emphasis soundfile %1 (%2)"), path, errbuf) << endmsg;
- return;
- }
-
- click_emphasis_data = new Sample[info.frames];
- click_emphasis_length = info.frames;
-
- if (sf_read_float (sndfile, click_emphasis_data, info.frames) != info.frames) {
- warning << _("cannot read data from click emphasis soundfile") << endmsg;
- delete click_emphasis_data;
- click_emphasis_data = 0;
+
+ *data = new Sample[info.frames];
+ *length = info.frames;
+
+ /* mix down to mono */
+
+ for (int i = 0; i < info.frames; ++i) {
+ (*data)[i] = 0;
+ for (int j = 0; j < info.channels; ++j) {
+ (*data)[i] = tmp[i * info.channels + j];
+ }
+ (*data)[i] /= info.channels;