hornetseye-alsa 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/ext/alsaoutput.cc +5 -25
  3. data/ext/alsaoutput.hh +0 -2
  4. metadata +4 -4
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/loaders/makefile'
7
7
  require 'rbconfig'
8
8
 
9
9
  PKG_NAME = 'hornetseye-alsa'
10
- PKG_VERSION = '1.1.1'
10
+ PKG_VERSION = '1.1.2'
11
11
  CFG = RbConfig::CONFIG
12
12
  CXX = ENV[ 'CXX' ] || 'g++'
13
13
  RB_FILES = FileList[ 'lib/**/*.rb' ]
data/ext/alsaoutput.cc CHANGED
@@ -29,7 +29,7 @@ AlsaOutput::AlsaOutput(const string &pcmName, unsigned int rate,
29
29
  snd_pcm_hw_params_t *hwParams;
30
30
  snd_pcm_hw_params_alloca(&hwParams);
31
31
  int err = snd_pcm_open(&m_pcmHandle, m_pcmName.c_str(), SND_PCM_STREAM_PLAYBACK,
32
- 0);//SND_PCM_NONBLOCK);
32
+ SND_PCM_NONBLOCK);
33
33
  ERRORMACRO(err >= 0, Error, , "Error opening PCM device \"" << m_pcmName
34
34
  << "\": " << snd_strerror(err));
35
35
  err = snd_pcm_hw_params_any(m_pcmHandle, hwParams);
@@ -145,17 +145,6 @@ void AlsaOutput::drain(void) throw (Error)
145
145
  snd_pcm_drain(m_pcmHandle);
146
146
  }
147
147
 
148
- void AlsaOutput::prepare(void) throw (Error)
149
- {
150
- ERRORMACRO( m_pcmHandle != NULL, Error, , "PCM device \"" << m_pcmName
151
- << "\" is not open. Did you call \"close\" before?" );
152
-
153
- int err = snd_pcm_prepare( m_pcmHandle );
154
- ERRORMACRO( err >= 0, Error, , "Error preparing PCM device \"" << m_pcmName
155
- << "\": " << snd_strerror( err ) );
156
- // pthread_mutex_lock( &m_mutex );
157
- }
158
-
159
148
  unsigned int AlsaOutput::rate(void)
160
149
  {
161
150
  return m_rate;
@@ -214,7 +203,10 @@ void AlsaOutput::writei(short int *data, int count) throw (Error)
214
203
  {
215
204
  int err;
216
205
  while ((err = snd_pcm_writei(m_pcmHandle, data, count)) < 0) {
217
- err = snd_pcm_recover(m_pcmHandle, err, 1);
206
+ if (err == -EBADFD)
207
+ err = snd_pcm_prepare(m_pcmHandle);
208
+ else
209
+ err = snd_pcm_recover(m_pcmHandle, err, 1);
218
210
  ERRORMACRO(err >= 0, Error, , "Error writing audio frames to PCM device \""
219
211
  << m_pcmName << "\": " << snd_strerror(err));
220
212
  };
@@ -265,7 +257,6 @@ VALUE AlsaOutput::registerRubyClass( VALUE rbModule )
265
257
  rb_define_method( cRubyClass, "write", RUBY_METHOD_FUNC( wrapWrite ), 1 );
266
258
  rb_define_method( cRubyClass, "drop", RUBY_METHOD_FUNC( wrapDrop ), 0 );
267
259
  rb_define_method( cRubyClass, "drain", RUBY_METHOD_FUNC( wrapDrain ), 0 );
268
- rb_define_method( cRubyClass, "prepare", RUBY_METHOD_FUNC( wrapPrepare ), 0 );
269
260
  rb_define_method( cRubyClass, "rate", RUBY_METHOD_FUNC( wrapRate ), 0 );
270
261
  rb_define_method( cRubyClass, "channels", RUBY_METHOD_FUNC( wrapChannels ), 0 );
271
262
  rb_define_method( cRubyClass, "delay", RUBY_METHOD_FUNC( wrapDelay ), 0 );
@@ -332,17 +323,6 @@ VALUE AlsaOutput::wrapDrain( VALUE rbSelf )
332
323
  return rbSelf;
333
324
  }
334
325
 
335
- VALUE AlsaOutput::wrapPrepare( VALUE rbSelf )
336
- {
337
- try {
338
- AlsaOutputPtr *self; Data_Get_Struct( rbSelf, AlsaOutputPtr, self );
339
- (*self)->prepare();
340
- } catch ( exception &e ) {
341
- rb_raise( rb_eRuntimeError, "%s", e.what() );
342
- };
343
- return rbSelf;
344
- }
345
-
346
326
  VALUE AlsaOutput::wrapRate( VALUE rbSelf )
347
327
  {
348
328
  AlsaOutputPtr *self; Data_Get_Struct( rbSelf, AlsaOutputPtr, self );
data/ext/alsaoutput.hh CHANGED
@@ -32,7 +32,6 @@ public:
32
32
  void write( SequencePtr sequence ) throw (Error);
33
33
  void drop(void) throw (Error);
34
34
  void drain(void) throw (Error);
35
- void prepare(void) throw (Error);
36
35
  unsigned int rate(void);
37
36
  unsigned int channels(void);
38
37
  int delay(void) throw (Error);
@@ -47,7 +46,6 @@ public:
47
46
  static VALUE wrapWrite( VALUE rbSelf, VALUE rbSequence );
48
47
  static VALUE wrapDrop( VALUE rbSelf );
49
48
  static VALUE wrapDrain( VALUE rbSelf );
50
- static VALUE wrapPrepare( VALUE rbSelf );
51
49
  static VALUE wrapRate( VALUE rbSelf );
52
50
  static VALUE wrapChannels( VALUE rbSelf );
53
51
  static VALUE wrapDelay( VALUE rbSelf );
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hornetseye-alsa
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 1
10
- version: 1.1.1
9
+ - 2
10
+ version: 1.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jan Wedekind
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-13 00:00:00 Z
18
+ date: 2012-11-14 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: malloc