comparison src/Modules/Output/OSCOutput.h @ 509:0284d2152e17

Add support for outputting featutes using OSC (for use with the Wekinator, etc).
author tomwalters@google.com
date Fri, 22 Jun 2012 12:22:08 +0000
parents
children
comparison
equal deleted inserted replaced
508:d609725e568a 509:0284d2152e17
1 // Copyright 2012, Tom Walters
2 //
3 // AIM-C: A C++ implementation of the Auditory Image Model
4 // http://www.acousticscale.org/AIMC
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17
18 /*!
19 * \author Tom Walters <tom@acousticscale.org>
20 * \date created 2012/02/17
21 * \version \$Id$
22 */
23
24 #ifndef AIMC_MODULES_OUTPUT_OSC_H_
25 #define AIMC_MODULES_OUTPUT_OSC_H_
26
27 #include "Support/Module.h"
28
29 #include <string>
30
31 #include "osc/OscOutboundPacketStream.h"
32 #include "ip/UdpSocket.h"
33
34 namespace aimc {
35 class OSCOutput : public Module {
36 public:
37 explicit OSCOutput(Parameters *pParam);
38 virtual ~OSCOutput();
39
40 /*! \brief Process a buffer
41 */
42 virtual void Process(const SignalBank &input);
43
44 private:
45 /*! \brief Reset the internal state of the module
46 */
47 virtual void ResetInternal();
48
49 /*! \brief Prepare the module
50 * \param input Input signal
51 * \param output true on success false on failure
52 */
53 virtual bool InitializeInternal(const SignalBank &input);
54
55 float sample_rate_;
56 int buffer_length_;
57 int channel_count_;
58 string address_;
59 int port_;
60 int output_buffer_size_;
61
62 UdpTransmitSocket* transmit_socket_;
63 osc::OutboundPacketStream* packet_stream_;
64 char* buffer_;
65 };
66 } // namespace aimc
67
68 #endif // AIMC_MODULES_OUTPUT_OSC_H_