hi, i found the following patches in #60041 and #126257. with this, recorded files can be played using bplay, but the file header is still somehow badly crafted:
$ play new.wav playing new.wav sox: Premature EOF on .wav input file i also noted a few other things that could be grabbed from current bplay: - handling of very long files (see last patch in #126257) - updated Die function to make sure the forked process is killed. And at the end of the recording, when showing the 'Recording information', brec_gramo eats all the cpu available until OK is pressed. ciao, piem
--- gramofile-1.6.orig/bplaysrc/bplay.c +++ gramofile-1.6/bplaysrc/bplay.c @@ -307,6 +307,25 @@ memcpy(&(header.data_chunk), data, 4); header.data_length = bcount; + +#if __BYTE_ORDER == __BIG_ENDIAN +#include<byteswap.h> + /* let's do a bit of reordering */ + header.length = bswap_32 (header.length); + header.sc_len = bswap_32 (header.sc_len); + header.format = bswap_16 (header.format); + header.modus = bswap_16 (header.modus); + + header.sample_fq = bswap_32 (header.sample_fq); + header.byte_p_sec = bswap_32 (header.byte_p_sec); + + header.byte_p_spl = bswap_16 (header.byte_p_spl); + header.bit_p_spl = bswap_16 (header.bit_p_spl); + + header.data_chunk = bswap_32 (header.data_chunk); + header.data_length = bswap_32 (header.data_length); +#endif + write(thefd, &header, sizeof(header)); } case F_RAW: @@ -476,6 +495,25 @@ memcpy((void*)&wavhd, (void*)hd_buf, 20); count = read(thefd, ((char*)&wavhd)+20, sizeof(wavhd) - 20); + +#if __BYTE_ORDER == __BIG_ENDIAN +#include<byteswap.h> + /* let's do a bit of reordering */ + wavhd.length = bswap_32 (wavhd.length); + wavhd.sc_len = bswap_32 (wavhd.sc_len); + wavhd.format = bswap_16 (wavhd.format); + wavhd.modus = bswap_16 (wavhd.modus); + + wavhd.sample_fq = bswap_32 (wavhd.sample_fq); + wavhd.byte_p_sec = bswap_32 (wavhd.byte_p_sec); + + wavhd.byte_p_spl = bswap_16 (wavhd.byte_p_spl); + wavhd.bit_p_spl = bswap_16 (wavhd.bit_p_spl); + + wavhd.data_chunk = bswap_32 (wavhd.data_chunk); + wavhd.data_length = bswap_32 (wavhd.data_length); +#endif + if(wavhd.format != 1) Die("Input is not a PCM WAV file"); #ifndef LP2CD if (! (mods&MSPEED))