ao 0.1.2 → 0.1.5

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
  SHA256:
3
- metadata.gz: 453cbe5045fb3355237c6ac508bb22f7945035fae1c068ddc370beecb2d282d0
4
- data.tar.gz: 9a3385722ad42cc9007157cd6ca4305c37b7692ce2d0b26da9dd5deacdc4da90
3
+ metadata.gz: 95b55efc78c4e08cecf01300b2498ae7d0167133de4c7b45eda9833096075574
4
+ data.tar.gz: c0642596b538bd9369747e314c338d1bca68154edf8d8799cadf346093968047
5
5
  SHA512:
6
- metadata.gz: 1bf39b9ab09d450dff5c79dd57f7a934c3218700dddf38474b05c099637cd9c52a8180b509464fe179353d70839865154adecd030bf848b92ca2b7f5e64af834
7
- data.tar.gz: 213ab51a9dede88944bf1629307c752a6ee3aba29e7c6a875b5e7342ae3d2937bf4763bf5eb80a5b5db7f7f62f39640cf63d9efb71abf33a881981d794fe7041
6
+ metadata.gz: 56453a03af111246aad7b0af58fd572f796021ffc006a65cb27cc91b3bb4c2509fd407153b236ac4028ef89ffe597bada7c0f33cae83f016ebb345eb777b8fbd
7
+ data.tar.gz: 6d2ef0d6a259de0fad48975ec617a14d0a1fc10e3303d86eb2ab57beebe6d2fb3a98edc02b1b6b93d3f91fdbdce3489e51000c1157e8463bbe352987f5108eb6
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = Ruby-AO(libao Ruby Interface)
2
2
 
3
- * http://bitbucket.org/phenomer/ruby-ao
3
+ * https://github.com/phenomer/ruby-ao
4
4
 
5
5
  == 概要
6
6
  ruby-aoは、シンプルでクロスプラットフォームなオーディオ出力ライブラリ
data/example/rawplay.rb CHANGED
@@ -12,7 +12,7 @@ require 'audio/output'
12
12
 
13
13
  ARGV.each{|file|
14
14
  if File.file?(file)
15
- Audio::LiveOutput.new(bits: 16, rate: 44100, channels: 2,
15
+ Audio::LiveOutput.new(driver_id: Audio::Info.default_driver_id, bits: 16, rate: 44100, channels: 2,
16
16
  byte_format: Audio::Info::FMT_LITTLE){|ao|
17
17
  File.open(file){|f|
18
18
  while buffer = f.read(4096)
data/ext/audio/cao.h CHANGED
@@ -52,6 +52,7 @@ typedef struct ao_struct {
52
52
  pthread_mutex_t mutex;
53
53
  pthread_cond_t cond;
54
54
  int status;
55
+ int tmode;
55
56
  } ao_struct;
56
57
 
57
58
 
data/ext/audio/device.c CHANGED
@@ -35,7 +35,7 @@ init_aos(ao_device *dev, ao_sample_format *format,
35
35
  aos->queue = NULL;
36
36
  aos->status = 1;
37
37
  aos->qsize = 0;
38
- aos->thread = 0;
38
+ aos->tmode = 0;
39
39
  return aos;
40
40
  }
41
41
 
@@ -73,7 +73,7 @@ raodev_play(VALUE obj, VALUE output_samples)
73
73
  }
74
74
  memcpy(sample->buffer, StringValuePtr(output_samples), sample->bytes);
75
75
 
76
- if (aos->thread == 1){
76
+ if (aos->tmode == 1){
77
77
  enqueue(aos, sample);
78
78
  } else {
79
79
  aosg.aos = aos;
@@ -97,10 +97,9 @@ raodev_play(VALUE obj, VALUE output_samples)
97
97
  */
98
98
  void
99
99
  close_device(ao_struct *aos){
100
- int i;
101
100
  sample_t *sample;
102
101
 
103
- if (aos->thread == 1){
102
+ if (aos->tmode == 1){
104
103
  assert(pthread_mutex_lock(&aos->mutex) == 0);
105
104
  if (aos->status > 0){
106
105
  aos->status = 0;
@@ -113,21 +112,21 @@ close_device(ao_struct *aos){
113
112
  free(sample);
114
113
  }
115
114
  pthread_join(aos->thread, NULL);
116
- } else {
117
- if (aos->device != NULL){
118
- ao_close(aos->device);
119
- }
120
- if (aos->option != NULL){
121
- ao_free_options(aos->option);
122
- }
123
- if (aos->format != NULL){
124
- free_format(aos->format);
125
- }
126
- aos->device = NULL;
127
- aos->option = NULL;
128
- aos->format = NULL;
129
- aos->queue = NULL;
130
115
  }
116
+
117
+ if (aos->device != NULL){
118
+ ao_close(aos->device);
119
+ }
120
+ if (aos->option != NULL){
121
+ ao_free_options(aos->option);
122
+ }
123
+ if (aos->format != NULL){
124
+ free_format(aos->format);
125
+ }
126
+ aos->device = NULL;
127
+ aos->option = NULL;
128
+ aos->format = NULL;
129
+ aos->queue = NULL;
131
130
  return;
132
131
  }
133
132
 
@@ -1,8 +1,5 @@
1
1
  #include "cao.h"
2
2
 
3
- VALUE cAudio;
4
- VALUE cAO_Live;
5
- VALUE cAO_File;
6
3
  VALUE cAO_eAOError;
7
4
  VALUE cAO_eNoDriver;
8
5
  VALUE cAO_eNotFile;
data/ext/audio/info.c CHANGED
@@ -4,12 +4,6 @@
4
4
  #include <errno.h>
5
5
  #include "cao.h"
6
6
 
7
- VALUE cAudio;
8
- VALUE cAO_Live;
9
- VALUE cAO_Info;
10
- VALUE cAO_eDriverError;
11
- VALUE cAO_eBadFormat;
12
-
13
7
  /*
14
8
  ao_info構造体をRubyのHashに変換し返す。
15
9
  */
data/ext/audio/mixer.c CHANGED
@@ -9,7 +9,7 @@ int
9
9
  mix_sample_8(sample_t **samples, sample_t *ret, int chs){
10
10
  int32_t sum;
11
11
  int ch;
12
- int pos;
12
+ uint32_t pos;
13
13
  int8_t *buffer;
14
14
  int8_t *src;
15
15
 
@@ -31,7 +31,7 @@ int
31
31
  mix_sample_16(sample_t **samples, sample_t *ret, int chs){
32
32
  int32_t sum;
33
33
  int ch;
34
- int pos;
34
+ uint32_t pos;
35
35
  int16_t *buffer;
36
36
  int16_t *src;
37
37
 
@@ -80,7 +80,7 @@ rao_mix_samples(VALUE obj, VALUE bits, VALUE rsamples){
80
80
  sample_t ret;
81
81
  int stat;
82
82
  int chs = 0;
83
- int maxlen = 0;
83
+ uint32_t maxlen = 0;
84
84
 
85
85
  Check_Type(bits, T_FIXNUM);
86
86
  Check_Type(rsamples, T_ARRAY);
data/ext/audio/option.c CHANGED
@@ -4,10 +4,6 @@
4
4
  #include <errno.h>
5
5
  #include "cao.h"
6
6
 
7
- VALUE cAudio;
8
- VALUE cAO_Info;
9
- VALUE cAO_eUnknownError;
10
-
11
7
  /*
12
8
  引数に設定されたサンプルフォーマットをao_sample_format構造体に設定する。
13
9
  成功したらao_sample_format構造体へのポインタを返す。
@@ -17,7 +13,6 @@ set_format(VALUE bits, VALUE rate, VALUE channels,
17
13
  VALUE byte_format, VALUE matrix)
18
14
  {
19
15
  ao_sample_format *format;
20
- size_t len;
21
16
 
22
17
  if ((format = malloc(sizeof(ao_sample_format))) == NULL){
23
18
  rb_raise(cAO_eUnknownError, "memory allocation failure.");
data/ext/audio/output.c CHANGED
@@ -4,21 +4,10 @@
4
4
  #include <errno.h>
5
5
  #include "cao.h"
6
6
 
7
- VALUE cAudio;
8
7
  VALUE cAO_Live;
9
8
  VALUE cAO_File;
10
- VALUE cAO_Info;
11
9
  VALUE cAO_Mixer;
12
10
  VALUE cAO_DeviceData;
13
- VALUE cAO_eAOError;
14
- VALUE cAO_eDeviceError;
15
- VALUE cAO_eUnknownError;
16
-
17
- VALUE cAO_eNoDriver;
18
- VALUE cAO_eNotFile;
19
- VALUE cAO_eNotLive;
20
- VALUE cAO_eBadOption;
21
- VALUE cAO_eDriverError;
22
11
 
23
12
  VALUE
24
13
  rao_close(VALUE obj)
@@ -82,7 +71,7 @@ Init_outputc(void)
82
71
  * 開いたデバイスに関する基本的な情報を保持するクラス。
83
72
  * ruby側から操作はしない。
84
73
  */
85
- cAO_DeviceData = rb_define_class_under(cAO_Live, "DeviceData", rb_cData);
74
+ cAO_DeviceData = rb_define_class_under(cAO_Live, "DeviceData", rb_cObject);
86
75
 
87
76
  /* library initialize & shutdown */
88
77
  rb_define_private_method(cAO_Live, "initialize", rao_open_live, 8);
data/ext/audio/thread.c CHANGED
@@ -12,7 +12,6 @@
12
12
 
13
13
  void *
14
14
  thread_player(void *val){
15
- queue res;
16
15
  ao_struct *aos = val;
17
16
  sample_t *sample;
18
17
  struct timespec tout = {0, 1000000};
@@ -48,29 +47,10 @@ thread_player(void *val){
48
47
  assert(pthread_mutex_lock(&aos->mutex) == 0);
49
48
  if (aos->status == 2){
50
49
  aos->status = 1;
51
- assert(pthread_mutex_unlock(&aos->mutex) == 0);
52
- break;
53
50
  }
54
51
  assert(pthread_mutex_unlock(&aos->mutex) == 0);
55
52
  }
56
53
 
57
- while ((sample = dequeue(aos)) != NULL){
58
- free(sample->buffer);
59
- free(sample);
60
- }
61
- if (aos->device != NULL){
62
- ao_close(aos->device);
63
- }
64
- if (aos->option != NULL){
65
- ao_free_options(aos->option);
66
- }
67
- if (aos->format != NULL){
68
- free_format(aos->format);
69
- }
70
- aos->device = NULL;
71
- aos->option = NULL;
72
- aos->format = NULL;
73
- aos->queue = NULL;
74
54
  assert(pthread_mutex_lock(&aos->mutex) == 0);
75
55
  aos->status = -1;
76
56
  assert(pthread_mutex_unlock(&aos->mutex) == 0);
@@ -79,7 +59,7 @@ thread_player(void *val){
79
59
 
80
60
  ao_struct *
81
61
  create_thread(ao_struct *aos){
82
- aos->thread = 1;
62
+ aos->tmode = 1;
83
63
  assert(pthread_mutex_init(&aos->mutex, NULL) == 0);
84
64
  assert(pthread_cond_init(&aos->cond, NULL) == 0);
85
65
  assert(pthread_create(&aos->thread, NULL,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ao
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akito Miura
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-18 00:00:00.000000000 Z
11
+ date: 2022-06-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: simple & cross platform audio output library(libao binding http://http://xiph.org/ao/)
14
14
  email: phenomer@g.hachune.net
@@ -59,7 +59,7 @@ homepage: http://bitbucket.org/phenomer/ruby-ao
59
59
  licenses:
60
60
  - MIT
61
61
  metadata: {}
62
- post_install_message:
62
+ post_install_message:
63
63
  rdoc_options:
64
64
  - "-m README.rdoc"
65
65
  require_paths:
@@ -68,16 +68,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - ">="
70
70
  - !ruby/object:Gem::Version
71
- version: 2.4.0
71
+ version: 2.7.0
72
72
  required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubyforge_project:
79
- rubygems_version: 2.7.3
80
- signing_key:
78
+ rubygems_version: 3.3.3
79
+ signing_key:
81
80
  specification_version: 4
82
81
  summary: simple & cross platform audio output library
83
82
  test_files: []