Skip to content

Commit 789adf0

Browse files
mthrokfacebook-github-bot
authored andcommitted
Refactor sox pybind source code (#2636)
Summary: Pull Request resolved: #2636 At the early stage of torchaudio extension module, `torchaudio/csrc/pybind` directory was created so that all the code defining Python interface would be placed there and there will be only one extension module called `torchaudio._torchaudio`. However, the codebase has been evolved in a way separate extensions are defined for each feature (third party dependency) for the sake of more moduler file organization. What is left in `csrc/pybind` is libsox Python bindings. This commit moves it under `csrc/sox`. Follow-up rename `torchaudio._torchaudio` to `torchaudio._torchaudio_sox`. Reviewed By: carolineechen Differential Revision: D38829253 fbshipit-source-id: 3554af45a2beb0f902810c5548751264e093f28d
1 parent 0b7f2fb commit 789adf0

File tree

10 files changed

+18
-17
lines changed

10 files changed

+18
-17
lines changed

torchaudio/csrc/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,13 @@ if(USE_FFMPEG)
163163
endif()
164164

165165
################################################################################
166+
# TODO: Rename this to _torchaudio_sox.so
166167
# _torchaudio.so
167168
################################################################################
168169
if (BUILD_TORCHAUDIO_PYTHON_EXTENSION)
169170
set(
170171
EXTENSION_SOURCES
171-
pybind/pybind.cpp
172+
sox/pybind/pybind.cpp
172173
)
173174
#----------------------------------------------------------------------------#
174175
# START OF CUSTOMIZATION LOGICS
@@ -177,10 +178,10 @@ if (BUILD_TORCHAUDIO_PYTHON_EXTENSION)
177178
list(
178179
APPEND
179180
EXTENSION_SOURCES
180-
pybind/sox/effects.cpp
181-
pybind/sox/effects_chain.cpp
182-
pybind/sox/io.cpp
183-
pybind/sox/utils.cpp
181+
sox/pybind/effects.cpp
182+
sox/pybind/effects_chain.cpp
183+
sox/pybind/io.cpp
184+
sox/pybind/utils.cpp
184185
)
185186
endif()
186187
#----------------------------------------------------------------------------#

torchaudio/csrc/pybind/sox/effects.cpp renamed to torchaudio/csrc/sox/pybind/effects.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#include <torchaudio/csrc/pybind/sox/effects.h>
2-
#include <torchaudio/csrc/pybind/sox/effects_chain.h>
3-
#include <torchaudio/csrc/pybind/sox/utils.h>
1+
#include <torchaudio/csrc/sox/pybind/effects.h>
2+
#include <torchaudio/csrc/sox/pybind/effects_chain.h>
3+
#include <torchaudio/csrc/sox/pybind/utils.h>
44

55
using namespace torchaudio::sox_utils;
66

File renamed without changes.

torchaudio/csrc/pybind/sox/effects_chain.cpp renamed to torchaudio/csrc/sox/pybind/effects_chain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <sox.h>
2-
#include <torchaudio/csrc/pybind/sox/effects_chain.h>
3-
#include <torchaudio/csrc/pybind/sox/utils.h>
2+
#include <torchaudio/csrc/sox/pybind/effects_chain.h>
3+
#include <torchaudio/csrc/sox/pybind/utils.h>
44

55
using namespace torchaudio::sox_utils;
66

torchaudio/csrc/pybind/sox/io.cpp renamed to torchaudio/csrc/sox/pybind/io.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#include <torchaudio/csrc/pybind/sox/effects.h>
2-
#include <torchaudio/csrc/pybind/sox/effects_chain.h>
3-
#include <torchaudio/csrc/pybind/sox/io.h>
4-
#include <torchaudio/csrc/pybind/sox/utils.h>
51
#include <torchaudio/csrc/sox/io.h>
2+
#include <torchaudio/csrc/sox/pybind/effects.h>
3+
#include <torchaudio/csrc/sox/pybind/effects_chain.h>
4+
#include <torchaudio/csrc/sox/pybind/io.h>
5+
#include <torchaudio/csrc/sox/pybind/utils.h>
66
#include <torchaudio/csrc/sox/types.h>
77

88
#include <utility>
File renamed without changes.

torchaudio/csrc/pybind/pybind.cpp renamed to torchaudio/csrc/sox/pybind/pybind.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include <torch/extension.h>
22

33
#ifdef INCLUDE_SOX
4-
#include <torchaudio/csrc/pybind/sox/effects.h>
5-
#include <torchaudio/csrc/pybind/sox/io.h>
4+
#include <torchaudio/csrc/sox/pybind/effects.h>
5+
#include <torchaudio/csrc/sox/pybind/io.h>
66
#endif
77

88
PYBIND11_MODULE(_torchaudio, m) {

torchaudio/csrc/pybind/sox/utils.cpp renamed to torchaudio/csrc/sox/pybind/utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <torchaudio/csrc/pybind/sox/utils.h>
1+
#include <torchaudio/csrc/sox/pybind/utils.h>
22

33
namespace torchaudio::sox_utils {
44

File renamed without changes.

0 commit comments

Comments
 (0)