mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-26 07:13:49 +01:00
Remove some old erratta, and do a major tidy up of line endings and properties on source files
This commit is contained in:
@@ -1,43 +1,43 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="PortAudio Docs, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Docs</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Documentation</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<p>Copyright 2000 Phil Burk and Ross Bencina
|
||||
<h2>
|
||||
<a href="pa_tutorial.html">Tutorial</a></h2>
|
||||
|
||||
<blockquote>Describes how to write audio programs using the PortAudio API.</blockquote>
|
||||
|
||||
<h2>
|
||||
<a href="pa_impl_guide.html">Implementation Guide</a></h2>
|
||||
|
||||
<blockquote>Describes how to write an implementation of PortAudio for a
|
||||
new computer platform.</blockquote>
|
||||
|
||||
<h2>
|
||||
<a href="portaudio_icmc2001.pdf">Paper Presented at ICMC2001</a> (PDF)</h2>
|
||||
|
||||
<blockquote>Describes the PortAudio API and discusses implementation issues.
|
||||
Written July 2001.</blockquote>
|
||||
|
||||
<p><br><a href="http://www.portaudio.com/">Return to PortAudio Home Page</a>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="PortAudio Docs, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Docs</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Documentation</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<p>Copyright 2000 Phil Burk and Ross Bencina
|
||||
<h2>
|
||||
<a href="pa_tutorial.html">Tutorial</a></h2>
|
||||
|
||||
<blockquote>Describes how to write audio programs using the PortAudio API.</blockquote>
|
||||
|
||||
<h2>
|
||||
<a href="pa_impl_guide.html">Implementation Guide</a></h2>
|
||||
|
||||
<blockquote>Describes how to write an implementation of PortAudio for a
|
||||
new computer platform.</blockquote>
|
||||
|
||||
<h2>
|
||||
<a href="portaudio_icmc2001.pdf">Paper Presented at ICMC2001</a> (PDF)</h2>
|
||||
|
||||
<blockquote>Describes the PortAudio API and discusses implementation issues.
|
||||
Written July 2001.</blockquote>
|
||||
|
||||
<p><br><a href="http://www.portaudio.com/">Return to PortAudio Home Page</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,196 +1,196 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.75 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Internal docs. How a stream is started or stopped.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Implementation - Start/Stop</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Implementation Guide</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<p>This document describes how to implement the PortAudio API on a new
|
||||
computer platform. Implementing PortAudio on a new platform, makes it possible
|
||||
to port many existing audio applications to that platform.
|
||||
<p>By Phil Burk
|
||||
<br>Copyright 2000 Phil Burk and Ross Bencina
|
||||
<p>Note that the license says: <b>"Any person wishing to distribute modifications
|
||||
to the Software is requested to send the modifications to the original
|
||||
developer so that they can be incorporated into the canonical version."</b>.
|
||||
So when you have finished a new implementation, please send it back to
|
||||
us at "<a href="http://www.portaudio.com">http://www.portaudio.com</a>"
|
||||
so that we can make it available for other users. Thank you!
|
||||
<h2>
|
||||
Download the Latest PortAudio Implementation</h2>
|
||||
Always start with the latest implementation available at "<a href="http://www.portaudio.com">http://www.portaudio.com</a>".
|
||||
<h2>
|
||||
Select an Existing Implementation as a Basis</h2>
|
||||
The fastest way to get started is to take an existing implementation and
|
||||
translate it for your new platform. Choose an implementation whose architecture
|
||||
is as close as possible to your target.
|
||||
<ul>
|
||||
<li>
|
||||
DirectSound Implementation - pa_win_ds - Uses a timer callback for the
|
||||
background "thread". Polls a circular buffer and writes blocks of data
|
||||
to keep it full.</li>
|
||||
|
||||
<li>
|
||||
Windows MME - pa_win_wmme - Spawns an actual Win32 thread. Writes blocks
|
||||
of data to the HW device and waits for events that signal buffer completion.</li>
|
||||
|
||||
<li>
|
||||
Linux OSS - pa_linux - Spawns a real thread that writes to the "/dev/dsp"
|
||||
stream using blocking I/O calls.</li>
|
||||
</ul>
|
||||
When you write a new implementation, you will be using some code that is
|
||||
in common with all implementations. This code is in the folder "pa_common".
|
||||
It provides various functions such as parameter checking, error code to
|
||||
text conversion, sample format conversion, clipping and dithering, etc.
|
||||
<p>The code that you write will go into a separate folder called "pa_{os}_{api}".
|
||||
For example, code specific to the DirectSound interface for Windows goes
|
||||
in "pa_win_ds".
|
||||
<h2>
|
||||
Read Docs and Code</h2>
|
||||
Famialiarize yourself with the system by reading the documentation provided.
|
||||
here is a suggested order:
|
||||
<ol>
|
||||
<li>
|
||||
User Programming <a href="pa_tutorial.html">Tutorial</a></li>
|
||||
|
||||
<li>
|
||||
Header file "pa_common/portaudio.h" which defines API.</li>
|
||||
|
||||
<li>
|
||||
Header file "pa_common/pa_host.h" for host dependant code. This definces
|
||||
the routine you will need to provide.</li>
|
||||
|
||||
<li>
|
||||
Shared code in "pa_common/pa_lib.c".</li>
|
||||
|
||||
<li>
|
||||
Docs on Implementation of <a href="pa_impl_startstop.html">Start/Stop</a>
|
||||
code.</li>
|
||||
</ol>
|
||||
|
||||
<h2>
|
||||
Implement Output to Default Device</h2>
|
||||
Now we are ready to crank some code. For instant gratification, let's try
|
||||
to play a sine wave.
|
||||
<ol>
|
||||
<li>
|
||||
Link the test program "pa_tests/patest_sine.c" with the file "pa_lib.c"
|
||||
and the implementation specific file you are creating.</li>
|
||||
|
||||
<li>
|
||||
For now, just stub out the device query code and the audio input code.</li>
|
||||
|
||||
<li>
|
||||
Modify PaHost_OpenStream() to open your default target device and get everything
|
||||
setup.</li>
|
||||
|
||||
<li>
|
||||
Modify PaHost_StartOutput() to start playing audio.</li>
|
||||
|
||||
<li>
|
||||
Modify PaHost_StopOutput() to stop audio.</li>
|
||||
|
||||
<li>
|
||||
Modify PaHost_CloseStream() to clean up. Free all memory that you allocated
|
||||
in PaHost_OpenStream().</li>
|
||||
|
||||
<li>
|
||||
Keep cranking until you can play a sine wave using "patest_sine.c".</li>
|
||||
|
||||
<li>
|
||||
Once that works, try "patest_pink.c", "patest_clip.c", "patest_sine8.c".</li>
|
||||
|
||||
<li>
|
||||
To test your Open and Close code, try "patest_many.c".</li>
|
||||
|
||||
<li>
|
||||
Now test to make sure that the three modes of stopping are properly supported
|
||||
by running "patest_stop.c".</li>
|
||||
|
||||
<li>
|
||||
Test your implementation of time stamping with "patest_sync.c".</li>
|
||||
</ol>
|
||||
|
||||
<h2>
|
||||
Implement Device Queries</h2>
|
||||
Now that output is working, lets implement the code for querying what devices
|
||||
are available to the user. Run "pa_tests/pa_devs.c". It should print all
|
||||
of the devices available and their characteristics.
|
||||
<h2>
|
||||
Implement Input</h2>
|
||||
Implement audio input and test it with:
|
||||
<ol>
|
||||
<li>
|
||||
patest_record.c - record in half duplex, play back as recorded.</li>
|
||||
|
||||
<li>
|
||||
patest_wire.c - full duplex, copies input to output. Note that some HW
|
||||
may not support full duplex.</li>
|
||||
|
||||
<li>
|
||||
patest_fuzz.c - plug in your guitar and get a feel for why latency is an
|
||||
important issue in computer music.</li>
|
||||
|
||||
<li>
|
||||
paqa_devs.c - try to open every device and use it with every possible format</li>
|
||||
</ol>
|
||||
|
||||
<h2>
|
||||
Debugging Tools</h2>
|
||||
You generally cannot use printf() calls to debug real-time processes because
|
||||
they disturb the timing. Also calling printf() from your background thread
|
||||
or interrupt could crash the machine. So PA includes a tool for capturing
|
||||
events and storing the information while it is running. It then prints
|
||||
the events when Pa_Terminate() is called.
|
||||
<ol>
|
||||
<li>
|
||||
To enable trace mode, change TRACE_REALTIME_EVENTS in "pa_common/pa_trace.h"
|
||||
from a (0) to a (1).</li>
|
||||
|
||||
<li>
|
||||
Link with "pa_common/pa_trace.c".</li>
|
||||
|
||||
<li>
|
||||
Add trace messages to your code by calling:<br>
|
||||
<tt> void AddTraceMessage( char *msg, int data );<br>
|
||||
for example<br>
|
||||
AddTraceMessage("Pa_TimeSlice: past_NumCallbacks ", past->past_NumCallbacks
|
||||
);</tt></li>
|
||||
|
||||
<li>
|
||||
Run your program. You will get a dump of events at the end.</li>
|
||||
|
||||
<li>
|
||||
You can leave the trace messages in your code. They will turn to NOOPs
|
||||
when you change TRACE_REALTIME_EVENTS back to (0).</li>
|
||||
</ol>
|
||||
|
||||
<h2>
|
||||
Delivery</h2>
|
||||
Please send your new code along with notes on the implementation back to
|
||||
us at "<a href="http://www.portaudio.com">http://www.portaudio.com</a>".
|
||||
We will review the implementation and post it with your name. If you had
|
||||
to make any modifications to the code in "pa_common" or "pa_tests" <b>please</b>
|
||||
send us those modifications and your notes. We will try to merge your changes
|
||||
so that the "pa_common" code works with <b>all</b> implementations.
|
||||
<p>If you have suggestions for how to make future implementations easier,
|
||||
please let us know.
|
||||
<br>THANKS!
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.75 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Internal docs. How a stream is started or stopped.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Implementation - Start/Stop</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Implementation Guide</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<p>This document describes how to implement the PortAudio API on a new
|
||||
computer platform. Implementing PortAudio on a new platform, makes it possible
|
||||
to port many existing audio applications to that platform.
|
||||
<p>By Phil Burk
|
||||
<br>Copyright 2000 Phil Burk and Ross Bencina
|
||||
<p>Note that the license says: <b>"Any person wishing to distribute modifications
|
||||
to the Software is requested to send the modifications to the original
|
||||
developer so that they can be incorporated into the canonical version."</b>.
|
||||
So when you have finished a new implementation, please send it back to
|
||||
us at "<a href="http://www.portaudio.com">http://www.portaudio.com</a>"
|
||||
so that we can make it available for other users. Thank you!
|
||||
<h2>
|
||||
Download the Latest PortAudio Implementation</h2>
|
||||
Always start with the latest implementation available at "<a href="http://www.portaudio.com">http://www.portaudio.com</a>".
|
||||
<h2>
|
||||
Select an Existing Implementation as a Basis</h2>
|
||||
The fastest way to get started is to take an existing implementation and
|
||||
translate it for your new platform. Choose an implementation whose architecture
|
||||
is as close as possible to your target.
|
||||
<ul>
|
||||
<li>
|
||||
DirectSound Implementation - pa_win_ds - Uses a timer callback for the
|
||||
background "thread". Polls a circular buffer and writes blocks of data
|
||||
to keep it full.</li>
|
||||
|
||||
<li>
|
||||
Windows MME - pa_win_wmme - Spawns an actual Win32 thread. Writes blocks
|
||||
of data to the HW device and waits for events that signal buffer completion.</li>
|
||||
|
||||
<li>
|
||||
Linux OSS - pa_linux - Spawns a real thread that writes to the "/dev/dsp"
|
||||
stream using blocking I/O calls.</li>
|
||||
</ul>
|
||||
When you write a new implementation, you will be using some code that is
|
||||
in common with all implementations. This code is in the folder "pa_common".
|
||||
It provides various functions such as parameter checking, error code to
|
||||
text conversion, sample format conversion, clipping and dithering, etc.
|
||||
<p>The code that you write will go into a separate folder called "pa_{os}_{api}".
|
||||
For example, code specific to the DirectSound interface for Windows goes
|
||||
in "pa_win_ds".
|
||||
<h2>
|
||||
Read Docs and Code</h2>
|
||||
Famialiarize yourself with the system by reading the documentation provided.
|
||||
here is a suggested order:
|
||||
<ol>
|
||||
<li>
|
||||
User Programming <a href="pa_tutorial.html">Tutorial</a></li>
|
||||
|
||||
<li>
|
||||
Header file "pa_common/portaudio.h" which defines API.</li>
|
||||
|
||||
<li>
|
||||
Header file "pa_common/pa_host.h" for host dependant code. This definces
|
||||
the routine you will need to provide.</li>
|
||||
|
||||
<li>
|
||||
Shared code in "pa_common/pa_lib.c".</li>
|
||||
|
||||
<li>
|
||||
Docs on Implementation of <a href="pa_impl_startstop.html">Start/Stop</a>
|
||||
code.</li>
|
||||
</ol>
|
||||
|
||||
<h2>
|
||||
Implement Output to Default Device</h2>
|
||||
Now we are ready to crank some code. For instant gratification, let's try
|
||||
to play a sine wave.
|
||||
<ol>
|
||||
<li>
|
||||
Link the test program "pa_tests/patest_sine.c" with the file "pa_lib.c"
|
||||
and the implementation specific file you are creating.</li>
|
||||
|
||||
<li>
|
||||
For now, just stub out the device query code and the audio input code.</li>
|
||||
|
||||
<li>
|
||||
Modify PaHost_OpenStream() to open your default target device and get everything
|
||||
setup.</li>
|
||||
|
||||
<li>
|
||||
Modify PaHost_StartOutput() to start playing audio.</li>
|
||||
|
||||
<li>
|
||||
Modify PaHost_StopOutput() to stop audio.</li>
|
||||
|
||||
<li>
|
||||
Modify PaHost_CloseStream() to clean up. Free all memory that you allocated
|
||||
in PaHost_OpenStream().</li>
|
||||
|
||||
<li>
|
||||
Keep cranking until you can play a sine wave using "patest_sine.c".</li>
|
||||
|
||||
<li>
|
||||
Once that works, try "patest_pink.c", "patest_clip.c", "patest_sine8.c".</li>
|
||||
|
||||
<li>
|
||||
To test your Open and Close code, try "patest_many.c".</li>
|
||||
|
||||
<li>
|
||||
Now test to make sure that the three modes of stopping are properly supported
|
||||
by running "patest_stop.c".</li>
|
||||
|
||||
<li>
|
||||
Test your implementation of time stamping with "patest_sync.c".</li>
|
||||
</ol>
|
||||
|
||||
<h2>
|
||||
Implement Device Queries</h2>
|
||||
Now that output is working, lets implement the code for querying what devices
|
||||
are available to the user. Run "pa_tests/pa_devs.c". It should print all
|
||||
of the devices available and their characteristics.
|
||||
<h2>
|
||||
Implement Input</h2>
|
||||
Implement audio input and test it with:
|
||||
<ol>
|
||||
<li>
|
||||
patest_record.c - record in half duplex, play back as recorded.</li>
|
||||
|
||||
<li>
|
||||
patest_wire.c - full duplex, copies input to output. Note that some HW
|
||||
may not support full duplex.</li>
|
||||
|
||||
<li>
|
||||
patest_fuzz.c - plug in your guitar and get a feel for why latency is an
|
||||
important issue in computer music.</li>
|
||||
|
||||
<li>
|
||||
paqa_devs.c - try to open every device and use it with every possible format</li>
|
||||
</ol>
|
||||
|
||||
<h2>
|
||||
Debugging Tools</h2>
|
||||
You generally cannot use printf() calls to debug real-time processes because
|
||||
they disturb the timing. Also calling printf() from your background thread
|
||||
or interrupt could crash the machine. So PA includes a tool for capturing
|
||||
events and storing the information while it is running. It then prints
|
||||
the events when Pa_Terminate() is called.
|
||||
<ol>
|
||||
<li>
|
||||
To enable trace mode, change TRACE_REALTIME_EVENTS in "pa_common/pa_trace.h"
|
||||
from a (0) to a (1).</li>
|
||||
|
||||
<li>
|
||||
Link with "pa_common/pa_trace.c".</li>
|
||||
|
||||
<li>
|
||||
Add trace messages to your code by calling:<br>
|
||||
<tt> void AddTraceMessage( char *msg, int data );<br>
|
||||
for example<br>
|
||||
AddTraceMessage("Pa_TimeSlice: past_NumCallbacks ", past->past_NumCallbacks
|
||||
);</tt></li>
|
||||
|
||||
<li>
|
||||
Run your program. You will get a dump of events at the end.</li>
|
||||
|
||||
<li>
|
||||
You can leave the trace messages in your code. They will turn to NOOPs
|
||||
when you change TRACE_REALTIME_EVENTS back to (0).</li>
|
||||
</ol>
|
||||
|
||||
<h2>
|
||||
Delivery</h2>
|
||||
Please send your new code along with notes on the implementation back to
|
||||
us at "<a href="http://www.portaudio.com">http://www.portaudio.com</a>".
|
||||
We will review the implementation and post it with your name. If you had
|
||||
to make any modifications to the code in "pa_common" or "pa_tests" <b>please</b>
|
||||
send us those modifications and your notes. We will try to merge your changes
|
||||
so that the "pa_common" code works with <b>all</b> implementations.
|
||||
<p>If you have suggestions for how to make future implementations easier,
|
||||
please let us know.
|
||||
<br>THANKS!
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,190 +1,190 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.75 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Internal docs. How a stream is started or stopped.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Implementation - Start/Stop</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Implementation</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Starting and Stopping Streams</h2>
|
||||
PortAudio is generally executed in two "threads". The foreground thread
|
||||
is the application thread. The background "thread" may be implemented as
|
||||
an actual thread, an interrupt handler, or a callback from a timer thread.
|
||||
<p>There are three ways that PortAudio can stop a stream. In each case
|
||||
we look at the sequence of events and the messages sent between the two
|
||||
threads. The following variables are contained in the internalPortAudioStream.
|
||||
<blockquote><tt>int past_IsActive;
|
||||
/* Background is still playing. */</tt>
|
||||
<br><tt>int past_StopSoon; /* Stop
|
||||
when last buffer done. */</tt>
|
||||
<br><tt>int past_StopNow; /*
|
||||
Stop IMMEDIATELY. */</tt></blockquote>
|
||||
|
||||
<h3>
|
||||
Pa_AbortStream()</h3>
|
||||
This function causes the background thread to terminate as soon as possible
|
||||
and audio I/O to stop abruptly.
|
||||
<br>
|
||||
<table BORDER COLS=2 WIDTH="60%" >
|
||||
<tr>
|
||||
<td><b>Foreground Thread</b></td>
|
||||
|
||||
<td><b>Background Thread</b></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>sets <tt>StopNow</tt></td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>sees <tt>StopNow</tt>, </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>clears IsActive, stops thread</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>waits for thread to exit</td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>turns off audio I/O</td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>
|
||||
Pa_StopStream()</h3>
|
||||
This function stops the user callback function from being called and then
|
||||
waits for all audio data written to the output buffer to be played. In
|
||||
a system with very low latency, you may not hear any difference between
|
||||
<br>
|
||||
<table BORDER COLS=2 WIDTH="60%" >
|
||||
<tr>
|
||||
<td><b>Foreground Thread</b></td>
|
||||
|
||||
<td><b>Background Thread</b></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>sets StopSoon</td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>stops calling user callback</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>continues until output buffer empty</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>clears IsActive, stops thread</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>waits for thread to exit</td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>turns off audio I/O</td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>
|
||||
User callback returns one.</h3>
|
||||
If the user callback returns one then the user callback function will no
|
||||
longer be called. Audio output will continue until all audio data written
|
||||
to the output buffer has been played. Then the audio I/O is stopped, the
|
||||
background thread terminates, and the stream becomes inactive.
|
||||
<br>
|
||||
<table BORDER COLS=2 WIDTH="60%" >
|
||||
<tr>
|
||||
<td><b>Foreground Thread</b></td>
|
||||
|
||||
<td><b>Background Thread</b></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>callback returns 1</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>sets StopSoon</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>stops calling user callback</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>continues until output buffer empty</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>clears IsActive, stops thread</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>waits for thread to exit</td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>turns off audio I/O</td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.75 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Internal docs. How a stream is started or stopped.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Implementation - Start/Stop</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Implementation</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Starting and Stopping Streams</h2>
|
||||
PortAudio is generally executed in two "threads". The foreground thread
|
||||
is the application thread. The background "thread" may be implemented as
|
||||
an actual thread, an interrupt handler, or a callback from a timer thread.
|
||||
<p>There are three ways that PortAudio can stop a stream. In each case
|
||||
we look at the sequence of events and the messages sent between the two
|
||||
threads. The following variables are contained in the internalPortAudioStream.
|
||||
<blockquote><tt>int past_IsActive;
|
||||
/* Background is still playing. */</tt>
|
||||
<br><tt>int past_StopSoon; /* Stop
|
||||
when last buffer done. */</tt>
|
||||
<br><tt>int past_StopNow; /*
|
||||
Stop IMMEDIATELY. */</tt></blockquote>
|
||||
|
||||
<h3>
|
||||
Pa_AbortStream()</h3>
|
||||
This function causes the background thread to terminate as soon as possible
|
||||
and audio I/O to stop abruptly.
|
||||
<br>
|
||||
<table BORDER COLS=2 WIDTH="60%" >
|
||||
<tr>
|
||||
<td><b>Foreground Thread</b></td>
|
||||
|
||||
<td><b>Background Thread</b></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>sets <tt>StopNow</tt></td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>sees <tt>StopNow</tt>, </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>clears IsActive, stops thread</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>waits for thread to exit</td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>turns off audio I/O</td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>
|
||||
Pa_StopStream()</h3>
|
||||
This function stops the user callback function from being called and then
|
||||
waits for all audio data written to the output buffer to be played. In
|
||||
a system with very low latency, you may not hear any difference between
|
||||
<br>
|
||||
<table BORDER COLS=2 WIDTH="60%" >
|
||||
<tr>
|
||||
<td><b>Foreground Thread</b></td>
|
||||
|
||||
<td><b>Background Thread</b></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>sets StopSoon</td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>stops calling user callback</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>continues until output buffer empty</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>clears IsActive, stops thread</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>waits for thread to exit</td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>turns off audio I/O</td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>
|
||||
User callback returns one.</h3>
|
||||
If the user callback returns one then the user callback function will no
|
||||
longer be called. Audio output will continue until all audio data written
|
||||
to the output buffer has been played. Then the audio I/O is stopped, the
|
||||
background thread terminates, and the stream becomes inactive.
|
||||
<br>
|
||||
<table BORDER COLS=2 WIDTH="60%" >
|
||||
<tr>
|
||||
<td><b>Foreground Thread</b></td>
|
||||
|
||||
<td><b>Background Thread</b></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>callback returns 1</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>sets StopSoon</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>stops calling user callback</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>continues until output buffer empty</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td>clears IsActive, stops thread</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>waits for thread to exit</td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>turns off audio I/O</td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,55 +1,55 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Compiling for ASIO (Windows or Macintosh)</h2>
|
||||
|
||||
<blockquote>ASIO is a low latency audio API from Steinberg. To compile
|
||||
an ASIO application, you must first <a href="http://www.steinberg.net/developers/ASIO2SDKAbout.phtml">download
|
||||
the ASIO SDK</a> from Steinberg. You also need to obtain ASIO drivers for
|
||||
your audio device.
|
||||
<p>Note: I am using '/' as a file separator below. On Macintosh replace
|
||||
'/' with ':'. On Windows, replace '/' with '\'.
|
||||
<p> To use ASIO with the PortAudio library add the following source
|
||||
files to your project:
|
||||
<blockquote>
|
||||
<pre>pa_asio/pa_asio.cpp</pre>
|
||||
</blockquote>
|
||||
and also these files from the ASIO SDK:
|
||||
<blockquote>
|
||||
<pre>common/asio.cpp
|
||||
host/asiodrivers.cpp
|
||||
host/asiolist.cpp</pre>
|
||||
</blockquote>
|
||||
and add these directories to the path for include files
|
||||
<blockquote>
|
||||
<pre>asiosdk2/host/pc (for Windows)
|
||||
asiosdk2/common
|
||||
asiosdk2/host</pre>
|
||||
</blockquote>
|
||||
You may try compiling the "pa_tests/patest_saw.c" file first because it
|
||||
is the simplest.</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_over.html">previous</a> | <a href="pa_tut_callback.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Compiling for ASIO (Windows or Macintosh)</h2>
|
||||
|
||||
<blockquote>ASIO is a low latency audio API from Steinberg. To compile
|
||||
an ASIO application, you must first <a href="http://www.steinberg.net/developers/ASIO2SDKAbout.phtml">download
|
||||
the ASIO SDK</a> from Steinberg. You also need to obtain ASIO drivers for
|
||||
your audio device.
|
||||
<p>Note: I am using '/' as a file separator below. On Macintosh replace
|
||||
'/' with ':'. On Windows, replace '/' with '\'.
|
||||
<p> To use ASIO with the PortAudio library add the following source
|
||||
files to your project:
|
||||
<blockquote>
|
||||
<pre>pa_asio/pa_asio.cpp</pre>
|
||||
</blockquote>
|
||||
and also these files from the ASIO SDK:
|
||||
<blockquote>
|
||||
<pre>common/asio.cpp
|
||||
host/asiodrivers.cpp
|
||||
host/asiolist.cpp</pre>
|
||||
</blockquote>
|
||||
and add these directories to the path for include files
|
||||
<blockquote>
|
||||
<pre>asiosdk2/host/pc (for Windows)
|
||||
asiosdk2/common
|
||||
asiosdk2/host</pre>
|
||||
</blockquote>
|
||||
You may try compiling the "pa_tests/patest_saw.c" file first because it
|
||||
is the simplest.</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_over.html">previous</a> | <a href="pa_tut_callback.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,91 +1,91 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Writing a Callback Function</h2>
|
||||
|
||||
<blockquote>To write a program using PortAudio, you must include the "portaudio.h"
|
||||
include file. You may wish to read "<a href="portaudio_h.txt">portaudio.h</a>"
|
||||
because it contains a complete description of the PortAudio functions and
|
||||
constants.
|
||||
<blockquote>
|
||||
<pre>#include "portaudio.h"</pre>
|
||||
</blockquote>
|
||||
The next task is to write your custom callback function. It is a function
|
||||
that is called by the PortAudio engine whenever it has captured audio data,
|
||||
or when it needs more audio data for output.
|
||||
<p>Your callback function is often called by an interrupt, or low level
|
||||
process so you should not do any complex system activities like allocating
|
||||
memory, or reading or writing files, or printf(). Just crunch numbers and
|
||||
generate audio signals. What is safe or not safe will vary from platform
|
||||
to platform. On the Macintosh, for example, you can only call "interrupt
|
||||
safe" routines. Also do not call any PortAudio functions in the callback
|
||||
except for Pa_StreamTime() and Pa_GetCPULoad().
|
||||
<p>Your callback function must return an int and accept the exact parameters
|
||||
specified in this typedef:
|
||||
<blockquote>
|
||||
<pre>typedef int (PortAudioCallback)(
|
||||
void *inputBuffer, void *outputBuffer,
|
||||
unsigned long framesPerBuffer,
|
||||
PaTimestamp outTime, void *userData );</pre>
|
||||
</blockquote>
|
||||
Here is an example callback function from the test file "patests/patest_saw.c".
|
||||
It calculates a simple left and right sawtooth signal and writes it to
|
||||
the output buffer. Notice that in this example, the signals are of <tt>float</tt>
|
||||
data type. The signals must be between -1.0 and +1.0. You can also use
|
||||
16 bit integers or other formats which are specified during setup. You
|
||||
can pass a pointer to your data structure through PortAudio which will
|
||||
appear as <tt>userData</tt>.
|
||||
<blockquote>
|
||||
<pre>int patestCallback( void *inputBuffer, void *outputBuffer,
|
||||
unsigned long framesPerBuffer,
|
||||
PaTimestamp outTime, void *userData )
|
||||
{
|
||||
unsigned int i;
|
||||
/* Cast data passed through stream to our structure type. */
|
||||
paTestData *data = (paTestData*)userData;
|
||||
float *out = (float*)outputBuffer;
|
||||
|
||||
for( i=0; i<framesPerBuffer; i++ )
|
||||
{
|
||||
/* Stereo channels are interleaved. */
|
||||
*out++ = data->left_phase; /* left */
|
||||
*out++ = data->right_phase; /* right */
|
||||
|
||||
/* Generate simple sawtooth phaser that ranges between -1.0 and 1.0. */
|
||||
data->left_phase += 0.01f;
|
||||
/* When signal reaches top, drop back down. */
|
||||
if( data->left_phase >= 1.0f ) data->left_phase -= 2.0f;
|
||||
|
||||
/* higher pitch so we can distinguish left and right. */
|
||||
data->right_phase += 0.03f;
|
||||
if( data->right_phase >= 1.0f ) data->right_phase -= 2.0f;
|
||||
}
|
||||
return 0;
|
||||
}</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_over.html">previous</a> | <a href="pa_tut_init.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Writing a Callback Function</h2>
|
||||
|
||||
<blockquote>To write a program using PortAudio, you must include the "portaudio.h"
|
||||
include file. You may wish to read "<a href="portaudio_h.txt">portaudio.h</a>"
|
||||
because it contains a complete description of the PortAudio functions and
|
||||
constants.
|
||||
<blockquote>
|
||||
<pre>#include "portaudio.h"</pre>
|
||||
</blockquote>
|
||||
The next task is to write your custom callback function. It is a function
|
||||
that is called by the PortAudio engine whenever it has captured audio data,
|
||||
or when it needs more audio data for output.
|
||||
<p>Your callback function is often called by an interrupt, or low level
|
||||
process so you should not do any complex system activities like allocating
|
||||
memory, or reading or writing files, or printf(). Just crunch numbers and
|
||||
generate audio signals. What is safe or not safe will vary from platform
|
||||
to platform. On the Macintosh, for example, you can only call "interrupt
|
||||
safe" routines. Also do not call any PortAudio functions in the callback
|
||||
except for Pa_StreamTime() and Pa_GetCPULoad().
|
||||
<p>Your callback function must return an int and accept the exact parameters
|
||||
specified in this typedef:
|
||||
<blockquote>
|
||||
<pre>typedef int (PortAudioCallback)(
|
||||
void *inputBuffer, void *outputBuffer,
|
||||
unsigned long framesPerBuffer,
|
||||
PaTimestamp outTime, void *userData );</pre>
|
||||
</blockquote>
|
||||
Here is an example callback function from the test file "patests/patest_saw.c".
|
||||
It calculates a simple left and right sawtooth signal and writes it to
|
||||
the output buffer. Notice that in this example, the signals are of <tt>float</tt>
|
||||
data type. The signals must be between -1.0 and +1.0. You can also use
|
||||
16 bit integers or other formats which are specified during setup. You
|
||||
can pass a pointer to your data structure through PortAudio which will
|
||||
appear as <tt>userData</tt>.
|
||||
<blockquote>
|
||||
<pre>int patestCallback( void *inputBuffer, void *outputBuffer,
|
||||
unsigned long framesPerBuffer,
|
||||
PaTimestamp outTime, void *userData )
|
||||
{
|
||||
unsigned int i;
|
||||
/* Cast data passed through stream to our structure type. */
|
||||
paTestData *data = (paTestData*)userData;
|
||||
float *out = (float*)outputBuffer;
|
||||
|
||||
for( i=0; i<framesPerBuffer; i++ )
|
||||
{
|
||||
/* Stereo channels are interleaved. */
|
||||
*out++ = data->left_phase; /* left */
|
||||
*out++ = data->right_phase; /* right */
|
||||
|
||||
/* Generate simple sawtooth phaser that ranges between -1.0 and 1.0. */
|
||||
data->left_phase += 0.01f;
|
||||
/* When signal reaches top, drop back down. */
|
||||
if( data->left_phase >= 1.0f ) data->left_phase -= 2.0f;
|
||||
|
||||
/* higher pitch so we can distinguish left and right. */
|
||||
data->right_phase += 0.03f;
|
||||
if( data->right_phase >= 1.0f ) data->right_phase -= 2.0f;
|
||||
}
|
||||
return 0;
|
||||
}</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_over.html">previous</a> | <a href="pa_tut_init.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,65 +1,65 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.75 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Querying for Available Devices</h2>
|
||||
|
||||
<blockquote>There are often several different audio devices available in
|
||||
a computer with different capabilities. They can differ in the sample rates
|
||||
supported, bit widths, etc. PortAudio provides a simple way to query for
|
||||
the available devices, and then pass the selected device to Pa_OpenStream().
|
||||
For an example, see the file "pa_tests/pa_devs.c".
|
||||
<p>To determine the number of devices:
|
||||
<blockquote>
|
||||
<pre>numDevices = Pa_CountDevices();</pre>
|
||||
</blockquote>
|
||||
You can then query each device in turn by calling Pa_GetDeviceInfo() with
|
||||
an index.
|
||||
<blockquote>
|
||||
<pre>for( i=0; i<numDevices; i++ ) {
|
||||
pdi = Pa_GetDeviceInfo( i );</pre>
|
||||
</blockquote>
|
||||
It will return a pointer to a <tt>PaDeviceInfo</tt> structure which is
|
||||
defined as:
|
||||
<blockquote>
|
||||
<pre>typedef struct{
|
||||
int structVersion;
|
||||
const char *name;
|
||||
int maxInputChannels;
|
||||
int maxOutputChannels;
|
||||
/* Number of discrete rates, or -1 if range supported. */
|
||||
int numSampleRates;
|
||||
/* Array of supported sample rates, or {min,max} if range supported. */
|
||||
const double *sampleRates;
|
||||
PaSampleFormat nativeSampleFormat;
|
||||
}PaDeviceInfo;</pre>
|
||||
</blockquote>
|
||||
If the device supports a continuous range of sample rates, then numSampleRates
|
||||
will equal -1, and the sampleRates array will have two values, the minimum
|
||||
and maximum rate.
|
||||
<p>The device information is allocated by Pa_Initialize() and freed by
|
||||
Pa_Terminate() so you do not have to free() the structure returned by Pa_GetDeviceInfo().</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_util.html">previous</a> | <a href="pa_tut_rw.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.75 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Querying for Available Devices</h2>
|
||||
|
||||
<blockquote>There are often several different audio devices available in
|
||||
a computer with different capabilities. They can differ in the sample rates
|
||||
supported, bit widths, etc. PortAudio provides a simple way to query for
|
||||
the available devices, and then pass the selected device to Pa_OpenStream().
|
||||
For an example, see the file "pa_tests/pa_devs.c".
|
||||
<p>To determine the number of devices:
|
||||
<blockquote>
|
||||
<pre>numDevices = Pa_CountDevices();</pre>
|
||||
</blockquote>
|
||||
You can then query each device in turn by calling Pa_GetDeviceInfo() with
|
||||
an index.
|
||||
<blockquote>
|
||||
<pre>for( i=0; i<numDevices; i++ ) {
|
||||
pdi = Pa_GetDeviceInfo( i );</pre>
|
||||
</blockquote>
|
||||
It will return a pointer to a <tt>PaDeviceInfo</tt> structure which is
|
||||
defined as:
|
||||
<blockquote>
|
||||
<pre>typedef struct{
|
||||
int structVersion;
|
||||
const char *name;
|
||||
int maxInputChannels;
|
||||
int maxOutputChannels;
|
||||
/* Number of discrete rates, or -1 if range supported. */
|
||||
int numSampleRates;
|
||||
/* Array of supported sample rates, or {min,max} if range supported. */
|
||||
const double *sampleRates;
|
||||
PaSampleFormat nativeSampleFormat;
|
||||
}PaDeviceInfo;</pre>
|
||||
</blockquote>
|
||||
If the device supports a continuous range of sample rates, then numSampleRates
|
||||
will equal -1, and the sampleRates array will have two values, the minimum
|
||||
and maximum rate.
|
||||
<p>The device information is allocated by Pa_Initialize() and freed by
|
||||
Pa_Terminate() so you do not have to free() the structure returned by Pa_GetDeviceInfo().</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_util.html">previous</a> | <a href="pa_tut_rw.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.73 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Exploring PortAudio</h2>
|
||||
|
||||
<blockquote>Now that you have a good idea of how PortAudio works, you can
|
||||
try out the test programs.
|
||||
<ul>
|
||||
<li>
|
||||
For an example of playing a sine wave, see "pa_tests/patest_sine.c".</li>
|
||||
|
||||
<li>
|
||||
For an example of recording and playing back a sound, see "pa_tests/patest_record.c".</li>
|
||||
</ul>
|
||||
I also encourage you to examine the source for the PortAudio libraries.
|
||||
If you have suggestions on ways to improve them, please let us know. if
|
||||
you want to implement PortAudio on a new platform, please let us know as
|
||||
well so we can coordinate people's efforts.</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> | <a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_rw.html">previous</a> | next</font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.73 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Exploring PortAudio</h2>
|
||||
|
||||
<blockquote>Now that you have a good idea of how PortAudio works, you can
|
||||
try out the test programs.
|
||||
<ul>
|
||||
<li>
|
||||
For an example of playing a sine wave, see "pa_tests/patest_sine.c".</li>
|
||||
|
||||
<li>
|
||||
For an example of recording and playing back a sound, see "pa_tests/patest_record.c".</li>
|
||||
</ul>
|
||||
I also encourage you to examine the source for the PortAudio libraries.
|
||||
If you have suggestions on ways to improve them, please let us know. if
|
||||
you want to implement PortAudio on a new platform, please let us know as
|
||||
well so we can coordinate people's efforts.</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> | <a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_rw.html">previous</a> | next</font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.73 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Initializing PortAudio</h2>
|
||||
|
||||
<blockquote>Before making any other calls to PortAudio, you must call <tt>Pa_Initialize</tt>().
|
||||
This will trigger a scan of available devices which can be queried later.
|
||||
Like most PA functions, it will return a result of type <tt>paError</tt>.
|
||||
If the result is not <tt>paNoError</tt>, then an error has occurred.
|
||||
<blockquote>
|
||||
<pre>err = Pa_Initialize();
|
||||
if( err != paNoError ) goto error;</pre>
|
||||
</blockquote>
|
||||
You can get a text message that explains the error message by passing it
|
||||
to
|
||||
<blockquote>
|
||||
<pre>printf( "PortAudio error: %s\n", Pa_GetErrorText( err ) );</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> | <a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_callback.html">previous</a> | <a href="pa_tut_open.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.73 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Initializing PortAudio</h2>
|
||||
|
||||
<blockquote>Before making any other calls to PortAudio, you must call <tt>Pa_Initialize</tt>().
|
||||
This will trigger a scan of available devices which can be queried later.
|
||||
Like most PA functions, it will return a result of type <tt>paError</tt>.
|
||||
If the result is not <tt>paNoError</tt>, then an error has occurred.
|
||||
<blockquote>
|
||||
<pre>err = Pa_Initialize();
|
||||
if( err != paNoError ) goto error;</pre>
|
||||
</blockquote>
|
||||
You can get a text message that explains the error message by passing it
|
||||
to
|
||||
<blockquote>
|
||||
<pre>printf( "PortAudio error: %s\n", Pa_GetErrorText( err ) );</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> | <a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_callback.html">previous</a> | <a href="pa_tut_open.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Compiling for Macintosh</h2>
|
||||
|
||||
<blockquote>To compile a Macintosh application with the PortAudio library,
|
||||
add the following source files to your project:
|
||||
<blockquote>
|
||||
<pre>pa_mac:pa_mac.c
|
||||
pa_common:pa_lib.c
|
||||
pa_common:portaudio.h
|
||||
pa_common:pa_host.h</pre>
|
||||
</blockquote>
|
||||
Also add the Apple <b>SoundLib</b> to your project.
|
||||
<p>You may try compiling the "pa_tests:patest_saw.c" file first because
|
||||
it is the simplest.</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_over.html">previous</a> | <a href="pa_tut_callback.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Compiling for Macintosh</h2>
|
||||
|
||||
<blockquote>To compile a Macintosh application with the PortAudio library,
|
||||
add the following source files to your project:
|
||||
<blockquote>
|
||||
<pre>pa_mac:pa_mac.c
|
||||
pa_common:pa_lib.c
|
||||
pa_common:portaudio.h
|
||||
pa_common:pa_host.h</pre>
|
||||
</blockquote>
|
||||
Also add the Apple <b>SoundLib</b> to your project.
|
||||
<p>You may try compiling the "pa_tests:patest_saw.c" file first because
|
||||
it is the simplest.</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_over.html">previous</a> | <a href="pa_tut_callback.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.73 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Opening a Stream using Defaults</h2>
|
||||
|
||||
<blockquote>The next step is to open a stream which is similar to opening
|
||||
a file. You can specify whether you want audio input and/or output, how
|
||||
many channels, the data format, sample rate, etc. There are two calls for
|
||||
opening streams, <tt>Pa_OpenStream</tt>() and <tt>Pa_OpenDefaultStream</tt>().
|
||||
<p><tt>Pa_OpenStream()</tt> takes extra parameters which give you
|
||||
more control. You can normally just use <tt>Pa_OpenDefaultStream</tt>()
|
||||
which just calls <tt>Pa_OpenStream()</tt> <tt>with</tt> some reasonable
|
||||
default values. Let's open a stream for stereo output, using floating
|
||||
point data, at 44100 Hz.
|
||||
<blockquote>
|
||||
<pre>err = Pa_OpenDefaultStream(
|
||||
&stream, /* passes back stream pointer */
|
||||
0, /* no input channels */
|
||||
2, /* stereo output */
|
||||
paFloat32, /* 32 bit floating point output */
|
||||
44100, /* sample rate */
|
||||
256, /* frames per buffer */
|
||||
0, /* number of buffers, if zero then use default minimum */
|
||||
patestCallback, /* specify our custom callback */
|
||||
&data ); /* pass our data through to callback */</pre>
|
||||
</blockquote>
|
||||
If you want to use 16 bit integer data, pass <tt>paInt16</tt> instead of
|
||||
<tt>paFloat32</tt>.</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> | <a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_init.html">previous</a> | <a href="pa_tut_run.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.73 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Opening a Stream using Defaults</h2>
|
||||
|
||||
<blockquote>The next step is to open a stream which is similar to opening
|
||||
a file. You can specify whether you want audio input and/or output, how
|
||||
many channels, the data format, sample rate, etc. There are two calls for
|
||||
opening streams, <tt>Pa_OpenStream</tt>() and <tt>Pa_OpenDefaultStream</tt>().
|
||||
<p><tt>Pa_OpenStream()</tt> takes extra parameters which give you
|
||||
more control. You can normally just use <tt>Pa_OpenDefaultStream</tt>()
|
||||
which just calls <tt>Pa_OpenStream()</tt> <tt>with</tt> some reasonable
|
||||
default values. Let's open a stream for stereo output, using floating
|
||||
point data, at 44100 Hz.
|
||||
<blockquote>
|
||||
<pre>err = Pa_OpenDefaultStream(
|
||||
&stream, /* passes back stream pointer */
|
||||
0, /* no input channels */
|
||||
2, /* stereo output */
|
||||
paFloat32, /* 32 bit floating point output */
|
||||
44100, /* sample rate */
|
||||
256, /* frames per buffer */
|
||||
0, /* number of buffers, if zero then use default minimum */
|
||||
patestCallback, /* specify our custom callback */
|
||||
&data ); /* pass our data through to callback */</pre>
|
||||
</blockquote>
|
||||
If you want to use 16 bit integer data, pass <tt>paInt16</tt> instead of
|
||||
<tt>paFloat32</tt>.</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> | <a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_init.html">previous</a> | <a href="pa_tut_run.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.75 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Compiling for Linux</h2>
|
||||
|
||||
<blockquote>[Skip this page if you are not using Linux]
|
||||
<p>We currently only support the OSS audio drivers for Linux. We hope to
|
||||
someday support the newer ALSA drivers.
|
||||
<ol>
|
||||
<li>
|
||||
cd to pa_linux_oss directory</li>
|
||||
|
||||
<li>
|
||||
Edit the Makefile and uncomment one of the tests. You may try compiling
|
||||
the "patest_sine.c" file first because it is very simple.</li>
|
||||
|
||||
<li>
|
||||
gmake run</li>
|
||||
</ol>
|
||||
</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_pc.html">previous</a> | <a href="pa_tut_callback.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.75 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Compiling for Linux</h2>
|
||||
|
||||
<blockquote>[Skip this page if you are not using Linux]
|
||||
<p>We currently only support the OSS audio drivers for Linux. We hope to
|
||||
someday support the newer ALSA drivers.
|
||||
<ol>
|
||||
<li>
|
||||
cd to pa_linux_oss directory</li>
|
||||
|
||||
<li>
|
||||
Edit the Makefile and uncomment one of the tests. You may try compiling
|
||||
the "patest_sine.c" file first because it is very simple.</li>
|
||||
|
||||
<li>
|
||||
gmake run</li>
|
||||
</ol>
|
||||
</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_pc.html">previous</a> | <a href="pa_tut_callback.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,86 +1,86 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Overview of PortAudio</h2>
|
||||
|
||||
<blockquote>PortAudio is a library that provides streaming audio input
|
||||
and output. It is a cross-platform API (Application Programming Interface)
|
||||
that works on Windows and Macintosh, and perhaps other platforms by the
|
||||
time you read this. This means that you can write a simple 'C' program
|
||||
to process or generate an audio signal, and that program can run on several
|
||||
different computers just by recompiling the source code.
|
||||
<p>Here are the steps to writing a PortAudio application:
|
||||
<ol>
|
||||
<li>
|
||||
Write a callback function that will be called by PortAudio when audio processing
|
||||
is needed.</li>
|
||||
|
||||
<li>
|
||||
Initialize the PA library and open a stream for audio I/O.</li>
|
||||
|
||||
<li>
|
||||
Start the stream. Your callback function will be now be called repeatedly
|
||||
by PA in the background.</li>
|
||||
|
||||
<li>
|
||||
In your callback you can read audio data from the inputBuffer and/or write
|
||||
data to the outputBuffer.</li>
|
||||
|
||||
<li>
|
||||
Stop the stream by returning 1 from your callback, or by calling a stop
|
||||
function.</li>
|
||||
|
||||
<li>
|
||||
Close the stream and terminate the library.</li>
|
||||
</ol>
|
||||
</blockquote>
|
||||
|
||||
<blockquote>There is also <a href="pa_tut_rw.html">another interface</a>
|
||||
provided that allows you to generate audio in the foreground. You then
|
||||
simply write data to the stream and the tool will not return until it is
|
||||
ready to accept more data. This interface is simpler to use but is usually
|
||||
not preferred for large applications because it requires that you launch
|
||||
a thread to perform the synthesis. Launching a thread may be difficult
|
||||
on non-multi-tasking systems such as the Macintosh prior to MacOS X.
|
||||
<p>Let's continue by building a simple application that will play a sawtooth
|
||||
wave.
|
||||
<p>Please select the page for the implementation you would like to use:
|
||||
<ul>
|
||||
<li>
|
||||
<a href="pa_tut_pc.html">Windows (WMME or DirectSound)</a></li>
|
||||
|
||||
<li>
|
||||
<a href="pa_tut_mac.html">Macintosh SoundManager</a></li>
|
||||
|
||||
<li>
|
||||
<a href="pa_tut_asio.html">ASIO on Windows or Macintosh</a></li>
|
||||
|
||||
<li>
|
||||
<a href="pa_tut_oss.html">Unix OSS</a></li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tutorial.html">previous</a></font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Overview of PortAudio</h2>
|
||||
|
||||
<blockquote>PortAudio is a library that provides streaming audio input
|
||||
and output. It is a cross-platform API (Application Programming Interface)
|
||||
that works on Windows and Macintosh, and perhaps other platforms by the
|
||||
time you read this. This means that you can write a simple 'C' program
|
||||
to process or generate an audio signal, and that program can run on several
|
||||
different computers just by recompiling the source code.
|
||||
<p>Here are the steps to writing a PortAudio application:
|
||||
<ol>
|
||||
<li>
|
||||
Write a callback function that will be called by PortAudio when audio processing
|
||||
is needed.</li>
|
||||
|
||||
<li>
|
||||
Initialize the PA library and open a stream for audio I/O.</li>
|
||||
|
||||
<li>
|
||||
Start the stream. Your callback function will be now be called repeatedly
|
||||
by PA in the background.</li>
|
||||
|
||||
<li>
|
||||
In your callback you can read audio data from the inputBuffer and/or write
|
||||
data to the outputBuffer.</li>
|
||||
|
||||
<li>
|
||||
Stop the stream by returning 1 from your callback, or by calling a stop
|
||||
function.</li>
|
||||
|
||||
<li>
|
||||
Close the stream and terminate the library.</li>
|
||||
</ol>
|
||||
</blockquote>
|
||||
|
||||
<blockquote>There is also <a href="pa_tut_rw.html">another interface</a>
|
||||
provided that allows you to generate audio in the foreground. You then
|
||||
simply write data to the stream and the tool will not return until it is
|
||||
ready to accept more data. This interface is simpler to use but is usually
|
||||
not preferred for large applications because it requires that you launch
|
||||
a thread to perform the synthesis. Launching a thread may be difficult
|
||||
on non-multi-tasking systems such as the Macintosh prior to MacOS X.
|
||||
<p>Let's continue by building a simple application that will play a sawtooth
|
||||
wave.
|
||||
<p>Please select the page for the implementation you would like to use:
|
||||
<ul>
|
||||
<li>
|
||||
<a href="pa_tut_pc.html">Windows (WMME or DirectSound)</a></li>
|
||||
|
||||
<li>
|
||||
<a href="pa_tut_mac.html">Macintosh SoundManager</a></li>
|
||||
|
||||
<li>
|
||||
<a href="pa_tut_asio.html">ASIO on Windows or Macintosh</a></li>
|
||||
|
||||
<li>
|
||||
<a href="pa_tut_oss.html">Unix OSS</a></li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tutorial.html">previous</a></font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,63 +1,63 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Compiling for Windows (WMME or DirectSound)</h2>
|
||||
|
||||
<blockquote>To compile PortAudio for Windows, you can choose between two
|
||||
options. One implementation uses the DirectSound API. The other uses the
|
||||
Windows MultiMedia Extensions API (aka WMME or WAVE).
|
||||
<p>Some advantages of using DirectSound are that DirectSound may have lower
|
||||
latency than WMME, and supports effects processing plugins. But one disadvantage
|
||||
is that DirectSound is not installed on all PCs, and is not well supported
|
||||
under Windows NT.
|
||||
<p>For either implementation add the following source files to your project:
|
||||
<blockquote>
|
||||
<pre>pa_common\pa_lib.c
|
||||
pa_common\portaudio.h
|
||||
pa_common\pa_host.h</pre>
|
||||
|
||||
<pre>Link with the system library: winmm.lib</pre>
|
||||
</blockquote>
|
||||
<b>WMME</b> - To use the WMME implementation, add the following source
|
||||
files to your project:
|
||||
<blockquote><tt>pa_win_wmme/pa_win_wmme.c</tt></blockquote>
|
||||
<b>DirectSound</b> - If you want to use the DirectSound implementation
|
||||
of PortAudio then you must have a recent copy of the free
|
||||
<a href="http://www.microsoft.com/directx/download.asp">DirectX</a>
|
||||
SDK for Developers from Microsoft installed on your computer. To compile
|
||||
an application add the following source files to your project:
|
||||
<blockquote>
|
||||
<pre>pa_win_ds\dsound_wrapper.c
|
||||
pa_win_ds\pa_dsound.c</pre>
|
||||
</blockquote>
|
||||
|
||||
<blockquote>
|
||||
<pre>Link with the system library: dsound.lib</pre>
|
||||
</blockquote>
|
||||
You may try compiling the "pa_tests\patest_saw.c" file first because it
|
||||
is the simplest.</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_over.html">previous</a> | <a href="pa_tut_callback.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Compiling for Windows (WMME or DirectSound)</h2>
|
||||
|
||||
<blockquote>To compile PortAudio for Windows, you can choose between two
|
||||
options. One implementation uses the DirectSound API. The other uses the
|
||||
Windows MultiMedia Extensions API (aka WMME or WAVE).
|
||||
<p>Some advantages of using DirectSound are that DirectSound may have lower
|
||||
latency than WMME, and supports effects processing plugins. But one disadvantage
|
||||
is that DirectSound is not installed on all PCs, and is not well supported
|
||||
under Windows NT.
|
||||
<p>For either implementation add the following source files to your project:
|
||||
<blockquote>
|
||||
<pre>pa_common\pa_lib.c
|
||||
pa_common\portaudio.h
|
||||
pa_common\pa_host.h</pre>
|
||||
|
||||
<pre>Link with the system library: winmm.lib</pre>
|
||||
</blockquote>
|
||||
<b>WMME</b> - To use the WMME implementation, add the following source
|
||||
files to your project:
|
||||
<blockquote><tt>pa_win_wmme/pa_win_wmme.c</tt></blockquote>
|
||||
<b>DirectSound</b> - If you want to use the DirectSound implementation
|
||||
of PortAudio then you must have a recent copy of the free
|
||||
<a href="http://www.microsoft.com/directx/download.asp">DirectX</a>
|
||||
SDK for Developers from Microsoft installed on your computer. To compile
|
||||
an application add the following source files to your project:
|
||||
<blockquote>
|
||||
<pre>pa_win_ds\dsound_wrapper.c
|
||||
pa_win_ds\pa_dsound.c</pre>
|
||||
</blockquote>
|
||||
|
||||
<blockquote>
|
||||
<pre>Link with the system library: dsound.lib</pre>
|
||||
</blockquote>
|
||||
You may try compiling the "pa_tests\patest_saw.c" file first because it
|
||||
is the simplest.</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_over.html">previous</a> | <a href="pa_tut_callback.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,56 +1,56 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.73 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Starting and Stopping a Stream</h2>
|
||||
|
||||
<blockquote>The stream will not start running until you call Pa_StartStream().
|
||||
Then it will start calling your callback function to perform the audio
|
||||
processing.
|
||||
<blockquote>
|
||||
<pre>err = Pa_StartStream( stream );
|
||||
if( err != paNoError ) goto error;</pre>
|
||||
</blockquote>
|
||||
At this point, audio is being generated. You can communicate to your callback
|
||||
routine through the data structure you passed in on the open call, or through
|
||||
global variables, or using other interprocess communication techniques.
|
||||
Please be aware that your callback function may be called at interrupt
|
||||
time when your foreground process is least expecting it. So avoid sharing
|
||||
complex data structures that are easily corrupted like double linked lists.
|
||||
<p>In many of the tests we simply sleep for a few seconds so we can hear
|
||||
the sound. This is easy to do with Pa_Sleep() which will sleep for some
|
||||
number of milliseconds. Do not rely on this function for accurate scheduling.
|
||||
it is mostly for writing examples.
|
||||
<blockquote>
|
||||
<pre>/* Sleep for several seconds. */
|
||||
Pa_Sleep(NUM_SECONDS*1000);</pre>
|
||||
</blockquote>
|
||||
When you are through, you can stop the stream from the foreground.
|
||||
<blockquote>
|
||||
<pre>err = Pa_StopStream( stream );
|
||||
if( err != paNoError ) goto error;</pre>
|
||||
</blockquote>
|
||||
You can also stop the stream by returning 1 from your custom callback function.</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> | <a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_open.html">previous</a> | <a href="pa_tut_term.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.73 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Starting and Stopping a Stream</h2>
|
||||
|
||||
<blockquote>The stream will not start running until you call Pa_StartStream().
|
||||
Then it will start calling your callback function to perform the audio
|
||||
processing.
|
||||
<blockquote>
|
||||
<pre>err = Pa_StartStream( stream );
|
||||
if( err != paNoError ) goto error;</pre>
|
||||
</blockquote>
|
||||
At this point, audio is being generated. You can communicate to your callback
|
||||
routine through the data structure you passed in on the open call, or through
|
||||
global variables, or using other interprocess communication techniques.
|
||||
Please be aware that your callback function may be called at interrupt
|
||||
time when your foreground process is least expecting it. So avoid sharing
|
||||
complex data structures that are easily corrupted like double linked lists.
|
||||
<p>In many of the tests we simply sleep for a few seconds so we can hear
|
||||
the sound. This is easy to do with Pa_Sleep() which will sleep for some
|
||||
number of milliseconds. Do not rely on this function for accurate scheduling.
|
||||
it is mostly for writing examples.
|
||||
<blockquote>
|
||||
<pre>/* Sleep for several seconds. */
|
||||
Pa_Sleep(NUM_SECONDS*1000);</pre>
|
||||
</blockquote>
|
||||
When you are through, you can stop the stream from the foreground.
|
||||
<blockquote>
|
||||
<pre>err = Pa_StopStream( stream );
|
||||
if( err != paNoError ) goto error;</pre>
|
||||
</blockquote>
|
||||
You can also stop the stream by returning 1 from your custom callback function.</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> | <a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_open.html">previous</a> | <a href="pa_tut_term.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,77 +1,77 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.75 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Blocking Read/Write Functions</h2>
|
||||
|
||||
<blockquote>[Note: These functions are not part of the official PortAudio
|
||||
API. They are simply built on top of PortAudio as an extra utility. Also
|
||||
note that they are under evaluation and their definition may change.]
|
||||
<p>There are two fundamentally different ways to design an audio API. One
|
||||
is to use callback functions the way we have already shown. The callback
|
||||
function operates under an interrupt or background thread This leaves the
|
||||
foreground application free to do other things while the audio just runs
|
||||
in the background. But this can sometimes be awkward.
|
||||
<p>So we have provided an alternative technique that lets a program generate
|
||||
audio in the foreground and then just write it to the audio stream as if
|
||||
it was a file. If there is not enough room in the audio buffer for more
|
||||
data, then the write function will just block until more room is available.
|
||||
This can make it very easy to write an audio example. To use this tool,
|
||||
you must add the files "pablio/pablio.c" and "pablio/ringbuffer.c" to your
|
||||
project. You must also:
|
||||
<blockquote>
|
||||
<pre>#include "pablio.h"</pre>
|
||||
</blockquote>
|
||||
Here is a short excerpt of a program that opens a stream for input and
|
||||
output. It then read a pair of samples at a time from input, and writes
|
||||
them to output, in a loop. The complete example can be found in "pablio/test_rw.c".
|
||||
<blockquote>
|
||||
<pre> SAMPLE samples[2];
|
||||
PaError err;
|
||||
PABLIO_Stream *aStream;
|
||||
|
||||
/* Open simplified blocking I/O layer on top of PortAudio. */
|
||||
err = OpenAudioStream( &rwbl, SAMPLE_RATE, paFloat32,
|
||||
(PABLIO_READ_WRITE | PABLIO_STEREO) );
|
||||
if( err != paNoError ) goto error;
|
||||
|
||||
/* Process samples in the foreground. */
|
||||
for( i=0; i<(NUM_SECONDS * SAMPLE_RATE); i++ )
|
||||
{
|
||||
/* Read one frame of data into sample array from audio input. */
|
||||
ReadAudioStream( aStream, samples, 1 );
|
||||
/*
|
||||
** At this point you could process the data in samples[0] and samples[1],
|
||||
** and write the result back to the same samples array.
|
||||
*/
|
||||
/* Write that same frame of data to output. */
|
||||
WriteAudioStream( aStream, samples, 1 );
|
||||
}
|
||||
|
||||
CloseAudioStream( aStream );</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_devs.html">previous</a> | <a href="pa_tut_explore.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.75 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Blocking Read/Write Functions</h2>
|
||||
|
||||
<blockquote>[Note: These functions are not part of the official PortAudio
|
||||
API. They are simply built on top of PortAudio as an extra utility. Also
|
||||
note that they are under evaluation and their definition may change.]
|
||||
<p>There are two fundamentally different ways to design an audio API. One
|
||||
is to use callback functions the way we have already shown. The callback
|
||||
function operates under an interrupt or background thread This leaves the
|
||||
foreground application free to do other things while the audio just runs
|
||||
in the background. But this can sometimes be awkward.
|
||||
<p>So we have provided an alternative technique that lets a program generate
|
||||
audio in the foreground and then just write it to the audio stream as if
|
||||
it was a file. If there is not enough room in the audio buffer for more
|
||||
data, then the write function will just block until more room is available.
|
||||
This can make it very easy to write an audio example. To use this tool,
|
||||
you must add the files "pablio/pablio.c" and "pablio/ringbuffer.c" to your
|
||||
project. You must also:
|
||||
<blockquote>
|
||||
<pre>#include "pablio.h"</pre>
|
||||
</blockquote>
|
||||
Here is a short excerpt of a program that opens a stream for input and
|
||||
output. It then read a pair of samples at a time from input, and writes
|
||||
them to output, in a loop. The complete example can be found in "pablio/test_rw.c".
|
||||
<blockquote>
|
||||
<pre> SAMPLE samples[2];
|
||||
PaError err;
|
||||
PABLIO_Stream *aStream;
|
||||
|
||||
/* Open simplified blocking I/O layer on top of PortAudio. */
|
||||
err = OpenAudioStream( &rwbl, SAMPLE_RATE, paFloat32,
|
||||
(PABLIO_READ_WRITE | PABLIO_STEREO) );
|
||||
if( err != paNoError ) goto error;
|
||||
|
||||
/* Process samples in the foreground. */
|
||||
for( i=0; i<(NUM_SECONDS * SAMPLE_RATE); i++ )
|
||||
{
|
||||
/* Read one frame of data into sample array from audio input. */
|
||||
ReadAudioStream( aStream, samples, 1 );
|
||||
/*
|
||||
** At this point you could process the data in samples[0] and samples[1],
|
||||
** and write the result back to the same samples array.
|
||||
*/
|
||||
/* Write that same frame of data to output. */
|
||||
WriteAudioStream( aStream, samples, 1 );
|
||||
}
|
||||
|
||||
CloseAudioStream( aStream );</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_devs.html">previous</a> | <a href="pa_tut_explore.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.73 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Terminating PortAudio</h2>
|
||||
|
||||
<blockquote>You can start and stop a stream as many times as you like.
|
||||
But when you are done using it, you should close it by calling:</blockquote>
|
||||
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<pre>err = Pa_CloseStream( stream );
|
||||
if( err != paNoError ) goto error;</pre>
|
||||
</blockquote>
|
||||
Then when you are done using PortAudio, you should terminate the whole
|
||||
system by calling:
|
||||
<blockquote>
|
||||
<pre>Pa_Terminate();</pre>
|
||||
</blockquote>
|
||||
That's basically it. You can now write an audio program in 'C' that will
|
||||
run on multiple platforms, for example PCs and Macintosh.
|
||||
<p>In the rest of the tutorial we will look at some additional utility
|
||||
functions, and a different way of using PortAudio that does not require
|
||||
the use of a callback function.</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> | <a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_run.html">previous</a> | <a href="pa_tut_util.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.73 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Terminating PortAudio</h2>
|
||||
|
||||
<blockquote>You can start and stop a stream as many times as you like.
|
||||
But when you are done using it, you should close it by calling:</blockquote>
|
||||
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<pre>err = Pa_CloseStream( stream );
|
||||
if( err != paNoError ) goto error;</pre>
|
||||
</blockquote>
|
||||
Then when you are done using PortAudio, you should terminate the whole
|
||||
system by calling:
|
||||
<blockquote>
|
||||
<pre>Pa_Terminate();</pre>
|
||||
</blockquote>
|
||||
That's basically it. You can now write an audio program in 'C' that will
|
||||
run on multiple platforms, for example PCs and Macintosh.
|
||||
<p>In the rest of the tutorial we will look at some additional utility
|
||||
functions, and a different way of using PortAudio that does not require
|
||||
the use of a callback function.</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> | <a href="pa_tutorial.html">contents</a>
|
||||
| <a href="pa_tut_run.html">previous</a> | <a href="pa_tut_util.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,55 +1,55 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.75 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Utility Functions</h2>
|
||||
|
||||
<blockquote>Here are several more functions that are not critical, but
|
||||
may be handy when using PortAudio.
|
||||
<p>Pa_StreamActive() returns one when the stream in playing audio, zero
|
||||
when not playing, or a negative error number if the stream is invalid.
|
||||
The stream is active between calls to Pa_StartStream() and Pa_StopStream(),
|
||||
but may also become inactive if the callback returns a non-zero value.
|
||||
In the latter case, the stream is considered inactive after the last buffer
|
||||
has finished playing.
|
||||
<blockquote>
|
||||
<pre>PaError Pa_StreamActive( PortAudioStream *stream );</pre>
|
||||
</blockquote>
|
||||
Pa_StreamTime() returns the number of samples that have been generated.
|
||||
PaTimeStamp is a double precision number which is a convenient way to pass
|
||||
big numbers around even though we only need integers.
|
||||
<blockquote>
|
||||
<pre>PaTimestamp Pa_StreamTime( PortAudioStream *stream );</pre>
|
||||
</blockquote>
|
||||
The "CPU Load" is a fraction of total CPU time consumed by the stream's
|
||||
audio processing. A value of 0.5 would imply that PortAudio and the sound
|
||||
generating callback was consuming roughly 50% of the available CPU time.
|
||||
This function may be called from the callback function or the application.
|
||||
<blockquote>
|
||||
<pre>double Pa_GetCPULoad( PortAudioStream* stream );</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a> | <a href="pa_tut_term.html">previous</a>
|
||||
| <a href="pa_tut_devs.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.75 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<h2>
|
||||
Utility Functions</h2>
|
||||
|
||||
<blockquote>Here are several more functions that are not critical, but
|
||||
may be handy when using PortAudio.
|
||||
<p>Pa_StreamActive() returns one when the stream in playing audio, zero
|
||||
when not playing, or a negative error number if the stream is invalid.
|
||||
The stream is active between calls to Pa_StartStream() and Pa_StopStream(),
|
||||
but may also become inactive if the callback returns a non-zero value.
|
||||
In the latter case, the stream is considered inactive after the last buffer
|
||||
has finished playing.
|
||||
<blockquote>
|
||||
<pre>PaError Pa_StreamActive( PortAudioStream *stream );</pre>
|
||||
</blockquote>
|
||||
Pa_StreamTime() returns the number of samples that have been generated.
|
||||
PaTimeStamp is a double precision number which is a convenient way to pass
|
||||
big numbers around even though we only need integers.
|
||||
<blockquote>
|
||||
<pre>PaTimestamp Pa_StreamTime( PortAudioStream *stream );</pre>
|
||||
</blockquote>
|
||||
The "CPU Load" is a fraction of total CPU time consumed by the stream's
|
||||
audio processing. A value of 0.5 would imply that PortAudio and the sound
|
||||
generating callback was consuming roughly 50% of the available CPU time.
|
||||
This function may be called from the callback function or the application.
|
||||
<blockquote>
|
||||
<pre>double Pa_GetCPULoad( PortAudioStream* stream );</pre>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> |
|
||||
<a href="pa_tutorial.html">contents</a> | <a href="pa_tut_term.html">previous</a>
|
||||
| <a href="pa_tut_devs.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<p>Copyright 2000 Phil Burk and Ross Bencina
|
||||
<h2>
|
||||
Table of Contents</h2>
|
||||
|
||||
<blockquote><a href="pa_tut_over.html">Overview of PortAudio</a>
|
||||
<br><a href="pa_tut_mac.html">Compiling for Macintosh</a>
|
||||
<br><a href="pa_tut_pc.html">Compiling for Windows (DirectSound and WMME)</a>
|
||||
<br><a href="pa_tut_asio.html">Compiling for ASIO on Windows or Macintosh</a>
|
||||
<br><a href="pa_tut_linux.html">Compiling for Unix OSS</a>
|
||||
<br><a href="pa_tut_callback.html">Writing a Callback Function</a>
|
||||
<br><a href="pa_tut_init.html">Initializing PortAudio</a>
|
||||
<br><a href="pa_tut_open.html">Opening a Stream using Defaults</a>
|
||||
<br><a href="pa_tut_run.html">Starting and Stopping a Stream</a>
|
||||
<br><a href="pa_tut_term.html">Cleaning Up</a>
|
||||
<br><a href="pa_tut_util.html">Utilities</a>
|
||||
<br><a href="pa_tut_devs.html">Querying for Devices</a>
|
||||
<br><a href="pa_tut_rw.html">Blocking Read/Write Functions</a>
|
||||
<br><a href="pa_tut_explore.html">Exploring the PortAudio Package</a></blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> | contents |
|
||||
previous | <a href="pa_tut_over.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Tutorial</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio Tutorial</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<p>Copyright 2000 Phil Burk and Ross Bencina
|
||||
<h2>
|
||||
Table of Contents</h2>
|
||||
|
||||
<blockquote><a href="pa_tut_over.html">Overview of PortAudio</a>
|
||||
<br><a href="pa_tut_mac.html">Compiling for Macintosh</a>
|
||||
<br><a href="pa_tut_pc.html">Compiling for Windows (DirectSound and WMME)</a>
|
||||
<br><a href="pa_tut_asio.html">Compiling for ASIO on Windows or Macintosh</a>
|
||||
<br><a href="pa_tut_linux.html">Compiling for Unix OSS</a>
|
||||
<br><a href="pa_tut_callback.html">Writing a Callback Function</a>
|
||||
<br><a href="pa_tut_init.html">Initializing PortAudio</a>
|
||||
<br><a href="pa_tut_open.html">Opening a Stream using Defaults</a>
|
||||
<br><a href="pa_tut_run.html">Starting and Stopping a Stream</a>
|
||||
<br><a href="pa_tut_term.html">Cleaning Up</a>
|
||||
<br><a href="pa_tut_util.html">Utilities</a>
|
||||
<br><a href="pa_tut_devs.html">Querying for Devices</a>
|
||||
<br><a href="pa_tut_rw.html">Blocking Read/Write Functions</a>
|
||||
<br><a href="pa_tut_explore.html">Exploring the PortAudio Package</a></blockquote>
|
||||
<font size=+2><a href="http://www.portaudio.com/">home</a> | contents |
|
||||
previous | <a href="pa_tut_over.html">next</a></font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,226 +1,226 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="PortAudio is a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Implementations for DirectSound</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio - Release Notes</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<p>Link to <a href="http://www.portaudio.com">PortAudio Home Page</a>
|
||||
<h2>
|
||||
<b>V17 - 10/15/01</b></h2>
|
||||
|
||||
<blockquote><b>Unix OSS</b>
|
||||
<ul>
|
||||
<li>
|
||||
Set num channels back to two after device query for ALSA. This fixed a
|
||||
bug in V16 that sometimes caused a failure when querying for the sample
|
||||
rates. Thanks Stweart Greenhill.</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<blockquote>
|
||||
<h4>
|
||||
<b>Macintosh Sound Manager</b></h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Use NewSndCallBackUPP() for CARBON compatibility.</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<h2>
|
||||
<b>V16 - 9/27/01</b></h2>
|
||||
|
||||
<blockquote><b>Added Alpha implementations for ASIO, SGI, and BeOS!</b>
|
||||
<br>
|
||||
<li>
|
||||
CPULoad is now calculated based on the time spent to generate a known number
|
||||
of frames. This is more accurate than a simple percentage of real-time.
|
||||
Implemented in pa_unix_oss, pa_win_wmme and pa_win_ds.</li>
|
||||
|
||||
<li>
|
||||
Fix dither and shift for recording PaUInt8 format data.</li>
|
||||
|
||||
<li>
|
||||
Added "patest_maxsines.c" which tests <tt>Pa_GetCPULoad().</tt></li>
|
||||
</blockquote>
|
||||
|
||||
<blockquote>
|
||||
<h4>
|
||||
Windows WMME</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
sDevicePtrs now allocated using <tt>GlobalAlloc()</tt>. This prevents a
|
||||
crash in Pa_Terminate() on Win2000. Thanks Mike Berry for finding this.
|
||||
Thanks Mike Berry.</li>
|
||||
|
||||
<li>
|
||||
Pass process instead of thread to <tt>SetPriorityClass</tt>(). This fixes
|
||||
a bug that caused the priority to not be increased. Thanks to Alberto di
|
||||
Bene for spotting this.</li>
|
||||
</ul>
|
||||
|
||||
<h4>
|
||||
Windows DirectSound</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Casts for compiling with __MWERKS__ CodeWarrior.</li>
|
||||
</ul>
|
||||
|
||||
<h4>
|
||||
UNIX OSS</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Derived from Linux OSS implementation.</li>
|
||||
|
||||
<li>
|
||||
Numerous patches from Heiko Purnhagen, Stephen Brandon, etc.</li>
|
||||
|
||||
<li>
|
||||
Improved query mechanism which often bailed out unnecessarily.</li>
|
||||
|
||||
<li>
|
||||
Removed sNumDevices and potential related bugs,</li>
|
||||
|
||||
<li>
|
||||
Use <tt>getenv("PA_MIN_LATENCY_MSEC")</tt> in code to set desired latency.
|
||||
User can set by entering:</li>
|
||||
|
||||
<br> <tt>export PA_MIN_LATENCY_MSEC=40</tt></ul>
|
||||
|
||||
<h4>
|
||||
Macintosh Sound Manager</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Pass unused event to WaitNextEvent instead of NULL to prevent Mac OSX crash.
|
||||
Thanks Dominic Mazzoni.</li>
|
||||
|
||||
<br> </ul>
|
||||
</blockquote>
|
||||
|
||||
<h2>
|
||||
<b>V15 - 5/29/01</b></h2>
|
||||
|
||||
<blockquote>
|
||||
<ul>
|
||||
<li>
|
||||
<b>New Linux OSS Beta</b></li>
|
||||
</ul>
|
||||
|
||||
<h4>
|
||||
Windows WMME</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
sDevicePtrs now allocated based on sizeof(pointer). Was allocating
|
||||
too much space.</li>
|
||||
|
||||
<li>
|
||||
Check for excessive numbers of channels. Some drivers reported bogus
|
||||
numbers.</li>
|
||||
|
||||
<li>
|
||||
Apply Mike Berry's changes for CodeWarrior on PC including condition including
|
||||
of memory.h, and explicit typecasting on memory allocation.</li>
|
||||
</ul>
|
||||
|
||||
<h4>
|
||||
Macintosh Sound Manager</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
ScanInputDevices was setting sDefaultOutputDeviceID instead of sDefaultInputDeviceID.</li>
|
||||
|
||||
<li>
|
||||
Device Scan was crashing for anything other than siBadSoundInDevice, but
|
||||
some Macs may return other errors! Caused failure to init on some G4s under
|
||||
OS9.</li>
|
||||
|
||||
<li>
|
||||
Fix TIMEOUT in record mode.</li>
|
||||
|
||||
<li>
|
||||
Change CARBON_COMPATIBLE to TARGET_API_MAC_CARBON</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<h2>
|
||||
<b>V14 - 2/6/01</b></h2>
|
||||
|
||||
<blockquote>
|
||||
<ul>
|
||||
<li>
|
||||
Added implementation for Windows MultiMedia Extensions (WMME) by Ross and
|
||||
Phil</li>
|
||||
|
||||
<li>
|
||||
Changed Pa_StopStream() so that it waits for the buffers to drain.</li>
|
||||
|
||||
<li>
|
||||
Added Pa_AbortStream() that stops immediately without waiting.</li>
|
||||
|
||||
<li>
|
||||
Added new test: patest_stop.c to test above two mods.</li>
|
||||
|
||||
<li>
|
||||
Fixed Pa_StreamTime() so that it returns current play position instead
|
||||
of the write position. Added "patest_sync.c" to demo audio/video sync.</li>
|
||||
|
||||
<li>
|
||||
Improved stability of Macintosh implementation. Added timeouts to prevent
|
||||
hangs.</li>
|
||||
|
||||
<li>
|
||||
Added Pa_GetSampleSize( PaSampleFormat format );</li>
|
||||
|
||||
<li>
|
||||
Changes some "int"s to "long"s so that PA works properly on Macintosh which
|
||||
often compiles using 16 bit ints.</li>
|
||||
|
||||
<li>
|
||||
Added Implementation Guide</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<h2>
|
||||
<b>V12 - 1/9/01</b></h2>
|
||||
|
||||
<blockquote>
|
||||
<ul>
|
||||
<li>
|
||||
Mac now scans for and queries all devices. But it does not yet support
|
||||
selecting any other than the default device.</li>
|
||||
|
||||
<li>
|
||||
Blocking I/O calls renamed to separate them from the PortAudio API.</li>
|
||||
|
||||
<li>
|
||||
Cleaned up indentation problems with tabs versus spaces.</li>
|
||||
|
||||
<li>
|
||||
Now attempts to correct bogus sample rate info returned from DirectSound
|
||||
device queries.</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.77 [en]C-gatewaynet (Win98; U) [Netscape]">
|
||||
<meta name="Author" content="Phil Burk">
|
||||
<meta name="Description" content="PortAudio is a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
|
||||
<meta name="KeyWords" content="audio, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
|
||||
<title>PortAudio Implementations for DirectSound</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<h1>
|
||||
PortAudio - Release Notes</h1></center>
|
||||
</td>
|
||||
</tr>
|
||||
</table></center>
|
||||
|
||||
<p>Link to <a href="http://www.portaudio.com">PortAudio Home Page</a>
|
||||
<h2>
|
||||
<b>V17 - 10/15/01</b></h2>
|
||||
|
||||
<blockquote><b>Unix OSS</b>
|
||||
<ul>
|
||||
<li>
|
||||
Set num channels back to two after device query for ALSA. This fixed a
|
||||
bug in V16 that sometimes caused a failure when querying for the sample
|
||||
rates. Thanks Stweart Greenhill.</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<blockquote>
|
||||
<h4>
|
||||
<b>Macintosh Sound Manager</b></h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Use NewSndCallBackUPP() for CARBON compatibility.</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<h2>
|
||||
<b>V16 - 9/27/01</b></h2>
|
||||
|
||||
<blockquote><b>Added Alpha implementations for ASIO, SGI, and BeOS!</b>
|
||||
<br>
|
||||
<li>
|
||||
CPULoad is now calculated based on the time spent to generate a known number
|
||||
of frames. This is more accurate than a simple percentage of real-time.
|
||||
Implemented in pa_unix_oss, pa_win_wmme and pa_win_ds.</li>
|
||||
|
||||
<li>
|
||||
Fix dither and shift for recording PaUInt8 format data.</li>
|
||||
|
||||
<li>
|
||||
Added "patest_maxsines.c" which tests <tt>Pa_GetCPULoad().</tt></li>
|
||||
</blockquote>
|
||||
|
||||
<blockquote>
|
||||
<h4>
|
||||
Windows WMME</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
sDevicePtrs now allocated using <tt>GlobalAlloc()</tt>. This prevents a
|
||||
crash in Pa_Terminate() on Win2000. Thanks Mike Berry for finding this.
|
||||
Thanks Mike Berry.</li>
|
||||
|
||||
<li>
|
||||
Pass process instead of thread to <tt>SetPriorityClass</tt>(). This fixes
|
||||
a bug that caused the priority to not be increased. Thanks to Alberto di
|
||||
Bene for spotting this.</li>
|
||||
</ul>
|
||||
|
||||
<h4>
|
||||
Windows DirectSound</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Casts for compiling with __MWERKS__ CodeWarrior.</li>
|
||||
</ul>
|
||||
|
||||
<h4>
|
||||
UNIX OSS</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Derived from Linux OSS implementation.</li>
|
||||
|
||||
<li>
|
||||
Numerous patches from Heiko Purnhagen, Stephen Brandon, etc.</li>
|
||||
|
||||
<li>
|
||||
Improved query mechanism which often bailed out unnecessarily.</li>
|
||||
|
||||
<li>
|
||||
Removed sNumDevices and potential related bugs,</li>
|
||||
|
||||
<li>
|
||||
Use <tt>getenv("PA_MIN_LATENCY_MSEC")</tt> in code to set desired latency.
|
||||
User can set by entering:</li>
|
||||
|
||||
<br> <tt>export PA_MIN_LATENCY_MSEC=40</tt></ul>
|
||||
|
||||
<h4>
|
||||
Macintosh Sound Manager</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Pass unused event to WaitNextEvent instead of NULL to prevent Mac OSX crash.
|
||||
Thanks Dominic Mazzoni.</li>
|
||||
|
||||
<br> </ul>
|
||||
</blockquote>
|
||||
|
||||
<h2>
|
||||
<b>V15 - 5/29/01</b></h2>
|
||||
|
||||
<blockquote>
|
||||
<ul>
|
||||
<li>
|
||||
<b>New Linux OSS Beta</b></li>
|
||||
</ul>
|
||||
|
||||
<h4>
|
||||
Windows WMME</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
sDevicePtrs now allocated based on sizeof(pointer). Was allocating
|
||||
too much space.</li>
|
||||
|
||||
<li>
|
||||
Check for excessive numbers of channels. Some drivers reported bogus
|
||||
numbers.</li>
|
||||
|
||||
<li>
|
||||
Apply Mike Berry's changes for CodeWarrior on PC including condition including
|
||||
of memory.h, and explicit typecasting on memory allocation.</li>
|
||||
</ul>
|
||||
|
||||
<h4>
|
||||
Macintosh Sound Manager</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
ScanInputDevices was setting sDefaultOutputDeviceID instead of sDefaultInputDeviceID.</li>
|
||||
|
||||
<li>
|
||||
Device Scan was crashing for anything other than siBadSoundInDevice, but
|
||||
some Macs may return other errors! Caused failure to init on some G4s under
|
||||
OS9.</li>
|
||||
|
||||
<li>
|
||||
Fix TIMEOUT in record mode.</li>
|
||||
|
||||
<li>
|
||||
Change CARBON_COMPATIBLE to TARGET_API_MAC_CARBON</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<h2>
|
||||
<b>V14 - 2/6/01</b></h2>
|
||||
|
||||
<blockquote>
|
||||
<ul>
|
||||
<li>
|
||||
Added implementation for Windows MultiMedia Extensions (WMME) by Ross and
|
||||
Phil</li>
|
||||
|
||||
<li>
|
||||
Changed Pa_StopStream() so that it waits for the buffers to drain.</li>
|
||||
|
||||
<li>
|
||||
Added Pa_AbortStream() that stops immediately without waiting.</li>
|
||||
|
||||
<li>
|
||||
Added new test: patest_stop.c to test above two mods.</li>
|
||||
|
||||
<li>
|
||||
Fixed Pa_StreamTime() so that it returns current play position instead
|
||||
of the write position. Added "patest_sync.c" to demo audio/video sync.</li>
|
||||
|
||||
<li>
|
||||
Improved stability of Macintosh implementation. Added timeouts to prevent
|
||||
hangs.</li>
|
||||
|
||||
<li>
|
||||
Added Pa_GetSampleSize( PaSampleFormat format );</li>
|
||||
|
||||
<li>
|
||||
Changes some "int"s to "long"s so that PA works properly on Macintosh which
|
||||
often compiles using 16 bit ints.</li>
|
||||
|
||||
<li>
|
||||
Added Implementation Guide</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<h2>
|
||||
<b>V12 - 1/9/01</b></h2>
|
||||
|
||||
<blockquote>
|
||||
<ul>
|
||||
<li>
|
||||
Mac now scans for and queries all devices. But it does not yet support
|
||||
selecting any other than the default device.</li>
|
||||
|
||||
<li>
|
||||
Blocking I/O calls renamed to separate them from the PortAudio API.</li>
|
||||
|
||||
<li>
|
||||
Cleaned up indentation problems with tabs versus spaces.</li>
|
||||
|
||||
<li>
|
||||
Now attempts to correct bogus sample rate info returned from DirectSound
|
||||
device queries.</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user