xref: /haiku/src/apps/cortex/addons/AudioAdapter/AudioAdapterNode.h (revision 83b1a68c52ba3e0e8796282759f694b7fdddf06d)
1 /*
2  * Copyright (c) 1999-2000, Eric Moon.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions, and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions, and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * 3. The name of the author may not be used to endorse or promote products
17  *    derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
27  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 
32 // AudioAdapterNode.h
33 #ifndef AUDIO_ADAPTER_NODE_H
34 #define AUDIO_ADAPTER_NODE_H
35 
36 
37 #include "AudioFilterNode.h"
38 #include "AudioAdapterParams.h"
39 
40 
41 class _AudioAdapterNode : public AudioFilterNode {
42 	typedef	AudioFilterNode _inherited;
43 
44 	public:	// ctor/dtor
45 		virtual ~_AudioAdapterNode();
46 		_AudioAdapterNode(const char* name, IAudioOpFactory* opFactory,
47 			BMediaAddOn* addOn = 0);
48 
49 	public:	// AudioFilterNode
50 		status_t getRequiredInputFormat(media_format& ioFormat);
51 		status_t getPreferredInputFormat(media_format& ioFormat);
52 		status_t getRequiredOutputFormat(media_format& ioFormat);
53 
54 		status_t getPreferredOutputFormat(media_format& ioFormat);
55 
56 		status_t validateProposedInputFormat(
57 			const media_format& preferredFormat,
58 			media_format& ioProposedFormat);
59 
60 		status_t validateProposedOutputFormat(
61 			const media_format&	preferredFormat,
62 			media_format& ioProposedFormat);
63 
64 		virtual void SetParameterValue(int32 id, bigtime_t changeTime,
65 			const void* value, size_t size); //nyi
66 
67 	public:	// BBufferProducer/Consumer
68 		virtual status_t Connected(const media_source&	source,
69 			const media_destination& destination,
70 			const media_format& format,
71 			media_input* outInput);
72 
73 		virtual void Connect(status_t status, const media_source& source,
74 			const media_destination& destination,
75 			const media_format& format,
76 			char* ioName);
77 
78 	private:
79 		void _attemptInputFormatChange(
80 		const media_multi_audio_format& format); //nyi
81 
82 		void _attemptOutputFormatChange(
83 			const media_multi_audio_format& format); //nyi
84 
85 		void _broadcastInputFormatParams();
86 		void _broadcastOutputFormatParams();
87 };
88 
89 #endif	// AUDIO_ADAPTER_NODE_H
90