Results 1 to 4 of 4

Thread: set_volume

  1. #1

    Default set_volume

    set_volume doesn't seem to be working for me. Even if I do set_volume(0.0f) then play the sample it still makes the same volume of sound.

    I'm using ClanLib 2.2.0 under Gentoo Linux.

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Yes something has gone wrong

    The sound example has a silly bug
    Code:
    Index: Examples/Sound/Sound/Sources/gui.cpp
    ===================================================================
    --- Examples/Sound/Sound/Sources/gui.cpp	(revision 4863)
    +++ Examples/Sound/Sound/Sources/gui.cpp	(working copy)
    @@ -238,7 +238,7 @@
     
     	spin_slider_map_float[spin] = slider;
     
    -	spin->set_floating_point_mode(false);
    +	spin->set_floating_point_mode(true);
     	spin->set_ranges_float(min, max);
     	spin->set_value_float(start);
     	spin->set_step_size_float(1.0f);
    But that does not work.

    There appears to be a bug in Sources/Sound sound_sse2.cpp

    If you define "CL_DISABLE_SSE2" the volume works.

    /me calls the SSE2 expert

  3. #3
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    A bug was introduced in SVN #4631

    This patch fixes it

    Code:
    Index: sound_sse.cpp
    ===================================================================
    --- sound_sse.cpp	(revision 4863)
    +++ sound_sse.cpp	(working copy)
    @@ -360,7 +360,7 @@
     		{
     			__m128 sample1 = _mm_loadu_ps(output[j]+i);
     			__m128 volume0 = _mm_set1_ps(volume[j]);
    -			_mm_storeu_ps(output[j]+i, _mm_add_ps(_mm_mul_ps(sample1, volume0), sample0));
    +			_mm_storeu_ps(output[j]+i, _mm_add_ps(_mm_mul_ps(sample0, volume0), sample1));
     		}
     	}
     
    @@ -389,7 +389,7 @@
     		{
     			__m128 sample1 = _mm_loadu_ps(input[j]+i);
     			__m128 volume0 = _mm_set1_ps(volume[j]);
    -			sample0 = _mm_add_ps(_mm_mul_ps(sample1, volume0), sample0);
    +			sample0 = _mm_add_ps(_mm_mul_ps(sample0, volume0), sample1);
     		}
     		_mm_storeu_ps(output+i, sample0);
     	}
    I don't know why it was changed.

    /me needs the SSE2 expert to confirm

  4. #4
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    It was a bug in the first one (second one is okay)

    I'll patch it for the clanlib 2.2.2 release

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •