1c284bb0fSMatt Madia/*
2c284bb0fSMatt Madia * Copyright (c) 1999-2000, Eric Moon.
3c284bb0fSMatt Madia * All rights reserved.
4c284bb0fSMatt Madia *
5c284bb0fSMatt Madia * Redistribution and use in source and binary forms, with or without
6c284bb0fSMatt Madia * modification, are permitted provided that the following conditions
7c284bb0fSMatt Madia * are met:
8c284bb0fSMatt Madia *
9c284bb0fSMatt Madia * 1. Redistributions of source code must retain the above copyright
10c284bb0fSMatt Madia *    notice, this list of conditions, and the following disclaimer.
11c284bb0fSMatt Madia *
12c284bb0fSMatt Madia * 2. Redistributions in binary form must reproduce the above copyright
13c284bb0fSMatt Madia *    notice, this list of conditions, and the following disclaimer in the
14c284bb0fSMatt Madia *    documentation and/or other materials provided with the distribution.
15c284bb0fSMatt Madia *
16c284bb0fSMatt Madia * 3. The name of the author may not be used to endorse or promote products
17c284bb0fSMatt Madia *    derived from this software without specific prior written permission.
18c284bb0fSMatt Madia *
19c284bb0fSMatt Madia * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
20c284bb0fSMatt Madia * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21c284bb0fSMatt Madia * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22c284bb0fSMatt Madia * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23c284bb0fSMatt Madia * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24c284bb0fSMatt Madia * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25c284bb0fSMatt Madia * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26c284bb0fSMatt Madia * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
27c284bb0fSMatt Madia * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28c284bb0fSMatt Madia * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29c284bb0fSMatt Madia */
30c284bb0fSMatt Madia
31c284bb0fSMatt Madia
32a0795c6fSMarcus Overhagen// NullAudioOp.cpp
33a0795c6fSMarcus Overhagen
34a0795c6fSMarcus Overhagen#include "NullAudioOp.h"
35a0795c6fSMarcus Overhagen#include "IAudioOp.h"
36a0795c6fSMarcus Overhagen#include "IParameterSet.h"
37a0795c6fSMarcus Overhagen
38a0795c6fSMarcus Overhagen#include <Debug.h>
39a0795c6fSMarcus Overhagen#include <ParameterWeb.h>
40a0795c6fSMarcus Overhagen
41a0795c6fSMarcus Overhagen// -------------------------------------------------------- //
42a0795c6fSMarcus Overhagen// _NullAudioOp
43a0795c6fSMarcus Overhagen// -------------------------------------------------------- //
44a0795c6fSMarcus Overhagen
45a0795c6fSMarcus Overhagenclass _NullAudioOp :
46a0795c6fSMarcus Overhagen	public	IAudioOp {
47a0795c6fSMarcus Overhagenpublic:
48a0795c6fSMarcus Overhagen	_NullAudioOp(
49a0795c6fSMarcus Overhagen		IAudioOpHost*						_host) :
50a0795c6fSMarcus Overhagen		IAudioOp(_host) {}
51a0795c6fSMarcus Overhagen
52a0795c6fSMarcus Overhagen	uint32 process(
53a0795c6fSMarcus Overhagen		const AudioBuffer&			source,
54a0795c6fSMarcus Overhagen		AudioBuffer&						destination,
55a0795c6fSMarcus Overhagen		double&									sourceOffset,
56a0795c6fSMarcus Overhagen		uint32&									destinationOffset,
57a0795c6fSMarcus Overhagen		uint32									framesRequired,
58a0795c6fSMarcus Overhagen		bigtime_t								performanceTime) {
59a0795c6fSMarcus Overhagen
60a0795c6fSMarcus Overhagen		return framesRequired;
61a0795c6fSMarcus Overhagen	}
62a0795c6fSMarcus Overhagen
63a0795c6fSMarcus Overhagen	void replace(
64a0795c6fSMarcus Overhagen		IAudioOp*								oldOp) {
65a0795c6fSMarcus Overhagen		delete oldOp;
66a0795c6fSMarcus Overhagen	}
67a0795c6fSMarcus Overhagen};
68a0795c6fSMarcus Overhagen
69a0795c6fSMarcus Overhagen// -------------------------------------------------------- //
70a0795c6fSMarcus Overhagen// _NullParameterSet
71a0795c6fSMarcus Overhagen// -------------------------------------------------------- //
72a0795c6fSMarcus Overhagen
73a0795c6fSMarcus Overhagenclass _NullParameterSet :
74a0795c6fSMarcus Overhagen	public	IParameterSet {
75a0795c6fSMarcus Overhagenpublic:
76a0795c6fSMarcus Overhagen	status_t store(
77a0795c6fSMarcus Overhagen		int32										parameterID,
78a0795c6fSMarcus Overhagen		void*										data,
79a0795c6fSMarcus Overhagen		size_t									size) { return B_ERROR; }
80a0795c6fSMarcus Overhagen
81a0795c6fSMarcus Overhagen	status_t retrieve(
82a0795c6fSMarcus Overhagen		int32										parameterID,
83a0795c6fSMarcus Overhagen		void*										data,
84a0795c6fSMarcus Overhagen		size_t*									ioSize) { return B_ERROR; }
85a0795c6fSMarcus Overhagen
86a0795c6fSMarcus Overhagen	// implement this hook to return a BParameterGroup representing
87a0795c6fSMarcus Overhagen	// the parameters represented by this set
88a0795c6fSMarcus Overhagen
89a0795c6fSMarcus Overhagen	void populateGroup(
90a0795c6fSMarcus Overhagen		BParameterGroup* 				group) {
91a0795c6fSMarcus Overhagen//
92a0795c6fSMarcus Overhagen//		group->MakeNullParameter(
93a0795c6fSMarcus Overhagen//			0,
94a0795c6fSMarcus Overhagen//			B_MEDIA_NO_TYPE,
95a0795c6fSMarcus Overhagen//			"NullFilter has no parameters",
96a0795c6fSMarcus Overhagen//			B_GENERIC);
97a0795c6fSMarcus Overhagen	}
98a0795c6fSMarcus Overhagen};
99a0795c6fSMarcus Overhagen
100a0795c6fSMarcus Overhagen// -------------------------------------------------------- //
101a0795c6fSMarcus Overhagen// NullAudioOpFactory impl.
102a0795c6fSMarcus Overhagen// -------------------------------------------------------- //
103a0795c6fSMarcus Overhagen
104a0795c6fSMarcus OverhagenIAudioOp* NullAudioOpFactory::createOp(
105a0795c6fSMarcus Overhagen	IAudioOpHost*										host,
106a0795c6fSMarcus Overhagen	const media_raw_audio_format&		inputFormat,
107a0795c6fSMarcus Overhagen	const media_raw_audio_format&		outputFormat) {
108a0795c6fSMarcus Overhagen
109a0795c6fSMarcus Overhagen	return new _NullAudioOp(host);
110a0795c6fSMarcus Overhagen}
111a0795c6fSMarcus Overhagen
112a0795c6fSMarcus OverhagenIParameterSet* NullAudioOpFactory::createParameterSet() {
113a0795c6fSMarcus Overhagen	return new _NullParameterSet();
114a0795c6fSMarcus Overhagen}
115a0795c6fSMarcus Overhagen
116a0795c6fSMarcus Overhagen
117a0795c6fSMarcus Overhagen// END -- NullAudioOp.cpp --