1 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
|
Description: use little-endian pack codes
The wavefile gem is using "native endian" pack codes where "little
endian" need to be specified for RIFF files. This patch makes sure
that the wavefile gem works correctly on big-endian hardware.
<URL: https://github.com/jstrait/wavefile/pull/18>.
Forwarded: yes
Author: Hanno Zulla <kontakt@hanno.de>
Last-Update: 2016-02-26
Index: ruby-wavefile/lib/wavefile.rb
===================================================================
--- ruby-wavefile.orig/lib/wavefile.rb 2016-02-26 15:06:57.010860717 +0100
+++ ruby-wavefile/lib/wavefile.rb 2016-02-26 15:12:55.094391776 +0100
@@ -25,7 +25,7 @@
:sample => "smpl",
:instrument => "inst" } # :nodoc:
- PACK_CODES = {:pcm => {8 => "C*", 16 => "s*", 24 => "C*", 32 => "l*"},
+ PACK_CODES = {:pcm => {8 => "C*", 16 => "s<*", 24 => "C*", 32 => "l<*"},
:float => { 32 => "e*", 64 => "E*"}} # :nodoc:
UNSIGNED_INT_16 = "v" # :nodoc:
Index: ruby-wavefile/lib/wavefile/writer.rb
===================================================================
--- ruby-wavefile.orig/lib/wavefile/writer.rb 2016-02-26 15:06:57.010860717 +0100
+++ ruby-wavefile/lib/wavefile/writer.rb 2016-02-26 15:13:03.438380850 +0100
@@ -76,7 +76,7 @@
if @format.bits_per_sample == 24 && @format.sample_format == :pcm
samples.flatten.each do |sample|
- @file.syswrite([sample].pack("lX"))
+ @file.syswrite([sample].pack("l<X"))
end
else
@file.syswrite(samples.flatten.pack(@pack_code))
|