albanpeignier-alsa-backup 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/Rakefile +2 -2
- data/alsa-backup.gemspec +6 -4
- data/lib/alsa.rb +4 -1
- data/lib/alsa_backup.rb +1 -1
- data/lib/sndfile.rb +20 -2
- metadata +13 -3
data/History.txt
CHANGED
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ $hoe = Hoe.new('alsa-backup', AlsaBackup::VERSION) do |p|
|
|
9
9
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
10
10
|
p.rubyforge_name = p.name # TODO this is default value
|
11
11
|
p.extra_deps = [
|
12
|
-
['ffi','>= 0.3.5'], ['newgem', ">= #{::Newgem::VERSION}"]
|
12
|
+
['ffi','>= 0.3.5'], [ 'newgem', ">= #{::Newgem::VERSION}" ], [ 'daemons', '>= 1.0.10' ]
|
13
13
|
]
|
14
14
|
p.extra_dev_deps = [
|
15
15
|
['newgem', ">= #{::Newgem::VERSION}"]
|
@@ -28,7 +28,7 @@ task :default => :spec
|
|
28
28
|
|
29
29
|
namespace :gems do
|
30
30
|
task :install do
|
31
|
-
gems = %w{activesupport ffi rspec}
|
31
|
+
gems = %w{activesupport ffi rspec daemons}
|
32
32
|
sh "sudo gem install #{gems.join(' ')}"
|
33
33
|
end
|
34
34
|
end
|
data/alsa-backup.gemspec
CHANGED
@@ -2,23 +2,22 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{alsa-backup}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Alban Peignier"]
|
9
|
-
s.date = %q{2009-05-
|
9
|
+
s.date = %q{2009-05-22}
|
10
10
|
s.default_executable = %q{alsa.backup}
|
11
11
|
s.description = %q{ALSA client to perform continuous recording}
|
12
12
|
s.email = ["alban.peignier@free.fr"]
|
13
13
|
s.executables = ["alsa.backup"]
|
14
14
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
|
15
15
|
s.files = [".autotest", "History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "TODO", "alsa-backup.gemspec", "bin/alsa.backup", "config.sample", "lib/alsa.rb", "lib/alsa_backup.rb", "lib/alsa_backup/cli.rb", "lib/alsa_backup/core_ext.rb", "lib/alsa_backup/length_controller.rb", "lib/alsa_backup/recorder.rb", "lib/alsa_backup/writer.rb", "lib/sndfile.rb", "script/console", "script/destroy", "script/generate", "spec/alsa/pcm_spec.rb", "spec/alsa_backup/cli_spec.rb", "spec/alsa_backup/core_ext_spec.rb", "spec/alsa_backup/recorder_spec.rb", "spec/alsa_backup/writer_spec.rb", "spec/alsa_backup_spec.rb", "spec/fixtures/config_test.rb", "spec/sndfile/info_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"]
|
16
|
-
s.has_rdoc = true
|
17
16
|
s.homepage = %q{http://github.com/alban.peignier/alsa-backup}
|
18
17
|
s.rdoc_options = ["--main", "README.rdoc"]
|
19
18
|
s.require_paths = ["lib"]
|
20
19
|
s.rubyforge_project = %q{alsa-backup}
|
21
|
-
s.rubygems_version = %q{1.3.
|
20
|
+
s.rubygems_version = %q{1.3.3}
|
22
21
|
s.summary = %q{ALSA client to perform continuous recording}
|
23
22
|
|
24
23
|
if s.respond_to? :specification_version then
|
@@ -28,17 +27,20 @@ Gem::Specification.new do |s|
|
|
28
27
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
29
28
|
s.add_runtime_dependency(%q<ffi>, [">= 0.3.5"])
|
30
29
|
s.add_runtime_dependency(%q<newgem>, [">= 1.4.1"])
|
30
|
+
s.add_runtime_dependency(%q<daemons>, [">= 1.0.10"])
|
31
31
|
s.add_development_dependency(%q<newgem>, [">= 1.4.1"])
|
32
32
|
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
|
33
33
|
else
|
34
34
|
s.add_dependency(%q<ffi>, [">= 0.3.5"])
|
35
35
|
s.add_dependency(%q<newgem>, [">= 1.4.1"])
|
36
|
+
s.add_dependency(%q<daemons>, [">= 1.0.10"])
|
36
37
|
s.add_dependency(%q<newgem>, [">= 1.4.1"])
|
37
38
|
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
38
39
|
end
|
39
40
|
else
|
40
41
|
s.add_dependency(%q<ffi>, [">= 0.3.5"])
|
41
42
|
s.add_dependency(%q<newgem>, [">= 1.4.1"])
|
43
|
+
s.add_dependency(%q<daemons>, [">= 1.0.10"])
|
42
44
|
s.add_dependency(%q<newgem>, [">= 1.4.1"])
|
43
45
|
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
44
46
|
end
|
data/lib/alsa.rb
CHANGED
@@ -91,7 +91,10 @@ module ALSA
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def read
|
94
|
-
|
94
|
+
ALSA.logger.debug('alsa') { "start read with #{hw_params.sample_rate}, #{hw_params.channels} channels"}
|
95
|
+
|
96
|
+
# use an 500ms buffer
|
97
|
+
frame_count = hw_params.sample_rate / 2 * hw_params.channels
|
95
98
|
|
96
99
|
FFI::MemoryPointer.new(:char, hw_params.buffer_size_for(frame_count)) do |buffer|
|
97
100
|
begin
|
data/lib/alsa_backup.rb
CHANGED
data/lib/sndfile.rb
CHANGED
@@ -1,8 +1,21 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'ffi'
|
3
3
|
|
4
|
+
require 'logger'
|
5
|
+
|
4
6
|
module Sndfile
|
5
7
|
|
8
|
+
def self.logger
|
9
|
+
unless @logger
|
10
|
+
@logger = Logger.new(STDERR)
|
11
|
+
@logger.level = Logger::WARN
|
12
|
+
end
|
13
|
+
|
14
|
+
@logger
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.logger=(logger); @logger = logger; end
|
18
|
+
|
6
19
|
class File
|
7
20
|
|
8
21
|
attr_reader :path
|
@@ -27,7 +40,10 @@ module Sndfile
|
|
27
40
|
end
|
28
41
|
|
29
42
|
def write(buffer, frame_count)
|
30
|
-
|
43
|
+
ALSA.logger.debug('sndfile') { "write #{frame_count} frames in #{path}"}
|
44
|
+
write_count = Sndfile::Native::write_int(@handle, buffer, frame_count)
|
45
|
+
|
46
|
+
unless write_count == frame_count
|
31
47
|
raise self.error
|
32
48
|
end
|
33
49
|
end
|
@@ -114,7 +130,9 @@ module Sndfile
|
|
114
130
|
attach_function :open, :sf_open, [ :string, :int, :pointer ], :pointer
|
115
131
|
attach_function :close, :sf_close, [ :pointer ], :int
|
116
132
|
|
117
|
-
|
133
|
+
# TODO off_t won't work on windows
|
134
|
+
attach_function :write_int, :sf_write_int, [ :pointer, :pointer, :off_t ], :off_t
|
135
|
+
|
118
136
|
|
119
137
|
attach_function :strerror, :sf_strerror, [ :pointer ], :string
|
120
138
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: albanpeignier-alsa-backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alban Peignier
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-22 00:00:00 -07:00
|
13
13
|
default_executable: alsa.backup
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,6 +32,16 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.4.1
|
34
34
|
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: daemons
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.0.10
|
44
|
+
version:
|
35
45
|
- !ruby/object:Gem::Dependency
|
36
46
|
name: newgem
|
37
47
|
type: :development
|
@@ -97,7 +107,7 @@ files:
|
|
97
107
|
- spec/spec.opts
|
98
108
|
- spec/spec_helper.rb
|
99
109
|
- tasks/rspec.rake
|
100
|
-
has_rdoc:
|
110
|
+
has_rdoc: false
|
101
111
|
homepage: http://github.com/alban.peignier/alsa-backup
|
102
112
|
post_install_message:
|
103
113
|
rdoc_options:
|