Skip to content

Commit d26e112

Browse files
Mistobaanvincentqb
authored andcommitted
add asound for linux. fix deprecated torch type. (#254)
* fix deprecated torch type. * don't link alsa on linux.
1 parent 17b5411 commit d26e112

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packaging/build_from_source.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pushd sox-14.4.2
5151
./configure --disable-shared --enable-static --prefix="$PREFIX/third_party/sox" \
5252
LDFLAGS="-L$PREFIX/third_party/lame/lib -L$PREFIX/third_party/flac/lib -L$PREFIX/third_party/mad/lib" \
5353
CPPFLAGS="-I$PREFIX/third_party/lame/include -I$PREFIX/third_party/flac/include -I$PREFIX/third_party/mad/include" \
54-
--with-lame --with-flac --with-mad --without-coreaudio --without-png --without-oggvorbis --without-oss --without-sndfile CFLAGS=-fPIC CXXFLAGS=-fPIC --with-pic --disable-debug --disable-dependency-tracking
54+
--with-lame --with-flac --with-mad --without-alsa --without-coreaudio --without-png --without-oggvorbis --without-oss --without-sndfile CFLAGS=-fPIC CXXFLAGS=-fPIC --with-pic --disable-debug --disable-dependency-tracking
5555
make -s -j && make install
5656
popd
5757

torchaudio/torch_sox.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct SoxDescriptor {
3636
int64_t write_audio(SoxDescriptor& fd, at::Tensor tensor) {
3737
std::vector<sox_sample_t> buffer(tensor.numel());
3838

39-
AT_DISPATCH_ALL_TYPES(tensor.type(), "write_audio_buffer", [&] {
39+
AT_DISPATCH_ALL_TYPES(tensor.scalar_type(), "write_audio_buffer", [&] {
4040
auto* data = tensor.data_ptr<scalar_t>();
4141
std::copy(data, data + tensor.numel(), buffer.begin());
4242
});
@@ -63,7 +63,7 @@ void read_audio(
6363
output.resize_({samples_read / number_of_channels, number_of_channels});
6464
output = output.contiguous();
6565

66-
AT_DISPATCH_ALL_TYPES(output.type(), "read_audio_buffer", [&] {
66+
AT_DISPATCH_ALL_TYPES(output.scalar_type(), "read_audio_buffer", [&] {
6767
auto* data = output.data_ptr<scalar_t>();
6868
std::copy(buffer.begin(), buffer.begin() + samples_read, data);
6969
});
@@ -369,7 +369,7 @@ int build_flow_effects(const std::string& file_name,
369369
std::vector<sox_sample_t> samples(buffer_size);
370370
const int64_t samples_read = sox_read(input, samples.data(), buffer_size);
371371
assert(samples_read != nc * ns && samples_read != 0);
372-
AT_DISPATCH_ALL_TYPES(otensor.type(), "effects_buffer", [&] {
372+
AT_DISPATCH_ALL_TYPES(otensor.scalar_type(), "effects_buffer", [&] {
373373
auto* data = otensor.data_ptr<scalar_t>();
374374
std::copy(samples.begin(), samples.begin() + samples_read, data);
375375
});

0 commit comments

Comments
 (0)