Skip to content

Commit

Permalink
Fixed some comment typos, and corrected backend_drivers function to s…
Browse files Browse the repository at this point in the history
…how various unpopular extension namings
  • Loading branch information
Hrick87 committed Dec 16, 2023
1 parent 287f25a commit 0dac2af
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ void SndfileBackend::discover_drivers(core::Array<DriverInfo, MaxDrivers>& 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,
Expand All @@ -43,6 +46,27 @@ void SndfileBackend::discover_drivers(core::Array<DriverInfo, MaxDrivers>& 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace roc {
namespace sndio {

//! SoX backend.
//! Sndfile backend.
class SndfileBackend : public IBackend, core::NonCopyable<> {
public:
SndfileBackend();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/tests/roc_sndio/target_sndfile/test_sndfile_sink.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/tests/roc_sndio/target_sndfile/test_sndfile_source.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/tests/roc_sndio/test_pump.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 0dac2af

Please sign in to comment.