Skip to content
Browse files

adding an ogg rb file

  • Loading branch information...
1 parent 3a60fed commit 5c4c3399d5b796ae9b9d20d4e18960b37c2150e7 @tenderlove committed Sep 28, 2008
Showing with 37 additions and 28 deletions.
  1. +2 −0 README.txt
  2. +3 −3 ext/icanhasaudio/audio_ogg_decoder.c
  3. +1 −25 lib/icanhasaudio/ogg.rb
  4. +31 −0 lib/icanhasaudio/ogg/decoder.rb
View
2 README.txt
@@ -1,5 +1,7 @@
= Audio::MPEG
+ http://icanhasaudio.com/
+ http://github.com/tenderlove/icanhasaudio/tree/master
http://seattlerb.rubyforge.org/
== DESCRIPTION. LULZ
View
6 ext/icanhasaudio/audio_ogg_decoder.c
@@ -43,11 +43,11 @@ static long rb_ogg_tell(void *datasource) {
/*
* call-seq:
- * decode(input_io, output_io)
+ * native_decode(input_io, output_io)
*
* Decode the input IO and write it to the output IO.
*/
-VALUE decode(VALUE self, VALUE infile, VALUE outf) {
+VALUE native_decode(VALUE self, VALUE infile, VALUE outf) {
OggVorbis_File vf;
ov_callbacks callbacks;
int bs = 0;
@@ -144,5 +144,5 @@ void init_audio_ogg_decoder()
VALUE rb_mOgg = rb_define_module_under(rb_mAudio, "OGG");
VALUE klass = rb_define_class_under(rb_mOgg, "Decoder", rb_cObject);
- rb_define_method(klass, "decode", decode, 2);
+ rb_define_private_method(klass, "native_decode", native_decode, 2);
}
View
26 lib/icanhasaudio/ogg.rb
@@ -1,25 +1 @@
-module Audio
- module OGG
- class Decoder
- # Set to true for no WAV header
- attr_accessor :raw
-
- # Number of bits, 8 or 16
- attr_accessor :bits
-
- # Endianness
- attr_accessor :endian
-
- # Signedness
- attr_accessor :sign
-
- def initialize
- @raw = false
- @bits = 16
- @endian = 0
- @sign = 1
- yield self if block_given?
- end
- end
- end
-end
+require 'icanhasaudio/ogg/decoder'
View
31 lib/icanhasaudio/ogg/decoder.rb
@@ -0,0 +1,31 @@
+module Audio
+ module OGG
+ class Decoder
+ # Set to true for no WAV header
+ attr_accessor :raw
+
+ # Number of bits, 8 or 16
+ attr_accessor :bits
+
+ # Endianness
+ attr_accessor :endian
+
+ # Signedness
+ attr_accessor :sign
+
+ def initialize
+ @raw = false
+ @bits = 16
+ @endian = 0
+ @sign = 1
+ yield self if block_given?
+ end
+
+ ####
+ # Decode +input+ and write to +output+
+ def decode input, output
+ native_decode(input, output)
+ end
+ end
+ end
+end

0 comments on commit 5c4c339

Please sign in to comment.
Something went wrong with that request. Please try again.