beeps 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/.doc/ext/beeps/beeps.cpp +46 -0
  3. data/.doc/ext/beeps/file_in.cpp +59 -0
  4. data/.doc/ext/beeps/native.cpp +41 -0
  5. data/.doc/ext/beeps/processor.cpp +49 -0
  6. data/.doc/ext/beeps/sawtooth_wave.cpp +66 -0
  7. data/.doc/ext/beeps/sine_wave.cpp +66 -0
  8. data/.doc/ext/beeps/sound.cpp +69 -0
  9. data/.doc/ext/beeps/square_wave.cpp +66 -0
  10. data/README.md +4 -0
  11. data/Rakefile +27 -0
  12. data/VERSION +1 -0
  13. data/beeps.gemspec +43 -0
  14. data/ext/beeps/beeps.cpp +48 -0
  15. data/ext/beeps/defs.h +13 -0
  16. data/ext/beeps/extconf.rb +25 -0
  17. data/ext/beeps/file_in.cpp +61 -0
  18. data/ext/beeps/native.cpp +41 -0
  19. data/ext/beeps/processor.cpp +50 -0
  20. data/ext/beeps/sawtooth_wave.cpp +69 -0
  21. data/ext/beeps/sine_wave.cpp +69 -0
  22. data/ext/beeps/sound.cpp +72 -0
  23. data/ext/beeps/square_wave.cpp +69 -0
  24. data/include/beeps.h +12 -0
  25. data/include/beeps/beeps.h +25 -0
  26. data/include/beeps/defs.h +23 -0
  27. data/include/beeps/exception.h +47 -0
  28. data/include/beeps/openal.h +34 -0
  29. data/include/beeps/processor.h +132 -0
  30. data/include/beeps/ruby.h +10 -0
  31. data/include/beeps/ruby/beeps.h +21 -0
  32. data/include/beeps/ruby/processor.h +86 -0
  33. data/include/beeps/ruby/sound.h +42 -0
  34. data/include/beeps/signals.h +53 -0
  35. data/include/beeps/sound.h +44 -0
  36. data/lib/beeps.rb +9 -0
  37. data/lib/beeps/autoinit.rb +10 -0
  38. data/lib/beeps/beeps.rb +49 -0
  39. data/lib/beeps/ext.rb +4 -0
  40. data/lib/beeps/module.rb +49 -0
  41. data/lib/beeps/processor.rb +60 -0
  42. data/lib/beeps/sound.rb +19 -0
  43. data/src/beeps.cpp +93 -0
  44. data/src/exception.cpp +43 -0
  45. data/src/openal.cpp +216 -0
  46. data/src/openal.h +25 -0
  47. data/src/processor.cpp +201 -0
  48. data/src/signals.cpp +90 -0
  49. data/src/sound.cpp +125 -0
  50. data/src/stk/include/Blit.h +151 -0
  51. data/src/stk/include/BlitSaw.h +148 -0
  52. data/src/stk/include/BlitSquare.h +170 -0
  53. data/src/stk/include/FileRead.h +141 -0
  54. data/src/stk/include/FileWvIn.h +195 -0
  55. data/src/stk/include/Generator.h +50 -0
  56. data/src/stk/include/SineWave.h +159 -0
  57. data/src/stk/include/Stk.h +589 -0
  58. data/src/stk/include/WvIn.h +46 -0
  59. data/src/stk/src/Blit.cpp +78 -0
  60. data/src/stk/src/BlitSaw.cpp +91 -0
  61. data/src/stk/src/BlitSquare.cpp +95 -0
  62. data/src/stk/src/FileRead.cpp +903 -0
  63. data/src/stk/src/FileWvIn.cpp +260 -0
  64. data/src/stk/src/SineWave.cpp +78 -0
  65. data/src/stk/src/Stk.cpp +395 -0
  66. data/test/helper.rb +17 -0
  67. data/test/test_beeps.rb +18 -0
  68. data/test/test_sound.rb +26 -0
  69. metadata +177 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6ea954896705b5670bd87500d18d5a8d21f1d9b0
4
+ data.tar.gz: 6dc87a6062de733daa544cd4603afdd0204b5ca9
5
+ SHA512:
6
+ metadata.gz: dc4ceeb2878a6f556cd3aa431394d7f1819794b2c8f41232f5b29b7aa2edc6219e8da93efb60a4eb8009c51d52dcf19597670f2a61ac7553d86cb41b08cf5456
7
+ data.tar.gz: e387bfae183bb0eb46c9ceeda64d6af66de523f8c8aa8f8e7f8a64ed7460e683179218978db57140344bfca2b8d5a6bd22d34d6e947f24ee266e207b72dcc682
@@ -0,0 +1,46 @@
1
+ #include <rucy.h>
2
+ #include "beeps/beeps.h"
3
+ #include "defs.h"
4
+
5
+
6
+ using namespace Rucy;
7
+
8
+
9
+ static
10
+ VALUE init(VALUE self)
11
+ {
12
+ Beeps::init();
13
+ return self;
14
+ }
15
+
16
+ static
17
+ VALUE fin(VALUE self)
18
+ {
19
+ Beeps::fin();
20
+ return self;
21
+ }
22
+
23
+
24
+ static Module mBeeps;
25
+
26
+ void
27
+ Init_beeps ()
28
+ {
29
+ mBeeps = rb_define_module("Beeps");
30
+ mBeeps.define_singleton_method("init!", init);
31
+ mBeeps.define_singleton_method("fin!", fin);
32
+ }
33
+
34
+
35
+ namespace Beeps
36
+ {
37
+
38
+
39
+ Module
40
+ beeps_module ()
41
+ {
42
+ return mBeeps;
43
+ }
44
+
45
+
46
+ }// Beeps
@@ -0,0 +1,59 @@
1
+ #include "beeps/ruby/processor.h"
2
+
3
+
4
+ #include <rucy.h>
5
+ #include "beeps/exception.h"
6
+ #include "defs.h"
7
+
8
+
9
+ using namespace Rucy;
10
+
11
+
12
+ RUCY_DEFINE_VALUE_FROM_TO(Beeps::FileIn)
13
+
14
+ #define THIS to<Beeps::FileIn*>(self)
15
+
16
+ #define CHECK RUCY_CHECK_OBJECT(Beeps::FileIn, self)
17
+
18
+
19
+ static
20
+ VALUE alloc(VALUE klass)
21
+ {
22
+ return new_type<Beeps::FileIn>(klass);
23
+ }
24
+
25
+ static
26
+ VALUE initialize(VALUE self, VALUE path)
27
+ {
28
+ RUCY_CHECK_OBJ(Beeps::FileIn, self);
29
+
30
+ *THIS = Beeps::FileIn(to<const char*>(path));
31
+ return self;
32
+ }
33
+
34
+
35
+ static Class cFileIn;
36
+
37
+ void
38
+ Init_file_in ()
39
+ {
40
+ Module mBeeps = rb_define_module("Beeps");
41
+
42
+ cFileIn = mBeeps.define_class("FileIn", Beeps::processor_class());
43
+ rb_define_alloc_func(cFileIn, alloc);
44
+ rb_define_private_method(cFileIn, "initialize", RUBY_METHOD_FUNC(initialize), 1);
45
+ }
46
+
47
+
48
+ namespace Beeps
49
+ {
50
+
51
+
52
+ Class
53
+ file_in_class ()
54
+ {
55
+ return cFileIn;
56
+ }
57
+
58
+
59
+ }// Beeps
@@ -0,0 +1,41 @@
1
+ #include <rucy.h>
2
+ #include "defs.h"
3
+
4
+
5
+ using namespace Rucy;
6
+
7
+
8
+ void Init_beeps ();
9
+
10
+ void Init_processor ();
11
+ void Init_sine_wave ();
12
+ void Init_square_wave ();
13
+ void Init_sawtooth_wave ();
14
+ void Init_file_in ();
15
+
16
+ void Init_sound ();
17
+
18
+
19
+ extern "C" void
20
+ #ifdef COCOAPODS
21
+ Init_beeps_native ()
22
+ #else
23
+ Init_native ()
24
+ #endif
25
+ {
26
+ RUCY_TRY
27
+
28
+ Rucy::init();
29
+
30
+ Init_beeps();
31
+
32
+ Init_processor();
33
+ Init_sine_wave();
34
+ Init_square_wave();
35
+ Init_sawtooth_wave();
36
+ Init_file_in();
37
+
38
+ Init_sound();
39
+
40
+ RUCY_CATCH
41
+ }
@@ -0,0 +1,49 @@
1
+ #include "beeps/ruby/processor.h"
2
+
3
+
4
+ #include <rucy.h>
5
+ #include "beeps/exception.h"
6
+ #include "defs.h"
7
+
8
+
9
+ using namespace Rucy;
10
+
11
+
12
+ RUCY_DEFINE_VALUE_FROM_TO(Beeps::Processor)
13
+
14
+ #define THIS to<Beeps::Processor*>(self)
15
+
16
+ #define CHECK RUCY_CHECK_OBJECT(Beeps::Processor, self)
17
+
18
+
19
+ static
20
+ VALUE alloc(VALUE klass)
21
+ {
22
+ beeps_error(__FILE__, __LINE__);
23
+ }
24
+
25
+
26
+ static Class cProcessor;
27
+
28
+ void
29
+ Init_processor ()
30
+ {
31
+ Module mBeeps = rb_define_module("Beeps");
32
+
33
+ cProcessor = rb_define_class_under(mBeeps, "Processor", rb_cObject);
34
+ rb_define_alloc_func(cProcessor, alloc);
35
+ }
36
+
37
+
38
+ namespace Beeps
39
+ {
40
+
41
+
42
+ Class
43
+ processor_class ()
44
+ {
45
+ return cProcessor;
46
+ }
47
+
48
+
49
+ }// Beeps
@@ -0,0 +1,66 @@
1
+ #include "beeps/ruby/processor.h"
2
+
3
+
4
+ #include <rucy.h>
5
+ #include "beeps/exception.h"
6
+ #include "defs.h"
7
+
8
+
9
+ using namespace Rucy;
10
+
11
+
12
+ RUCY_DEFINE_VALUE_FROM_TO(Beeps::SawtoothWave)
13
+
14
+ #define THIS to<Beeps::SawtoothWave*>(self)
15
+
16
+ #define CHECK RUCY_CHECK_OBJECT(Beeps::SawtoothWave, self)
17
+
18
+
19
+ static
20
+ VALUE alloc(VALUE klass)
21
+ {
22
+ return new_type<Beeps::SawtoothWave>(klass);
23
+ }
24
+
25
+ static
26
+ VALUE set_frequency(VALUE self, VALUE frequency)
27
+ {
28
+ CHECK;
29
+ THIS->set_frequency(frequency.as_f(true));
30
+ return self;
31
+ }
32
+
33
+ static
34
+ VALUE frequency(VALUE self)
35
+ {
36
+ CHECK;
37
+ return to<float>(THIS->frequency());
38
+ }
39
+
40
+
41
+ static Class cSawtoothWave;
42
+
43
+ void
44
+ Init_sawtooth_wave ()
45
+ {
46
+ Module mBeeps = rb_define_module("Beeps");
47
+
48
+ cSawtoothWave = mBeeps.define_class("SawtoothWave", Beeps::processor_class());
49
+ rb_define_alloc_func(cSawtoothWave, alloc);
50
+ rb_define_method(cSawtoothWave, "frequency=", RUBY_METHOD_FUNC(set_frequency), 1);
51
+ rb_define_method(cSawtoothWave, "frequency", RUBY_METHOD_FUNC(frequency), 0);
52
+ }
53
+
54
+
55
+ namespace Beeps
56
+ {
57
+
58
+
59
+ Class
60
+ sawtooth_wave_class ()
61
+ {
62
+ return cSawtoothWave;
63
+ }
64
+
65
+
66
+ }// Beeps
@@ -0,0 +1,66 @@
1
+ #include "beeps/ruby/processor.h"
2
+
3
+
4
+ #include <rucy.h>
5
+ #include "beeps/exception.h"
6
+ #include "defs.h"
7
+
8
+
9
+ using namespace Rucy;
10
+
11
+
12
+ RUCY_DEFINE_VALUE_FROM_TO(Beeps::SineWave)
13
+
14
+ #define THIS to<Beeps::SineWave*>(self)
15
+
16
+ #define CHECK RUCY_CHECK_OBJECT(Beeps::SineWave, self)
17
+
18
+
19
+ static
20
+ VALUE alloc(VALUE klass)
21
+ {
22
+ return new_type<Beeps::SineWave>(klass);
23
+ }
24
+
25
+ static
26
+ VALUE set_frequency(VALUE self, VALUE frequency)
27
+ {
28
+ CHECK;
29
+ THIS->set_frequency(frequency.as_f(true));
30
+ return self;
31
+ }
32
+
33
+ static
34
+ VALUE frequency(VALUE self)
35
+ {
36
+ CHECK;
37
+ return to<float>(THIS->frequency());
38
+ }
39
+
40
+
41
+ static Class cSineWave;
42
+
43
+ void
44
+ Init_sine_wave ()
45
+ {
46
+ Module mBeeps = rb_define_module("Beeps");
47
+
48
+ cSineWave = mBeeps.define_class("SineWave", Beeps::processor_class());
49
+ rb_define_alloc_func(cSineWave, alloc);
50
+ rb_define_method(cSineWave, "frequency=", RUBY_METHOD_FUNC(set_frequency), 1);
51
+ rb_define_method(cSineWave, "frequency", RUBY_METHOD_FUNC(frequency), 0);
52
+ }
53
+
54
+
55
+ namespace Beeps
56
+ {
57
+
58
+
59
+ Class
60
+ sine_wave_class ()
61
+ {
62
+ return cSineWave;
63
+ }
64
+
65
+
66
+ }// Beeps
@@ -0,0 +1,69 @@
1
+ #include "beeps/ruby/sound.h"
2
+
3
+
4
+ #include <rucy.h>
5
+ #include "beeps/exception.h"
6
+ #include "defs.h"
7
+
8
+
9
+ using namespace Rucy;
10
+
11
+
12
+ RUCY_DEFINE_VALUE_FROM_TO(Beeps::Sound)
13
+
14
+ #define THIS to<Beeps::Sound*>(self)
15
+
16
+ #define CHECK RUCY_CHECK_OBJECT(Beeps::Sound, self)
17
+
18
+
19
+ static
20
+ VALUE alloc(VALUE klass)
21
+ {
22
+ return new_type<Beeps::Sound>(klass);
23
+ }
24
+
25
+ static
26
+ VALUE initialize(VALUE self, VALUE processor, VALUE seconds)
27
+ {
28
+ RUCY_CHECK_OBJ(Beeps::Sound, self);
29
+
30
+ *THIS = Beeps::Sound(to<Beeps::Processor*>(processor), to<float>(seconds));
31
+ return self;
32
+ }
33
+
34
+ static
35
+ VALUE play(VALUE self)
36
+ {
37
+ CHECK;
38
+
39
+ THIS->play();
40
+ return self;
41
+ }
42
+
43
+
44
+ static Class cSound;
45
+
46
+ void
47
+ Init_sound ()
48
+ {
49
+ Module mBeeps = rb_define_module("Beeps");
50
+
51
+ cSound = rb_define_class_under(mBeeps, "Sound", rb_cObject);
52
+ rb_define_alloc_func(cSound, alloc);
53
+ rb_define_private_method(cSound, "initialize", RUBY_METHOD_FUNC(initialize), 2);
54
+ rb_define_method(cSound, "play", RUBY_METHOD_FUNC(play), 0);
55
+ }
56
+
57
+
58
+ namespace Beeps
59
+ {
60
+
61
+
62
+ Class
63
+ sound_class ()
64
+ {
65
+ return cSound;
66
+ }
67
+
68
+
69
+ }// Beeps
@@ -0,0 +1,66 @@
1
+ #include "beeps/ruby/processor.h"
2
+
3
+
4
+ #include <rucy.h>
5
+ #include "beeps/exception.h"
6
+ #include "defs.h"
7
+
8
+
9
+ using namespace Rucy;
10
+
11
+
12
+ RUCY_DEFINE_VALUE_FROM_TO(Beeps::SquareWave)
13
+
14
+ #define THIS to<Beeps::SquareWave*>(self)
15
+
16
+ #define CHECK RUCY_CHECK_OBJECT(Beeps::SquareWave, self)
17
+
18
+
19
+ static
20
+ VALUE alloc(VALUE klass)
21
+ {
22
+ return new_type<Beeps::SquareWave>(klass);
23
+ }
24
+
25
+ static
26
+ VALUE set_frequency(VALUE self, VALUE frequency)
27
+ {
28
+ CHECK;
29
+ THIS->set_frequency(frequency.as_f(true));
30
+ return self;
31
+ }
32
+
33
+ static
34
+ VALUE frequency(VALUE self)
35
+ {
36
+ CHECK;
37
+ return to<float>(THIS->frequency());
38
+ }
39
+
40
+
41
+ static Class cSquareWave;
42
+
43
+ void
44
+ Init_square_wave ()
45
+ {
46
+ Module mBeeps = rb_define_module("Beeps");
47
+
48
+ cSquareWave = mBeeps.define_class("SquareWave", Beeps::processor_class());
49
+ rb_define_alloc_func(cSquareWave, alloc);
50
+ rb_define_method(cSquareWave, "frequency=", RUBY_METHOD_FUNC(set_frequency), 1);
51
+ rb_define_method(cSquareWave, "frequency", RUBY_METHOD_FUNC(frequency), 0);
52
+ }
53
+
54
+
55
+ namespace Beeps
56
+ {
57
+
58
+
59
+ Class
60
+ square_wave_class ()
61
+ {
62
+ return cSquareWave;
63
+ }
64
+
65
+
66
+ }// Beeps