diff --git a/app/src/main/cpp/sox/CmakeLists.txt b/app/src/main/cpp/sox/CmakeLists.txt index 3458af2..eaaf8d9 100644 --- a/app/src/main/cpp/sox/CmakeLists.txt +++ b/app/src/main/cpp/sox/CmakeLists.txt @@ -109,8 +109,6 @@ set(formats_srcs s2-fmt.c s3-fmt.c s4-fmt.c - sounder.c - soundtool.c sox-fmt.c voc.c vox.c diff --git a/app/src/main/cpp/sox/formats.h b/app/src/main/cpp/sox/formats.h index d322a1b..13ce859 100644 --- a/app/src/main/cpp/sox/formats.h +++ b/app/src/main/cpp/sox/formats.h @@ -46,8 +46,8 @@ // FORMAT(sf) FORMAT(sln) // FORMAT(smp) - FORMAT(sounder) - FORMAT(soundtool) +// FORMAT(sounder) +// FORMAT(soundtool) FORMAT(sox) // FORMAT(sphere) // FORMAT(svx) diff --git a/app/src/main/cpp/sox/sounder.c b/app/src/main/cpp/sox/sounder.c deleted file mode 100644 index 678d99e..0000000 --- a/app/src/main/cpp/sox/sounder.c +++ /dev/null @@ -1,55 +0,0 @@ -/* libSoX Sounder format handler (c) 2008 robs@users.sourceforge.net - * See description in soundr3b.zip on the net. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser - * General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "sox_i.h" - -static int start_read(sox_format_t * ft) -{ - uint16_t type, rate; - - if (lsx_readw(ft, &type) || lsx_readw(ft, &rate) || lsx_skipbytes(ft, (size_t) 4)) - return SOX_EOF; - if (type) { - lsx_fail_errno(ft, SOX_EHDR, "invalid Sounder header"); - return SOX_EOF; - } - return lsx_check_read_params(ft, 1, (sox_rate_t)rate, SOX_ENCODING_UNSIGNED, 8, (uint64_t)0, sox_true); -} - -static int write_header(sox_format_t * ft) -{ - return lsx_writew(ft, 0) /* sample type */ - || lsx_writew(ft, min(65535, (unsigned)(ft->signal.rate + .5))) - || lsx_writew(ft, 10) /* speaker driver volume */ - || lsx_writew(ft, 4)? /* speaker driver DC shift */ - SOX_EOF : SOX_SUCCESS; -} - -LSX_FORMAT_HANDLER(sounder) -{ - static char const * const names[] = {"sndr", NULL}; - static unsigned const write_encodings[] = {SOX_ENCODING_UNSIGNED, 8, 0, 0}; - static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE, - "8-bit linear audio as used by Aaron Wallace's `Sounder' of 1991", - names, SOX_FILE_LIT_END | SOX_FILE_MONO, - start_read, lsx_rawread, NULL, - write_header, lsx_rawwrite, NULL, - lsx_rawseek, write_encodings, NULL, 0 - }; - return &handler; -} diff --git a/app/src/main/cpp/sox/soundtool.c b/app/src/main/cpp/sox/soundtool.c deleted file mode 100644 index 8a83df3..0000000 --- a/app/src/main/cpp/sox/soundtool.c +++ /dev/null @@ -1,78 +0,0 @@ -/* libSoX SoundTool format handler (c) 2008 robs@users.sourceforge.net - * See description in sndtl26.zip on the net. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser - * General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "sox_i.h" -#include - -static char const ID1[6] = "SOUND\x1a"; -#define text_field_len (size_t)96 /* Includes null-terminator */ - -static int start_read(sox_format_t * ft) -{ - char id1[sizeof(ID1)], comments[text_field_len + 1]; - uint32_t nsamples; - uint16_t rate; - - if (lsx_readchars(ft, id1, sizeof(ID1)) || - lsx_skipbytes(ft, (size_t) 10) || lsx_readdw(ft, &nsamples) || - lsx_readw(ft, &rate) || lsx_skipbytes(ft, (size_t) 6) || - lsx_readchars(ft, comments, text_field_len)) - return SOX_EOF; - if (memcmp(ID1, id1, sizeof(id1))) { - lsx_fail_errno(ft, SOX_EHDR, "soundtool: can't find SoundTool identifier"); - return SOX_EOF; - } - comments[text_field_len] = '\0'; /* Be defensive against incorrect files */ - sox_append_comments(&ft->oob.comments, comments); - return lsx_check_read_params(ft, 1, (sox_rate_t)rate, SOX_ENCODING_UNSIGNED, 8, (uint64_t)nsamples, sox_true); -} - -static int write_header(sox_format_t * ft) -{ - char * comment = lsx_cat_comments(ft->oob.comments); - char text_buf[text_field_len]; - uint64_t length = ft->olength? ft->olength:ft->signal.length; - - memset(text_buf, 0, sizeof(text_buf)); - strncpy(text_buf, comment, text_field_len - 1); - free(comment); - return lsx_writechars(ft, ID1, sizeof(ID1)) - || lsx_writew (ft, 0) /* GSound: not used */ - || lsx_writedw (ft, (unsigned) length) /* length of complete sample */ - || lsx_writedw (ft, 0) /* first byte to play from sample */ - || lsx_writedw (ft, (unsigned) length) /* first byte NOT to play from sample */ - || lsx_writew (ft, min(65535, (unsigned)(ft->signal.rate + .5))) - || lsx_writew (ft, 0) /* sample size/type */ - || lsx_writew (ft, 10) /* speaker driver volume */ - || lsx_writew (ft, 4) /* speaker driver DC shift */ - || lsx_writechars(ft, text_buf, sizeof(text_buf))? SOX_EOF:SOX_SUCCESS; -} - -LSX_FORMAT_HANDLER(soundtool) -{ - static char const * const names[] = {"sndt", NULL}; - static unsigned const write_encodings[] = {SOX_ENCODING_UNSIGNED, 8, 0, 0}; - static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE, - "8-bit linear audio as used by Martin Hepperle's `SoundTool' of 1991/2", - names, SOX_FILE_LIT_END | SOX_FILE_MONO | SOX_FILE_REWIND, - start_read, lsx_rawread, NULL, - write_header, lsx_rawwrite, NULL, - lsx_rawseek, write_encodings, NULL, 0 - }; - return &handler; -}