xref: /haiku/src/apps/cortex/addons/audioOps/NullAudioOp.cpp (revision 1d9d47fc72028bb71b5f232a877231e59cfe2438)
1 // NullAudioOp.cpp
2 
3 #include "NullAudioOp.h"
4 #include "IAudioOp.h"
5 #include "IParameterSet.h"
6 
7 #include <Debug.h>
8 #include <ParameterWeb.h>
9 
10 // -------------------------------------------------------- //
11 // _NullAudioOp
12 // -------------------------------------------------------- //
13 
14 class _NullAudioOp :
15 	public	IAudioOp {
16 public:
17 	_NullAudioOp(
18 		IAudioOpHost*						_host) :
19 		IAudioOp(_host) {}
20 
21 	uint32 process(
22 		const AudioBuffer&			source,
23 		AudioBuffer&						destination,
24 		double&									sourceOffset,
25 		uint32&									destinationOffset,
26 		uint32									framesRequired,
27 		bigtime_t								performanceTime) {
28 
29 		return framesRequired;
30 	}
31 
32 	void replace(
33 		IAudioOp*								oldOp) {
34 		delete oldOp;
35 	}
36 };
37 
38 // -------------------------------------------------------- //
39 // _NullParameterSet
40 // -------------------------------------------------------- //
41 
42 class _NullParameterSet :
43 	public	IParameterSet {
44 public:
45 	status_t store(
46 		int32										parameterID,
47 		void*										data,
48 		size_t									size) { return B_ERROR; }
49 
50 	status_t retrieve(
51 		int32										parameterID,
52 		void*										data,
53 		size_t*									ioSize) { return B_ERROR; }
54 
55 	// implement this hook to return a BParameterGroup representing
56 	// the parameters represented by this set
57 
58 	void populateGroup(
59 		BParameterGroup* 				group) {
60 //
61 //		group->MakeNullParameter(
62 //			0,
63 //			B_MEDIA_NO_TYPE,
64 //			"NullFilter has no parameters",
65 //			B_GENERIC);
66 	}
67 };
68 
69 // -------------------------------------------------------- //
70 // NullAudioOpFactory impl.
71 // -------------------------------------------------------- //
72 
73 IAudioOp* NullAudioOpFactory::createOp(
74 	IAudioOpHost*										host,
75 	const media_raw_audio_format&		inputFormat,
76 	const media_raw_audio_format&		outputFormat) {
77 
78 	return new _NullAudioOp(host);
79 }
80 
81 IParameterSet* NullAudioOpFactory::createParameterSet() {
82 	return new _NullParameterSet();
83 }
84 
85 
86 // END -- NullAudioOp.cpp --