From 0dac2af10d0d147a8defaf00d8795badaadd693a Mon Sep 17 00:00:00 2001 From: Hunter Rick Date: Fri, 15 Dec 2023 21:13:33 -0800 Subject: [PATCH] Fixed some comment typos, and corrected backend_drivers function to show various unpopular extension namings --- .../roc_sndio/sndfile_backend.cpp | 24 +++++++++++++++++++ .../roc_sndio/sndfile_backend.h | 2 +- .../target_sndfile/roc_sndio/sndfile_sink.cpp | 4 ++-- .../target_sndfile/roc_sndio/sndfile_source.h | 2 +- .../target_sndfile/test_sndfile_sink.cpp | 2 +- .../target_sndfile/test_sndfile_source.cpp | 2 +- src/tests/roc_sndio/test_pump.cpp | 2 +- 7 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.cpp b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.cpp index 1aae2fbef3..b319e0ea8d 100644 --- a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.cpp +++ b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.cpp @@ -34,6 +34,9 @@ void SndfileBackend::discover_drivers(core::Array& drive SF_FORMAT_INFO format_info; + int wav_count = 0; + int mat_count = 0; + for (int n = 0; n < total_number_of_drivers; n++) { format_info.format = n; if (int errnum = sf_command(NULL, SFC_GET_FORMAT_MAJOR, &format_info, @@ -43,6 +46,27 @@ void SndfileBackend::discover_drivers(core::Array& drive const char* driver = format_info.extension; + if(strcmp(driver, "wav") == 0){ + if(wav_count == 1){ + driver = "nist"; + } + else if(wav_count == 2){ + driver = "wavex"; + } + wav_count++; + } + + if(strcmp(driver, "mat") == 0){ + + if(mat_count == 0){ + driver = "mat4"; + } + else if(mat_count == 1){ + driver = "mat5"; + } + mat_count++; + } + if (!driver_list.push_back(DriverInfo(driver, DriverType_File, DriverFlag_IsDefault | DriverFlag_SupportsSource diff --git a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.h b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.h index 61e9520d76..e2a2ea270f 100644 --- a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.h +++ b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_backend.h @@ -21,7 +21,7 @@ namespace roc { namespace sndio { -//! SoX backend. +//! Sndfile backend. class SndfileBackend : public IBackend, core::NonCopyable<> { public: SndfileBackend(); diff --git a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_sink.cpp b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_sink.cpp index af01ea4c2f..918097f2c8 100644 --- a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_sink.cpp +++ b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_sink.cpp @@ -21,11 +21,11 @@ struct FileMap { } file_type_map[] = { { "aiff", SF_FORMAT_AIFF }, { "au", SF_FORMAT_AU }, { "avr", SF_FORMAT_AVR }, { "caf", SF_FORMAT_CAF }, { "htk", SF_FORMAT_HTK }, { "iff", SF_FORMAT_SVX }, - { "mat", SF_FORMAT_MAT4 }, { "mat", SF_FORMAT_MAT5 }, { "mpc", SF_FORMAT_MPC2K }, + { "mat", SF_FORMAT_MAT4 }, {"mat4", SF_FORMAT_MAT4}, { "mat5", SF_FORMAT_MAT5 }, { "mpc", SF_FORMAT_MPC2K }, { "paf", SF_FORMAT_PAF }, { "pvf", SF_FORMAT_PVF }, { "raw", SF_FORMAT_RAW }, { "rf64", SF_FORMAT_RF64 }, { "sd2", SF_FORMAT_SD2 }, { "sds", SF_FORMAT_SDS }, { "sf", SF_FORMAT_IRCAM }, { "voc", SF_FORMAT_VOC }, { "w64", SF_FORMAT_W64 }, - { "wav", SF_FORMAT_WAV }, { "wav", SF_FORMAT_NIST }, { "wav", SF_FORMAT_WAVEX }, + { "wav", SF_FORMAT_WAV }, { "nist", SF_FORMAT_NIST }, { "wavex", SF_FORMAT_WAVEX }, { "wve", SF_FORMAT_WVE }, { "xi", SF_FORMAT_XI }, }; diff --git a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_source.h b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_source.h index ae2e3c6ee0..20988a80cf 100644 --- a/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_source.h +++ b/src/internal_modules/roc_sndio/target_sndfile/roc_sndio/sndfile_source.h @@ -27,7 +27,7 @@ namespace roc { namespace sndio { -//! SoX source. +//! Sndfile source. //! @remarks //! Reads samples from input file or device. //! Supports multiple drivers for different file types and audio systems. diff --git a/src/tests/roc_sndio/target_sndfile/test_sndfile_sink.cpp b/src/tests/roc_sndio/target_sndfile/test_sndfile_sink.cpp index 7db8ec6493..e4808fadf7 100644 --- a/src/tests/roc_sndio/target_sndfile/test_sndfile_sink.cpp +++ b/src/tests/roc_sndio/target_sndfile/test_sndfile_sink.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Roc Streaming authors + * Copyright (c) 2023 Roc Streaming authors * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/src/tests/roc_sndio/target_sndfile/test_sndfile_source.cpp b/src/tests/roc_sndio/target_sndfile/test_sndfile_source.cpp index 5313523832..1be0698457 100644 --- a/src/tests/roc_sndio/target_sndfile/test_sndfile_source.cpp +++ b/src/tests/roc_sndio/target_sndfile/test_sndfile_source.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Roc Streaming authors + * Copyright (c) 2023 Roc Streaming authors * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/src/tests/roc_sndio/test_pump.cpp b/src/tests/roc_sndio/test_pump.cpp index ecea25080b..02cc0a3ad7 100644 --- a/src/tests/roc_sndio/test_pump.cpp +++ b/src/tests/roc_sndio/test_pump.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Roc Streaming authors + * Copyright (c) 2023 Roc Streaming authors * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this