xref: /haiku/src/apps/cortex/addons/audioOps/NullAudioOp.cpp (revision 19ae20e67e91fc09cc9fc5c0e60e21e24e7a53eb)
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 // NullAudioOp.cpp
33 
34 #include "NullAudioOp.h"
35 #include "IAudioOp.h"
36 #include "IParameterSet.h"
37 
38 #include <Debug.h>
39 #include <ParameterWeb.h>
40 
41 // -------------------------------------------------------- //
42 // _NullAudioOp
43 // -------------------------------------------------------- //
44 
45 class _NullAudioOp :
46 	public	IAudioOp {
47 public:
_NullAudioOp(IAudioOpHost * _host)48 	_NullAudioOp(
49 		IAudioOpHost*						_host) :
50 		IAudioOp(_host) {}
51 
process(const AudioBuffer & source,AudioBuffer & destination,double & sourceOffset,uint32 & destinationOffset,uint32 framesRequired,bigtime_t performanceTime)52 	uint32 process(
53 		const AudioBuffer&			source,
54 		AudioBuffer&						destination,
55 		double&									sourceOffset,
56 		uint32&									destinationOffset,
57 		uint32									framesRequired,
58 		bigtime_t								performanceTime) {
59 
60 		return framesRequired;
61 	}
62 
replace(IAudioOp * oldOp)63 	void replace(
64 		IAudioOp*								oldOp) {
65 		delete oldOp;
66 	}
67 };
68 
69 // -------------------------------------------------------- //
70 // _NullParameterSet
71 // -------------------------------------------------------- //
72 
73 class _NullParameterSet :
74 	public	IParameterSet {
75 public:
store(int32 parameterID,void * data,size_t size)76 	status_t store(
77 		int32										parameterID,
78 		void*										data,
79 		size_t									size) { return B_ERROR; }
80 
retrieve(int32 parameterID,void * data,size_t * ioSize)81 	status_t retrieve(
82 		int32										parameterID,
83 		void*										data,
84 		size_t*									ioSize) { return B_ERROR; }
85 
86 	// implement this hook to return a BParameterGroup representing
87 	// the parameters represented by this set
88 
populateGroup(BParameterGroup * group)89 	void populateGroup(
90 		BParameterGroup* 				group) {
91 //
92 //		group->MakeNullParameter(
93 //			0,
94 //			B_MEDIA_NO_TYPE,
95 //			"NullFilter has no parameters",
96 //			B_GENERIC);
97 	}
98 };
99 
100 // -------------------------------------------------------- //
101 // NullAudioOpFactory impl.
102 // -------------------------------------------------------- //
103 
createOp(IAudioOpHost * host,const media_raw_audio_format & inputFormat,const media_raw_audio_format & outputFormat)104 IAudioOp* NullAudioOpFactory::createOp(
105 	IAudioOpHost*										host,
106 	const media_raw_audio_format&		inputFormat,
107 	const media_raw_audio_format&		outputFormat) {
108 
109 	return new _NullAudioOp(host);
110 }
111 
createParameterSet()112 IParameterSet* NullAudioOpFactory::createParameterSet() {
113 	return new _NullParameterSet();
114 }
115 
116 
117 // END -- NullAudioOp.cpp --