From 2e5966297dd48c8e5f8e0d6d0175be86720d3e30 Mon Sep 17 00:00:00 2001 From: Charlotte HECQUET Date: Thu, 1 Aug 2013 12:30:01 +0200 Subject: [PATCH] * Bug #12779 fixed - savewave() had a miscoding in the internal function write_wavedat(). Change-Id: Ia0d5624de8b21792438cb768de6db18808b97874 --- scilab/CHANGES_5.5.X | 2 ++ scilab/modules/sound/macros/savewave.sci | 2 +- .../sound/tests/nonreg_tests/bug_12779.dia.ref | 23 +++++++++++++++++++ .../modules/sound/tests/nonreg_tests/bug_12779.tst | 24 ++++++++++++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 scilab/modules/sound/tests/nonreg_tests/bug_12779.dia.ref create mode 100644 scilab/modules/sound/tests/nonreg_tests/bug_12779.tst diff --git a/scilab/CHANGES_5.5.X b/scilab/CHANGES_5.5.X index 9f0388e..f865693 100644 --- a/scilab/CHANGES_5.5.X +++ b/scilab/CHANGES_5.5.X @@ -512,3 +512,5 @@ Bug fixes * Bug #12774 fixed - Various typos fixed. * Bug #12775 fixed - Some related functions were not listed in "See also" section of routh_t help page. + +* Bug #12779 fixed - savewave() had a miscoding in the internal function write_wavedat(). diff --git a/scilab/modules/sound/macros/savewave.sci b/scilab/modules/sound/macros/savewave.sci index 7f3cd70..ec072f9 100644 --- a/scilab/modules/sound/macros/savewave.sci +++ b/scilab/modules/sound/macros/savewave.sci @@ -178,7 +178,7 @@ function savewave(filename,x,rate,nbits) // Determine if a pad-byte is appended to data chunk: %v2_1$1 = total_samples * BytesPerSample; if ( %v2_1$1 - fix(%v2_1$1./2).*2 ) then - mput(0,fid,"uc"); + mput(0,"uc",fid); end else // Unknown wave-format for data. diff --git a/scilab/modules/sound/tests/nonreg_tests/bug_12779.dia.ref b/scilab/modules/sound/tests/nonreg_tests/bug_12779.dia.ref new file mode 100644 index 0000000..804e92a --- /dev/null +++ b/scilab/modules/sound/tests/nonreg_tests/bug_12779.dia.ref @@ -0,0 +1,23 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 12779 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=12779 +// +// <-- Short Description --> +// Function "savewave" has a miscoding in the internal function "write_wavedat" +// +t=soundsec(0.5); +s=sin(2*%pi*440*t)+sin(2*%pi*220*t)/2+sin(2*%pi*880*t)/2; +t(11026)=0.500001; +nc=size(t,2); +nc=nc+1; +assert_checktrue(execstr("savewave(TMPDIR+''/bug_12779.wav'',s, 22050, 2);", "errcatch")==0); diff --git a/scilab/modules/sound/tests/nonreg_tests/bug_12779.tst b/scilab/modules/sound/tests/nonreg_tests/bug_12779.tst new file mode 100644 index 0000000..d61f238 --- /dev/null +++ b/scilab/modules/sound/tests/nonreg_tests/bug_12779.tst @@ -0,0 +1,24 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- Non-regression test for bug 12779 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=12779 +// +// <-- Short Description --> +// Function "savewave" has a miscoding in the internal function "write_wavedat" +// +t=soundsec(0.5); +s=sin(2*%pi*440*t)+sin(2*%pi*220*t)/2+sin(2*%pi*880*t)/2; +t(11026)=0.500001; +nc=size(t,2); +nc=nc+1; + +assert_checktrue(execstr("savewave(TMPDIR+''/bug_12779.wav'',s, 22050, 2);", "errcatch")==0); -- 1.7.9.5