To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

The primary repository for this project is hosted at https://github.com/sonic-visualiser/sv-dependency-builds .
This repository is a read-only copy which is updated automatically every hour.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / src / portaudio_20161030_catalina_patch / doc / src / tutorial / tutorial_start.dox @ 164:9fa11135915a

History | View | Annotate | Download (3.07 KB)

1
/** @page tutorial_start PortAudio Tutorials
2
@ingroup tutorial
3

    
4
These tutorials takes you through a hands-on example of using PortAudio to make sound. If you'd prefer to start with a top-down overview of the PortAudio API, check out the @ref api_overview.
5

    
6
@section tut_start1 Downloading
7

    
8
First thing you need to do is download the PortAudio source code either <a href="http://www.portaudio.com/download.html">as a tarball from the website</a>, or <a href="http://www.portaudio.com/usingsvn.html">from the Subversion Repository</a>.
9

    
10
@section tut_start2 Compiling
11

    
12
Once you've downloaded PortAudio you'll need to compile it, which of course, depends on your environment:
13

    
14
 - Windows
15
   - \ref compile_windows
16
   - \ref compile_windows_mingw
17
   - \ref compile_windows_asio_msvc
18
   - \ref compile_cmake
19
 - Mac OS X
20
   - \ref compile_mac_coreaudio
21
 - POSIX
22
   - \ref compile_linux
23

    
24
Many platforms with GCC/make can use the simple ./configure && make combination and simply use the resulting libraries in their code.
25

    
26
@section tut_start3 Programming with PortAudio
27

    
28
Below are the steps to writing a PortAudio application using the callback technique:
29

    
30
 - Write a callback function that will be called by PortAudio when audio processing is needed.
31
 - Initialize the PA library and open a stream for audio I/O.
32
 - Start the stream. Your callback function will be now be called repeatedly by PA in the background.
33
 - In your callback you can read audio data from the inputBuffer and/or write data to the outputBuffer.
34
 - Stop the stream by returning 1 from your callback, or by calling a stop function.
35
 - Close the stream and terminate the library.
36

    
37
In addition to this "Callback" architecture, V19 also supports a "Blocking I/O" model which uses read and write calls which may be more familiar to non-audio programmers. Note that at this time, not all APIs support this functionality.
38

    
39
In this tutorial, we'll show how to use the callback architecture to play a sawtooth wave. Much of the tutorial is taken from the file paex_saw.c, which is part of the PortAudio distribution. When you're done with this tutorial, you'll be armed with the basic knowledge you need to write an audio program. If you need more sample code, look in the "examples" and "test" directory of the PortAudio distribution. Another great source of info is the portaudio.h Doxygen page, which documents the entire V19 API. Also see the page for <a href="http://www.assembla.com/spaces/portaudio/wiki/Tips">tips on programming PortAudio</a> on the PortAudio wiki.
40

    
41
@section tut_start4 Programming Tutorial Contents
42

    
43
- \ref writing_a_callback
44
- \ref initializing_portaudio
45
- \ref open_default_stream
46
- \ref start_stop_abort
47
- \ref terminating_portaudio
48
- \ref utility_functions
49
- \ref querying_devices
50
- \ref blocking_read_write
51

    
52
If you are upgrading from V18, you may want to look at the <a href="http://www.portaudio.com/docs/proposals/index.html">Proposed Enhancements to PortAudio</a>, which describes the differences between V18 and V19.
53

    
54
Once you have a basic understanding of how to use PortAudio, you might be interested in \ref exploring.
55

    
56
Next: \ref writing_a_callback
57

    
58
*/