*** empty log message ***
[chuck-blob.git] / exile / v1 / src / chuck_bbq.h
blob51630e38cd99488253cdd8eb7a3f27d867af811f
1 /*----------------------------------------------------------------------------
2 ChucK Concurrent, On-the-fly Audio Programming Language
3 Compiler and Virtual Machine
5 Copyright (c) 2004 Ge Wang and Perry R. Cook. All rights reserved.
6 http://chuck.cs.princeton.edu/
7 http://soundlab.cs.princeton.edu/
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 U.S.A.
23 -----------------------------------------------------------------------------*/
25 //-----------------------------------------------------------------------------
26 // file: chuck_bbq.h
27 // desc: bbq header
29 // author: Ge Wang (gewang@cs.princeton.edu)
30 // Perry R. Cook (prc@cs.princeton.edu)
31 //-----------------------------------------------------------------------------
32 #ifndef __CHUCK_BBQ_H__
33 #define __CHUCK_BBQ_H__
35 // currently ChucK uses RtAudio | __CHUCK_NATIVE_AUDIO__ not in use
36 #if defined(__CHUCK_NATIVE_AUDIO__)
37 #if defined(__LINUX_ALSA__)
38 #include "digiio_alsa.h"
39 #include "midiio_alsa.h"
40 #elif defined(__LINUX_JACK__)
41 #include "digiio_jack.h"
42 #include "midiio_alsa.h"
43 #elif defined(__LINUX_OSS__)
44 #include "digiio_oss.h"
45 #include "midiio_oss.h"
46 #elif defined(__MACOSX_CORE__)
47 #include "digiio_osx.h"
48 #include "midiio_osx.h"
49 #elif defined(__WINDOWS_DS__)
50 #include "digiio_win32.h"
51 #include "midiio_win32.h"
52 #else
53 #error "must define one:\
54 __LINUX_ALSA__ __LINUX_JACK__ __LINUX_OSS__ __MACOSX_CORE__ __WINDOWS_DS__"
55 #endif
56 #else
57 #include "digiio_rtaudio.h"
58 #if defined(__LINUX_ALSA__)
59 #include "midiio_alsa.h"
60 #elif defined(__LINUX_JACK__)
61 #include "midiio_alsa.h"
62 #elif defined(__LINUX_OSS__)
63 #include "midiio_oss.h"
64 #elif defined(__MACOSX_CORE__)
65 #include "midiio_osx.h"
66 #elif defined(__WINDOWS_DS__)
67 #include "midiio_win32.h"
68 #else
69 #error "must define one:\
70 __LINUX_ALSA__ __LINUX_JACK__ __LINUX_OSS__ __MACOSX_CORE__ __WINDOWS_DS__"
71 #endif
72 #endif
74 #include <vector>
75 using namespace std;
80 //-----------------------------------------------------------------------------
81 // name: class BBQ
82 // desc: ...
83 //-----------------------------------------------------------------------------
84 class BBQ
86 public:
87 BBQ();
88 ~BBQ();
90 public:
91 BOOL__ initialize( DWORD__ num_channels, DWORD__ sampling_rate,
92 DWORD__ bps,
93 DWORD__ buffer_size = BUFFER_SIZE_DEFAULT,
94 DWORD__ num_buffers = NUM_BUFFERS_DEFAULT,
95 DWORD__ dac = 0,
96 DWORD__ adc = 0 );
97 void set_srate( DWORD__ srate );
98 void set_bufsize( DWORD__ bufsize );
99 void shutdown();
101 public:
102 DigitalOut * digi_out();
103 DigitalIn * digi_in();
104 MidiOut * midi_out( DWORD__ index = 0 );
105 MidiIn * midi_in( DWORD__ index = 0 );
107 public:
108 DWORD__ in_count( DWORD__ index = 0 )
109 { return index < m_max_midi_device ? m_in_count[index] : 0; }
110 DWORD__ out_count( DWORD__ index = 0 )
111 { return index < m_max_midi_device ? m_out_count[index] : 0; }
113 protected:
114 DigitalOut * m_digi_out;
115 DigitalIn * m_digi_in;
116 MidiOut ** m_midi_out;
117 MidiIn ** m_midi_in;
118 DWORD__ * m_in_count;
119 DWORD__ * m_out_count;
120 DWORD__ m_max_midi_device;
126 //-----------------------------------------------------------------------------
127 // name: class RangeMapper
128 // desc: ...
129 //-----------------------------------------------------------------------------
130 class RangeMapper
132 public:
133 RangeMapper( SAMPLE low_l, SAMPLE high_l, SAMPLE low_r, SAMPLE high_r );
135 public:
136 virtual SAMPLE map( SAMPLE in );
138 protected:
139 float m_slope;
140 float m_inter;
142 SAMPLE m_low_l;
143 SAMPLE m_high_l;
144 SAMPLE m_low_r;
145 SAMPLE m_high_r;
151 #endif