Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
34bd1747
Commit
34bd1747
authored
Apr 16, 2008
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Timer removed in ALSA
parent
5bf259ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
38 deletions
+44
-38
xtt/lib/xtt/src/xtt_audio.cpp
xtt/lib/xtt/src/xtt_audio.cpp
+44
-38
No files found.
xtt/lib/xtt/src/xtt_audio.cpp
View file @
34bd1747
...
...
@@ -460,46 +460,52 @@ void XttAudio::audio_write( void *data)
printf
(
"Write idx: %d totsize: %d size: %d
\n
"
,
audio
->
write_buffer_idx
,
audio
->
write_buffer_size
,
size
);
snd_pcm_prepare
(
audio
->
ALSA_handle
);
rc
=
snd_pcm_writei
(
audio
->
ALSA_handle
,
&
audio
->
write_buffer
[
audio
->
write_buffer_idx
],
for
(;;)
{
rc
=
snd_pcm_writei
(
audio
->
ALSA_handle
,
&
audio
->
write_buffer
[
audio
->
write_buffer_idx
],
size
/
2
);
if
(
rc
==
-
EPIPE
)
{
// EPIPE means underrun
fprintf
(
stderr
,
"ALSA audio underrun occurred
\n
"
);
int
time
=
20
;
audio
->
timerid
->
add
(
time
,
audio_write
,
audio
);
return
;
// snd_pcm_prepare( audio->ALSA_handle);
}
else
if
(
rc
<
0
)
{
printf
(
"ALSA audio error from writei:%s
\n
"
,
snd_strerror
(
rc
));
snd_pcm_close
(
audio
->
ALSA_handle
);
free
(
audio
->
write_buffer
);
audio
->
write_buffer
=
0
;
return
;
}
else
if
(
rc
!=
size
/
2
)
{
fprintf
(
stderr
,
"ALSA audio short write, write %d frames
\n
"
,
rc
);
}
audio
->
write_buffer_idx
+=
size
;
if
(
audio
->
write_buffer_idx
<
audio
->
write_buffer_size
)
{
// Submit next write
int
time
=
1000
*
size
/
2
/
srate
;
audio
->
timerid
->
add
(
time
,
audio_write
,
audio
);
}
else
{
// Free buffer
free
(
audio
->
write_buffer
);
audio
->
write_buffer
=
0
;
// Process next on queue
if
(
audio
->
queue_cnt
)
{
pwr_tAttrRef
aref
=
audio
->
queue
[
0
];
for
(
int
i
=
0
;
i
<
audio
->
queue_cnt
-
1
;
i
++
)
audio
->
queue
[
i
]
=
audio
->
queue
[
i
+
1
];
audio
->
queue_cnt
--
;
audio
->
beep
(
&
aref
);
if
(
rc
==
-
EPIPE
)
{
// EPIPE means underrun
fprintf
(
stderr
,
"ALSA audio underrun occurred
\n
"
);
int
time
=
20
;
audio
->
timerid
->
add
(
time
,
audio_write
,
audio
);
return
;
// snd_pcm_prepare( audio->ALSA_handle);
}
else
if
(
rc
<
0
)
{
printf
(
"ALSA audio error from writei:%s
\n
"
,
snd_strerror
(
rc
));
snd_pcm_close
(
audio
->
ALSA_handle
);
free
(
audio
->
write_buffer
);
audio
->
write_buffer
=
0
;
return
;
}
else
if
(
rc
!=
size
/
2
)
{
fprintf
(
stderr
,
"ALSA audio short write, write %d frames
\n
"
,
rc
);
}
audio
->
write_buffer_idx
+=
size
;
if
(
audio
->
write_buffer_idx
<
audio
->
write_buffer_size
)
{
// Submit next write
#if 0
int time = 1000 * size/2 / srate;
audio->timerid->add( time, audio_write, audio);
#endif
}
else
{
// Free buffer
free
(
audio
->
write_buffer
);
audio
->
write_buffer
=
0
;
// Process next on queue
if
(
audio
->
queue_cnt
)
{
pwr_tAttrRef
aref
=
audio
->
queue
[
0
];
for
(
int
i
=
0
;
i
<
audio
->
queue_cnt
-
1
;
i
++
)
audio
->
queue
[
i
]
=
audio
->
queue
[
i
+
1
];
audio
->
queue_cnt
--
;
audio
->
beep
(
&
aref
);
}
snd_pcm_drain
(
audio
->
ALSA_handle
);
break
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment