Unverified Commit 0c046675 authored by Fangjun Kuang's avatar Fangjun Kuang Committed by GitHub
Browse files

Remove multiple definitions of `SoxEffect`. (#635)

Fix #628
parent 3a4f3569
......@@ -88,7 +88,7 @@ else:
'_torch_sox',
['torchaudio/torch_sox.cpp'],
libraries=libraries,
include_dirs=include_dirs,
include_dirs=include_dirs + [cwd],
extra_compile_args=eca,
extra_objects=extra_objects,
extra_link_args=ela),
......
#include <torchaudio/torch_sox.h>
#include <torch/extension.h>
#include <sox.h>
......@@ -70,12 +72,6 @@ void read_audio(
}
} // namespace
struct SoxEffect {
SoxEffect() : ename(""), eopts({""}) { }
std::string ename;
std::vector<std::string> eopts;
};
std::tuple<sox_signalinfo_t, sox_encodinginfo_t> get_info(
const std::string& file_name
) {
......@@ -195,7 +191,7 @@ void write_audio_file(
}
int initialize_sox() {
/* Initializion for sox effects. Only initialize once */
/* Initialization for sox effects. Only initialize once */
return sox_init();
}
......
#include <sox.h>
#include <string>
#include <tuple>
#include <vector>
#include <torch/extension.h>
namespace at {
struct Tensor;
......@@ -9,7 +15,7 @@ namespace torch { namespace audio {
/// Reads an audio file from the given `path` into the `output` `Tensor` and
/// returns the sample rate of the audio file.
/// Throws `std::runtime_error` if the audio file could not be opened, or an
/// error ocurred during reading of the audio data.
/// error occurred during reading of the audio data.
int read_audio_file(
const std::string& file_name,
at::Tensor output,
......@@ -18,24 +24,24 @@ int read_audio_file(
int64_t offset,
sox_signalinfo_t* si,
sox_encodinginfo_t* ei,
const char* ft)
const char* ft);
/// Writes the data of a `Tensor` into an audio file at the given `path`, with
/// a certain extension (e.g. `wav`or `mp3`) and sample rate.
/// Throws `std::runtime_error` when the audio file could not be opened for
/// writing, or an error ocurred during writing of the audio data.
/// writing, or an error occurred during writing of the audio data.
void write_audio_file(
const std::string& file_name,
at::Tensor& tensor,
const at::Tensor& tensor,
sox_signalinfo_t* si,
sox_encodinginfo_t* ei,
const char* file_type)
const char* file_type);
/// Reads an audio file from the given `path` and returns a tuple of
/// sox_signalinfo_t and sox_encodinginfo_t, which contain information about
/// the audio file such as sample rate, length, bit precision, encoding and more.
/// Throws `std::runtime_error` if the audio file could not be opened, or an
/// error ocurred during reading of the audio data.
/// error occurred during reading of the audio data.
std::tuple<sox_signalinfo_t, sox_encodinginfo_t> get_info(
const std::string& file_name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment