comparison src/portaudio/bindings/cpp/source/portaudiocpp/AsioDeviceAdapter.cxx @ 4:e13257ea84a4

Add bzip2, zlib, liblo, portaudio sources
author Chris Cannam
date Wed, 20 Mar 2013 13:59:52 +0000
parents
children
comparison
equal deleted inserted replaced
3:6c505a35919a 4:e13257ea84a4
1 #include "portaudiocpp/AsioDeviceAdapter.hxx"
2
3 #include "portaudio.h"
4 #include "pa_asio.h"
5
6 #include "portaudiocpp/Device.hxx"
7 #include "portaudiocpp/HostApi.hxx"
8 #include "portaudiocpp/Exception.hxx"
9
10 namespace portaudio
11 {
12 AsioDeviceAdapter::AsioDeviceAdapter(Device &device)
13 {
14 if (device.hostApi().typeId() != paASIO)
15 throw PaCppException(PaCppException::UNABLE_TO_ADAPT_DEVICE);
16
17 device_ = &device;
18
19 PaError err = PaAsio_GetAvailableLatencyValues(device_->index(), &minBufferSize_, &maxBufferSize_,
20 &preferredBufferSize_, &granularity_);
21
22 if (err != paNoError)
23 throw PaException(err);
24
25 }
26
27 Device &AsioDeviceAdapter::device()
28 {
29 return *device_;
30 }
31
32 long AsioDeviceAdapter::minBufferSize() const
33 {
34 return minBufferSize_;
35 }
36
37 long AsioDeviceAdapter::maxBufferSize() const
38 {
39 return maxBufferSize_;
40 }
41
42 long AsioDeviceAdapter::preferredBufferSize() const
43 {
44 return preferredBufferSize_;
45 }
46
47 long AsioDeviceAdapter::granularity() const
48 {
49 return granularity_;
50 }
51
52 void AsioDeviceAdapter::showControlPanel(void *systemSpecific)
53 {
54 PaError err = PaAsio_ShowControlPanel(device_->index(), systemSpecific);
55
56 if (err != paNoError)
57 throw PaException(err);
58 }
59
60 const char *AsioDeviceAdapter::inputChannelName(int channelIndex) const
61 {
62 const char *channelName;
63 PaError err = PaAsio_GetInputChannelName(device_->index(), channelIndex, &channelName);
64
65 if (err != paNoError)
66 throw PaException(err);
67
68 return channelName;
69 }
70
71 const char *AsioDeviceAdapter::outputChannelName(int channelIndex) const
72 {
73 const char *channelName;
74 PaError err = PaAsio_GetOutputChannelName(device_->index(), channelIndex, &channelName);
75
76 if (err != paNoError)
77 throw PaException(err);
78
79 return channelName;
80 }
81 }
82
83