hornetseye-alsa 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/ext/alsaoutput.cc +24 -11
- metadata +3 -3
data/Rakefile
CHANGED
data/ext/alsaoutput.cc
CHANGED
@@ -83,10 +83,16 @@ void AlsaOutput::write( SequencePtr frame ) throw (Error)
|
|
83
83
|
{
|
84
84
|
ERRORMACRO( m_pcmHandle != NULL, Error, , "PCM device \"" << m_pcmName
|
85
85
|
<< "\" is not open. Did you call \"close\" before?" );
|
86
|
-
int
|
87
|
-
|
88
|
-
|
89
|
-
|
86
|
+
int n = frame->size() / ( 2 * m_channels );
|
87
|
+
int err;
|
88
|
+
while ( ( err = snd_pcm_writei( m_pcmHandle, (short int *)frame->data(),
|
89
|
+
n ) ) < 0 ) {
|
90
|
+
err = snd_pcm_recover( m_pcmHandle, err, 1 );
|
91
|
+
ERRORMACRO( err >= 0, Error, , "Error writing audio frames to PCM device \""
|
92
|
+
<< m_pcmName << "\": " << snd_strerror( err ) );
|
93
|
+
};
|
94
|
+
ERRORMACRO( n == err, Error, , "Only managed to write " << err << " of " << n
|
95
|
+
<< " frames to PCM device \"" << m_pcmName << "\"" );
|
90
96
|
}
|
91
97
|
|
92
98
|
void AlsaOutput::drop(void) throw (Error)
|
@@ -122,10 +128,14 @@ int AlsaOutput::avail(void) throw (Error)
|
|
122
128
|
{
|
123
129
|
ERRORMACRO( m_pcmHandle != NULL, Error, , "PCM device \"" << m_pcmName
|
124
130
|
<< "\" is not open. Did you call \"close\" before?" );
|
125
|
-
snd_pcm_sframes_t frames
|
126
|
-
|
131
|
+
snd_pcm_sframes_t frames;
|
132
|
+
int err = 0;
|
133
|
+
while ( ( frames = snd_pcm_avail( m_pcmHandle ) ) < 0 ) {
|
134
|
+
err = snd_pcm_recover( m_pcmHandle, frames, 1 );
|
135
|
+
ERRORMACRO( err >= 0, Error, , "Error querying number of available frames for "
|
127
136
|
"update of PCM device \"" << m_pcmName << "\": "
|
128
|
-
<< snd_strerror(
|
137
|
+
<< snd_strerror( err ) );
|
138
|
+
};
|
129
139
|
return frames;
|
130
140
|
}
|
131
141
|
|
@@ -134,10 +144,13 @@ int AlsaOutput::delay(void) throw (Error)
|
|
134
144
|
ERRORMACRO( m_pcmHandle != NULL, Error, , "PCM device \"" << m_pcmName
|
135
145
|
<< "\" is not open. Did you call \"close\" before?" );
|
136
146
|
snd_pcm_sframes_t frames;
|
137
|
-
int err
|
138
|
-
|
139
|
-
|
140
|
-
|
147
|
+
int err;
|
148
|
+
while ( ( err = snd_pcm_delay( m_pcmHandle, &frames ) ) < 0 ) {
|
149
|
+
err = snd_pcm_recover( m_pcmHandle, err, 1 );
|
150
|
+
ERRORMACRO( err >= 0, Error, , "Error querying number of available frames for "
|
151
|
+
"update of PCM device \"" << m_pcmName << "\": "
|
152
|
+
<< snd_strerror( err ) );
|
153
|
+
};
|
141
154
|
return frames;
|
142
155
|
}
|
143
156
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jan Wedekind
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-21 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|