rhythmmml 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f807f08e311a09694c0dd3fa75bb90bd938adc7d
4
- data.tar.gz: d72e27771f9d54a565fe0a3a182e4ed832db6906
3
+ metadata.gz: de6910bb661fa7543e33efcc11cba0bb73c2d3b3
4
+ data.tar.gz: 21563af764fb579fca57f6ca78c71fd36a42fd4b
5
5
  SHA512:
6
- metadata.gz: 5a9889463e585c91c77c2a2dabbfad1d06bbf72855aa347fb9e5dcfd438cbb39b0664381dfe18c72457b040380f98191ba7f079f26bda897022470854b0f79e6
7
- data.tar.gz: 175d4fee776cfc4877315bf79082fd1225b9d3db142afcdab319412a54015d4ded9a6dfd37bba00b198e8ca66bdc98ba98f95c87b9a5283e44ae6e0c813f39e3
6
+ metadata.gz: bdb8e3b03f5ea28ecada61bfdc97c3c5b1f488874330dd3b983c61787564ac13017fcb9c367f8ee543560b92c548036a21c73c8cb3fa49e255d65854ff3357f3
7
+ data.tar.gz: 90f1a799d48b1fe2b142fc23f641fbe452d24d5413951ca67a150975aab2756f66484b4993d9125949d0978119d02d73ac8fa75b43e0bf0b8cd4357a1ceb5abf
@@ -1,7 +1,7 @@
1
1
  require "gosu"
2
2
  require "mml2wav"
3
3
  require "wavefile"
4
- require "tempfile"
4
+ require "tmpdir"
5
5
  require "rhythmmml/object"
6
6
  require "rhythmmml/figure"
7
7
  require "rhythmmml/parser"
@@ -152,13 +152,14 @@ module Rhythmmml
152
152
  distance = (@bar_y - rhythm.y).abs
153
153
  if distance < 10
154
154
  @info.score += 10 - distance
155
- Tempfile.open(["rhythmmml", ".wav"]) do |tempfile|
156
- WaveFile::Writer.new(tempfile, @format) do |writer|
155
+ Dir.mktmpdir("rhythmmml") do |dir|
156
+ path = File.join(dir, "a.wav")
157
+ WaveFile::Writer.new(path, @format) do |writer|
157
158
  samples = sine_wave(*rhythm.info[2])
158
159
  buffer = WaveFile::Buffer.new(samples, @buffer_format)
159
160
  writer.write(buffer)
160
161
  end
161
- Gosu::Sample.new(@window, tempfile.path).play
162
+ Gosu::Sample.new(@window, path).play
162
163
  end
163
164
  @objects.delete(rhythm)
164
165
  @rhythms.delete(rhythm)
@@ -1,3 +1,3 @@
1
1
  module Rhythmmml
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhythmmml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masafumi Yokoyama