mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 09:59:54 +00:00
Fix two INST related AIFF bugs.
This commit is contained in:
parent
9421844ce4
commit
f4ee595dea
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2006-03-18 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/aiff.c
|
||||
Fix bug in writting of INST chunk in AIFF files.
|
||||
|
||||
* src/sndfile.c
|
||||
Make sure the instrument chunk can only be written at the start of the file.
|
||||
|
||||
* tests/command_test.c
|
||||
Add check of log buffer.
|
||||
|
||||
2006-03-17 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/Makefile.am tests/Makefile.am
|
||||
|
@ -1147,6 +1147,7 @@ aiff_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
unsigned short ct = 0 ;
|
||||
|
||||
memset (m, 0, sizeof (m)) ;
|
||||
memset (&ch, 0, sizeof (ch)) ;
|
||||
|
||||
ch.baseNote = psf->instrument->basenote ;
|
||||
ch.detune = psf->instrument->detune ;
|
||||
@ -1178,10 +1179,11 @@ aiff_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
ch.release_loop.beginLoop = 0 ;
|
||||
ch.release_loop.endLoop = 0 ;
|
||||
} ;
|
||||
psf_binheader_writef (psf, "Em4b", INST_MARKER, sizeof (INST_CHUNK), &ch.baseNote, make_size_t (6)) ;
|
||||
psf_binheader_writef (psf, "Em4111111", INST_MARKER, sizeof (INST_CHUNK), ch.baseNote, ch.detune,
|
||||
ch.lowNote, ch.highNote, ch.lowVelocity, ch.highVelocity) ;
|
||||
psf_binheader_writef (psf, "2222222", ch.gain, ch.sustain_loop.playMode,
|
||||
ch.sustain_loop.beginLoop, ch.sustain_loop.endLoop, ch.release_loop.playMode,
|
||||
ch.release_loop.beginLoop, ch.release_loop.endLoop) ;
|
||||
ch.sustain_loop.beginLoop, ch.sustain_loop.endLoop, ch.release_loop.playMode,
|
||||
ch.release_loop.beginLoop, ch.release_loop.endLoop) ;
|
||||
|
||||
if (ct == 2)
|
||||
psf_binheader_writef (psf, "Em42241b241b",
|
||||
|
@ -1061,6 +1061,9 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
return SF_TRUE ;
|
||||
|
||||
case SFC_SET_INSTRUMENT :
|
||||
/* If data has already been written this must fail. */
|
||||
if (psf->have_written)
|
||||
return SF_FALSE ;
|
||||
if (datasize != sizeof (SF_INSTRUMENT) || data == NULL)
|
||||
return SF_FALSE ;
|
||||
if (psf->instrument == NULL && (psf->instrument = psf_instrument_alloc ()) == NULL)
|
||||
|
@ -622,11 +622,11 @@ instrument_test (const char *filename, int filetype)
|
||||
sfinfo.channels = 1 ;
|
||||
|
||||
file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
|
||||
if (sf_command (file, SFC_SET_INSTRUMENT, &write_inst, sizeof (write_inst)) == SF_FALSE)
|
||||
{ printf ("\n\nLine %d : sf_command (SFC_SET_INSTRUMENT) failed.\n\n", __LINE__) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
|
||||
sf_close (file) ;
|
||||
|
||||
memset (&read_inst, 0, sizeof (read_inst)) ;
|
||||
@ -637,6 +637,7 @@ instrument_test (const char *filename, int filetype)
|
||||
exit (1) ;
|
||||
return ;
|
||||
} ;
|
||||
check_log_buffer_or_die (file, __LINE__) ;
|
||||
sf_close (file) ;
|
||||
|
||||
if ((filetype & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV)
|
||||
|
Loading…
Reference in New Issue
Block a user