diff U3w META.yml META.yml
--- META.yml Wed Apr 23 18:23:34 2008
+++ META.yml Tue Mar 10 09:32:53 2009
@@ -1,7 +1,7 @@
--- #YAML:1.0
name: Win32-Sound
abstract: An extension to play with Windows sounds
-version: 0.49
+version: 0.50
author:
- Aldo Calpini <dada@perl.it>
- Jan Dubois <jand@activestate.com>
diff U3w README README
--- README Thu Feb 14 02:00:14 2008
+++ README Tue Mar 10 09:33:09 2009
@@ -3,7 +3,7 @@
# Win32::Sound - An extension to play with Windows sounds
#
# Author: Aldo Calpini <dada@divinf.it>
-# Version: 0.45
+# Version: 0.50
# Info:
#
http://www.divinf.it/dada/perl
#
http://www.perl.com/CPAN/authors/Aldo_Calpini
diff U3w Sound.pm Sound.pm
--- Sound.pm Sat Jun 14 01:11:34 2008
+++ Sound.pm Tue Mar 17 09:48:38 2009
@@ -3,7 +3,7 @@
# Win32::Sound - An extension to play with Windows sounds
#
# Author: Aldo Calpini <dada@perl.it>
-# Version: 0.49
+# Version: 0.50
# Info:
#
http://www.divinf.it/dada/perl
#
http://www.perl.com/CPAN/authors/Aldo_Calpini
@@ -29,6 +29,8 @@
# fix package name in META.yml
# move sample.pl into eg/ subdirectory to prevent it
# from being installed
+# 0.50 (10 Mar 2009) Fix to correctly set volumes. RT43776.
+# (Robert May robertmay@cpan.org)
package Win32::Sound;
@@ -83,7 +85,7 @@
#######################################################################
# STATIC OBJECT PROPERTIES
#
-$VERSION="0.49";
+$VERSION="0.50";
undef unless $VERSION; # [dada] to avoid "possible typo" warning
#######################################################################
@@ -95,8 +97,8 @@
sub Volume {
my(@in) = @_;
# Allows '0%'..'100%'
- $in[0] =~ s{ ([\d\.]+)%$ }{ int($1*100/255) }ex if defined $in[0];
- $in[1] =~ s{ ([\d\.]+)%$ }{ int($1*100/255) }ex if defined $in[1];
+ $in[0] =~ s{ ([\d\.]+)%$ }{ int($1*65535/100) }ex if defined $in[0];
+ $in[1] =~ s{ ([\d\.]+)%$ }{ int($1*65535/100) }ex if defined $in[1];
_Volume(@in);
}
@@ -135,8 +137,8 @@
sub Volume {
my(@in) = @_;
# Allows '0%'..'100%'
- $in[0] =~ s{ ([\d\.]+)%$ }{ int($1*255/100) }ex if defined $in[0];
- $in[1] =~ s{ ([\d\.]+)%$ }{ int($1*255/100) }ex if defined $in[1];
+ $in[0] =~ s{ ([\d\.]+)%$ }{ int($1*65535/100) }ex if defined $in[0];
+ $in[1] =~ s{ ([\d\.]+)%$ }{ int($1*65535/100) }ex if defined $in[1];
_Volume(@in);
}
@@ -578,7 +580,7 @@
=head1 VERSION
-Win32::Sound version 0.46, 25 Sep 1999.
+Win32::Sound version 0.50, 10 Mar 2009.
=head1 AUTHOR
diff U3w Sound.xs Sound.xs
--- Sound.xs Thu Feb 28 02:21:06 2008
+++ Sound.xs Tue Mar 10 09:57:16 2009
@@ -4,7 +4,7 @@
# Win32::Sound - An extension to play with Windows sounds
#
# Author: Aldo Calpini <dada@perl.it>
-# Version: 0.45
+# Version: 0.50
# Info:
#
http://www.divinf.it/dada/perl
#
http://www.perl.com/CPAN/authors/Aldo_Calpini
@@ -348,8 +348,8 @@
if(mmr == MMSYSERR_NOERROR) {
if(GIMME == G_ARRAY) {
EXTEND(SP, 2);
- XST_mIV(0, (long) volume & 0x00FF);
- XST_mIV(1, (long) (volume & 0xFF00) >> 8);
+ XST_mIV(0, (long) (volume & 0x0000FFFF) );
+ XST_mIV(1, (long) ((volume & 0xFFFF0000) >> 16));
XSRETURN(2);
} else {
XSRETURN_IV(volume);
@@ -360,7 +360,7 @@
}
break;
case 1:
- volume = SvIV(ST(0)) | SvIV(ST(0)) << 8;
+ volume = ( SvIV(ST(0)) & 0x0000FFFF ) | (( SvIV(ST(0)) & 0x0000FFFF ) << 16 );
mmr = waveOutSetVolume((HWAVEOUT) WAVE_MAPPER, volume);
if(mmr == MMSYSERR_NOERROR) {
XSRETURN_YES;
@@ -370,7 +370,7 @@
}
break;
default:
- volume = SvIV(ST(0)) | SvIV(ST(1)) << 8;
+ volume = ( SvIV(ST(0)) & 0x0000FFFF ) | (( SvIV(ST(1)) & 0x0000FFFF ) << 16);
mmr = waveOutSetVolume((HWAVEOUT) WAVE_MAPPER, volume);
if(mmr == MMSYSERR_NOERROR) {
XSRETURN_YES;
@@ -1268,8 +1268,8 @@
if(mmr == MMSYSERR_NOERROR) {
if(GIMME == G_ARRAY) {
EXTEND(SP, 2);
- XST_mIV(0, (long) volume & 0x00FF);
- XST_mIV(1, (long) (volume & 0xFF00) >> 8);
+ XST_mIV(0, (long) (volume & 0x0000FFFF ));
+ XST_mIV(1, (long) ((volume & 0xFFFF0000) >> 16));
XSRETURN(2);
} else {
XSRETURN_IV(volume);
@@ -1280,7 +1280,7 @@
}
break;
case 1:
- volume = SvIV(ST(0)) | SvIV(ST(0)) << 8;
+ volume = ( SvIV(ST(0)) & 0x0000FFFF ) | (( SvIV(ST(0)) & 0x0000FFFF ) << 16 );
mmr = waveOutSetVolume(wo, volume);
if(mmr == MMSYSERR_NOERROR) {
XSRETURN_YES;
@@ -1290,7 +1290,7 @@
}
break;
default:
- volume = SvIV(ST(0)) | SvIV(ST(1)) << 8;
+ volume = ( SvIV(ST(0)) & 0x0000FFFF ) | (( SvIV(ST(1)) & 0x0000FFFF ) << 16 );
mmr = waveOutSetVolume(wo, volume);
if(mmr == MMSYSERR_NOERROR) {
XSRETURN_YES;