win32-sound 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +73 -66
- data/MANIFEST +10 -8
- data/README +57 -56
- data/Rakefile +36 -31
- data/examples/example_win32_sound.rb +56 -48
- data/lib/win32/sound.rb +350 -233
- data/lib/win32/windows/functions.rb +41 -0
- data/lib/win32/windows/structs.rb +78 -0
- data/test/test_win32_sound.rb +141 -103
- data/win32-sound.gemspec +25 -25
- metadata +36 -25
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f4bdc665ebd9e6b35140e5e48801e271060720c5
|
4
|
+
data.tar.gz: a22dd1421d0be46d57584ecc444bbdfdd6351400
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7af84db083e9b8839e8ceedcbba0f03c2f79c4024fd0b221ffb019d6e7982a2b8b54700b26d1d57b1b97c38774236e216bc5b952acb4361dd7d36e848babdd26
|
7
|
+
data.tar.gz: 819948dce743c4e8126e704c0f5fd317a9488a24a700a619423cbe2a42fa3e6850a03715279817a9d2c1f88230c9687bdabf95b8c6552c525bd5ba47f1143bb1
|
data/CHANGES
CHANGED
@@ -1,66 +1,73 @@
|
|
1
|
-
== 0.
|
2
|
-
*
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
*
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
*
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
*
|
20
|
-
|
21
|
-
*
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
*
|
27
|
-
|
28
|
-
|
29
|
-
*
|
30
|
-
*
|
31
|
-
*
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
*
|
37
|
-
* Added a
|
38
|
-
*
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
*
|
45
|
-
*
|
46
|
-
|
47
|
-
|
48
|
-
*
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
*
|
54
|
-
*
|
55
|
-
*
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
*
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
*
|
1
|
+
== 0.6.0 - 30-Jul-2014
|
2
|
+
* Added the play_freq method. This lets you play a frequency for a
|
3
|
+
specified duration at a given volume. Big thanks go out to Dominic
|
4
|
+
Muller for the patch.
|
5
|
+
* Reorganization of FFI related code into their own files.
|
6
|
+
* Updated the gem:create and gem:install rake tasks.
|
7
|
+
|
8
|
+
== 0.5.1 - 10-Apr-2013
|
9
|
+
* Updated HANDLE prototype in underlying FFI code. This affects
|
10
|
+
64 bit versions of Ruby.
|
11
|
+
|
12
|
+
== 0.5.0 - 28-Jun-2012
|
13
|
+
* Now uses FFI instead of win32-api. This means it works with JRuby, too.
|
14
|
+
* Corresponding updates to the tests, Rakefile, gemspec, etc.
|
15
|
+
* Removed the Sound::Error exception class. If an underlying FFI function
|
16
|
+
fails then a SystemCallError (Errno::XXX) is raised instead.
|
17
|
+
|
18
|
+
== 0.4.3 - 21-May-2011
|
19
|
+
* Refactored Rakefile, removing an old gem install task and adding a
|
20
|
+
default task and a clean task.
|
21
|
+
* Altered the gemspec, including a platform change to 'universal-win32', and
|
22
|
+
removed a deprecated specification method.
|
23
|
+
|
24
|
+
== 0.4.2 - 6-Aug-2009
|
25
|
+
* Changed the license to Artistic 2.0.
|
26
|
+
* Updated to use the Windows::Sound module from the windows-pr library.
|
27
|
+
* Fixed the Sound::ALIAS value. It was wrongly set to SND_ALIAS_ID.
|
28
|
+
* Several gemspec updates, including the license and description.
|
29
|
+
* The Sound.get_wave_volume method is now a true alias.
|
30
|
+
* Renamed the test file to test_win32_sound.rb.
|
31
|
+
* Renamed the example file to example_win32_sound.rb to avoid any possible
|
32
|
+
confusion with actual test files.
|
33
|
+
* Added the 'example' rake task.
|
34
|
+
|
35
|
+
== 0.4.1 - 27-Jul-2007
|
36
|
+
* Changed SoundError to Sound::Error.
|
37
|
+
* Added a Rakefile with tasks for installation and testing.
|
38
|
+
* Removed the install.rb file. Installation is now handled via a rake task.
|
39
|
+
* Documentation updates.
|
40
|
+
|
41
|
+
== 0.4.0 - 26-Feb-2006
|
42
|
+
* Now pure Ruby only.
|
43
|
+
* Documentation updates and reorganization.
|
44
|
+
* Added a gemspec.
|
45
|
+
* Minor test suite changes.
|
46
|
+
|
47
|
+
== 0.3.0 - 29-May-2005
|
48
|
+
* Changed the Sound.volume= method (which didn't work) to
|
49
|
+
Sound.set_wave_volume because it takes up to two values and only affects
|
50
|
+
the wave volume, not the master volume.
|
51
|
+
* Renamed the Sound.volume method to Sound.wave_volume.
|
52
|
+
* Fixed a bug in the Sound.wave_volume method.
|
53
|
+
* Created the Sound.get_wave_volume alias for Sound.wave_volume.
|
54
|
+
* Fixed the Sound.set_wave_volume method.
|
55
|
+
* Test adjustments and additions to reflect API changes.
|
56
|
+
* Now Unicode friendly.
|
57
|
+
* Removed the sound.rd file. The sound.txt file is now rdoc friendly.
|
58
|
+
|
59
|
+
== 0.2.1 - 1-Mar-2005
|
60
|
+
* Moved the 'examples' directory to the toplevel directory
|
61
|
+
* Made the CHANGES and README files rdoc friendly
|
62
|
+
* Some cleanup in sound.h.
|
63
|
+
|
64
|
+
== 0.2.0 - 13-Jul-2004
|
65
|
+
* Moved the SoundError class under the Win32 module namespace
|
66
|
+
* Replaced the deprecated STR2CSTR() function with the StringValuePtr()
|
67
|
+
function. This means that as of version 0.2.0, this package requires
|
68
|
+
Ruby 1.8.0 or later.
|
69
|
+
* Moved the test.rb script to doc/examples
|
70
|
+
* Added the README file (oops).
|
71
|
+
|
72
|
+
== 0.1.0 - 14-Feb-2004
|
73
|
+
* Initial release
|
data/MANIFEST
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
* MANIFEST
|
2
|
-
* CHANGES
|
3
|
-
* README
|
4
|
-
* Rakefile
|
5
|
-
* win32-sound.gempsec
|
6
|
-
* examples/sound_test.rb
|
7
|
-
* lib/win32/sound.rb
|
8
|
-
*
|
1
|
+
* MANIFEST
|
2
|
+
* CHANGES
|
3
|
+
* README
|
4
|
+
* Rakefile
|
5
|
+
* win32-sound.gempsec
|
6
|
+
* examples/sound_test.rb
|
7
|
+
* lib/win32/sound.rb
|
8
|
+
* lib/win32/windows/functions.rb
|
9
|
+
* lib/win32/windows/structs.rb
|
10
|
+
* test/test_win32_sound.rb
|
data/README
CHANGED
@@ -1,56 +1,57 @@
|
|
1
|
-
= Description
|
2
|
-
A library for playing and controlling sounds on MS Windows.
|
3
|
-
|
4
|
-
= Prerequisites
|
5
|
-
* ffi
|
6
|
-
* test-unit 2 (Development only)
|
7
|
-
|
8
|
-
= Installation
|
9
|
-
gem install win32-sound
|
10
|
-
|
11
|
-
= Synopsis
|
12
|
-
require 'win32/sound'
|
13
|
-
include Win32
|
14
|
-
|
15
|
-
# Play a wav file
|
16
|
-
Sound.play("somefile.wav")
|
17
|
-
|
18
|
-
# Play a system sound
|
19
|
-
Sound.play("SystemAsterisk",Sound::ALIAS)
|
20
|
-
|
21
|
-
# Get the current volume of the waveform-audio output device.
|
22
|
-
p Sound.volume.join(", ") # left channel, right channel
|
23
|
-
|
24
|
-
= Acknowledgements
|
25
|
-
API ideas derived (or not) from Perl's Win32::Sound module and Python's
|
26
|
-
winsound package.
|
27
|
-
|
28
|
-
= Known Bugs
|
29
|
-
None that I'm aware of. Please report any bugs on the project page
|
30
|
-
at https://github.com/djberg96/win32-sound.
|
31
|
-
|
32
|
-
= Future Plans
|
33
|
-
Add ability to retrieve information about WAV files.
|
34
|
-
Add MIDI support?
|
35
|
-
|
36
|
-
= Developer's Notes
|
37
|
-
The MessageBeep() function, which the Python "winsound" module contains,
|
38
|
-
is intentionally omitted here. I felt it was redundant, because you can
|
39
|
-
achieve the same effect with something like this:
|
40
|
-
|
41
|
-
Sound.play("SystemAsterisk", Sound::ALIAS).
|
42
|
-
|
43
|
-
= License
|
44
|
-
Artistic 2.0
|
45
|
-
|
46
|
-
= Copyright
|
47
|
-
(C) 2004-
|
48
|
-
|
49
|
-
= Warranty
|
50
|
-
This package is provided "as is" and without any express or
|
51
|
-
implied warranties, including, without limitation, the implied
|
52
|
-
warranties of merchantability and fitness for a particular purpose.
|
53
|
-
|
54
|
-
= Author(s)
|
55
|
-
Daniel Berger
|
56
|
-
Park Heesob
|
1
|
+
= Description
|
2
|
+
A library for playing and controlling sounds on MS Windows.
|
3
|
+
|
4
|
+
= Prerequisites
|
5
|
+
* ffi
|
6
|
+
* test-unit 2 (Development only)
|
7
|
+
|
8
|
+
= Installation
|
9
|
+
gem install win32-sound
|
10
|
+
|
11
|
+
= Synopsis
|
12
|
+
require 'win32/sound'
|
13
|
+
include Win32
|
14
|
+
|
15
|
+
# Play a wav file
|
16
|
+
Sound.play("somefile.wav")
|
17
|
+
|
18
|
+
# Play a system sound
|
19
|
+
Sound.play("SystemAsterisk",Sound::ALIAS)
|
20
|
+
|
21
|
+
# Get the current volume of the waveform-audio output device.
|
22
|
+
p Sound.volume.join(", ") # left channel, right channel
|
23
|
+
|
24
|
+
= Acknowledgements
|
25
|
+
API ideas derived (or not) from Perl's Win32::Sound module and Python's
|
26
|
+
winsound package.
|
27
|
+
|
28
|
+
= Known Bugs
|
29
|
+
None that I'm aware of. Please report any bugs on the project page
|
30
|
+
at https://github.com/djberg96/win32-sound.
|
31
|
+
|
32
|
+
= Future Plans
|
33
|
+
Add ability to retrieve information about WAV files.
|
34
|
+
Add MIDI support?
|
35
|
+
|
36
|
+
= Developer's Notes
|
37
|
+
The MessageBeep() function, which the Python "winsound" module contains,
|
38
|
+
is intentionally omitted here. I felt it was redundant, because you can
|
39
|
+
achieve the same effect with something like this:
|
40
|
+
|
41
|
+
Sound.play("SystemAsterisk", Sound::ALIAS).
|
42
|
+
|
43
|
+
= License
|
44
|
+
Artistic 2.0
|
45
|
+
|
46
|
+
= Copyright
|
47
|
+
(C) 2004-2014, Daniel J. Berger, All Rights Reserved
|
48
|
+
|
49
|
+
= Warranty
|
50
|
+
This package is provided "as is" and without any express or
|
51
|
+
implied warranties, including, without limitation, the implied
|
52
|
+
warranties of merchantability and fitness for a particular purpose.
|
53
|
+
|
54
|
+
= Author(s)
|
55
|
+
Daniel Berger
|
56
|
+
Park Heesob
|
57
|
+
Dominic Muller
|
data/Rakefile
CHANGED
@@ -1,31 +1,36 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'rake/clean'
|
4
|
-
|
5
|
-
CLEAN.include("**/*.gem", "**/*.rbc")
|
6
|
-
|
7
|
-
namespace :gem do
|
8
|
-
desc "Create the win32-sound gem"
|
9
|
-
task :create => [:clean] do
|
10
|
-
spec = eval(IO.read("win32-sound.gemspec"))
|
11
|
-
Gem::
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/clean'
|
4
|
+
|
5
|
+
CLEAN.include("**/*.gem", "**/*.rbc")
|
6
|
+
|
7
|
+
namespace :gem do
|
8
|
+
desc "Create the win32-sound gem"
|
9
|
+
task :create => [:clean] do
|
10
|
+
spec = eval(IO.read("win32-sound.gemspec"))
|
11
|
+
if Gem::VERSION.to_f < 2.0
|
12
|
+
Gem::Builder.new(spec).build
|
13
|
+
else
|
14
|
+
require 'rubygems/package'
|
15
|
+
Gem::Package.build(spec)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Install the win32-sound library"
|
20
|
+
task :install => [:create] do
|
21
|
+
file = Dir["*.gem"].first
|
22
|
+
sh "gem install -l #{file}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'Run the example program'
|
27
|
+
task :example do
|
28
|
+
ruby '-Ilib examples\example_win32_sound.rb'
|
29
|
+
end
|
30
|
+
|
31
|
+
Rake::TestTask.new do |t|
|
32
|
+
t.warning = true
|
33
|
+
t.verbose = true
|
34
|
+
end
|
35
|
+
|
36
|
+
task :default => :test
|
@@ -1,48 +1,56 @@
|
|
1
|
-
#######################################################################
|
2
|
-
# example_win32_sound.rb (win32-sound)
|
3
|
-
#
|
4
|
-
# A example script to demonstrate the win32-sound library and for
|
5
|
-
# general futzing. You can run this via the 'rake example' task.
|
6
|
-
#
|
7
|
-
# Modify as you see fit.
|
8
|
-
#######################################################################
|
9
|
-
require 'win32/sound'
|
10
|
-
include Win32
|
11
|
-
|
12
|
-
wav = "c:\\windows\\media\\chimes.wav"
|
13
|
-
|
14
|
-
puts "VERSION: " + Sound::VERSION
|
15
|
-
#puts "Devices: " + Sound.devices.join(", ")
|
16
|
-
|
17
|
-
#Sound.volume = [77,128] # my personal settings
|
18
|
-
|
19
|
-
orig_left, orig_right = Sound.wave_volume
|
20
|
-
puts "Volume was: #{orig_left}, #{orig_right}"
|
21
|
-
|
22
|
-
#Sound.volume = 140
|
23
|
-
#puts "Volume is now: " + Sound.volume.join(", ")
|
24
|
-
|
25
|
-
#Sound.volume = [orig_left,orig_right]
|
26
|
-
#puts "Volume is now: " + Sound.volume.join(", ")
|
27
|
-
|
28
|
-
puts "Playing 'SystemAsterisk' sound"
|
29
|
-
sleep 1
|
30
|
-
Sound.play("SystemAsterisk",Sound::ALIAS)
|
31
|
-
|
32
|
-
puts "Playing 'chimes' sound once"
|
33
|
-
sleep 1
|
34
|
-
Sound.play(wav)
|
35
|
-
|
36
|
-
puts "Playing 'chimes' sound in a loop for 3 seconds"
|
37
|
-
sleep 1
|
38
|
-
Sound.play(wav,Sound::ASYNC|Sound::LOOP)
|
39
|
-
sleep 3
|
40
|
-
Sound.stop
|
41
|
-
|
42
|
-
puts "Playing default sound"
|
43
|
-
sleep 1
|
44
|
-
Sound.play("Foofoo", Sound::ALIAS)
|
45
|
-
|
46
|
-
puts "Playing a beep"
|
47
|
-
sleep 1
|
48
|
-
Sound.beep(500,
|
1
|
+
#######################################################################
|
2
|
+
# example_win32_sound.rb (win32-sound)
|
3
|
+
#
|
4
|
+
# A example script to demonstrate the win32-sound library and for
|
5
|
+
# general futzing. You can run this via the 'rake example' task.
|
6
|
+
#
|
7
|
+
# Modify as you see fit.
|
8
|
+
#######################################################################
|
9
|
+
require 'win32/sound'
|
10
|
+
include Win32
|
11
|
+
|
12
|
+
wav = "c:\\windows\\media\\chimes.wav"
|
13
|
+
|
14
|
+
puts "VERSION: " + Sound::VERSION
|
15
|
+
#puts "Devices: " + Sound.devices.join(", ")
|
16
|
+
|
17
|
+
#Sound.volume = [77,128] # my personal settings
|
18
|
+
|
19
|
+
orig_left, orig_right = Sound.wave_volume
|
20
|
+
puts "Volume was: #{orig_left}, #{orig_right}"
|
21
|
+
|
22
|
+
#Sound.volume = 140
|
23
|
+
#puts "Volume is now: " + Sound.volume.join(", ")
|
24
|
+
|
25
|
+
#Sound.volume = [orig_left,orig_right]
|
26
|
+
#puts "Volume is now: " + Sound.volume.join(", ")
|
27
|
+
|
28
|
+
puts "Playing 'SystemAsterisk' sound"
|
29
|
+
sleep 1
|
30
|
+
Sound.play("SystemAsterisk",Sound::ALIAS)
|
31
|
+
|
32
|
+
puts "Playing 'chimes' sound once"
|
33
|
+
sleep 1
|
34
|
+
Sound.play(wav)
|
35
|
+
|
36
|
+
puts "Playing 'chimes' sound in a loop for 3 seconds"
|
37
|
+
sleep 1
|
38
|
+
Sound.play(wav,Sound::ASYNC|Sound::LOOP)
|
39
|
+
sleep 3
|
40
|
+
Sound.stop
|
41
|
+
|
42
|
+
puts "Playing default sound"
|
43
|
+
sleep 1
|
44
|
+
Sound.play("Foofoo", Sound::ALIAS)
|
45
|
+
|
46
|
+
puts "Playing a beep"
|
47
|
+
sleep 1
|
48
|
+
Sound.beep(500, 2000)
|
49
|
+
|
50
|
+
puts "Playing multiple frequencies simultaneously"
|
51
|
+
sleep 1
|
52
|
+
threads = []
|
53
|
+
[440, 660].each do |freq|
|
54
|
+
threads << Thread.new { Sound.play_freq(freq) }
|
55
|
+
end
|
56
|
+
threads.each { |th| th.join }
|