xref: /haiku/src/apps/cortex/addons/common/IAudioOpFactory.h (revision 19ae20e67e91fc09cc9fc5c0e60e21e24e7a53eb)
1*c284bb0fSMatt Madia /*
2*c284bb0fSMatt Madia  * Copyright (c) 1999-2000, Eric Moon.
3*c284bb0fSMatt Madia  * All rights reserved.
4*c284bb0fSMatt Madia  *
5*c284bb0fSMatt Madia  * Redistribution and use in source and binary forms, with or without
6*c284bb0fSMatt Madia  * modification, are permitted provided that the following conditions
7*c284bb0fSMatt Madia  * are met:
8*c284bb0fSMatt Madia  *
9*c284bb0fSMatt Madia  * 1. Redistributions of source code must retain the above copyright
10*c284bb0fSMatt Madia  *    notice, this list of conditions, and the following disclaimer.
11*c284bb0fSMatt Madia  *
12*c284bb0fSMatt Madia  * 2. Redistributions in binary form must reproduce the above copyright
13*c284bb0fSMatt Madia  *    notice, this list of conditions, and the following disclaimer in the
14*c284bb0fSMatt Madia  *    documentation and/or other materials provided with the distribution.
15*c284bb0fSMatt Madia  *
16*c284bb0fSMatt Madia  * 3. The name of the author may not be used to endorse or promote products
17*c284bb0fSMatt Madia  *    derived from this software without specific prior written permission.
18*c284bb0fSMatt Madia  *
19*c284bb0fSMatt Madia  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
20*c284bb0fSMatt Madia  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21*c284bb0fSMatt Madia  * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*c284bb0fSMatt Madia  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23*c284bb0fSMatt Madia  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24*c284bb0fSMatt Madia  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25*c284bb0fSMatt Madia  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26*c284bb0fSMatt Madia  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
27*c284bb0fSMatt Madia  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28*c284bb0fSMatt Madia  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29*c284bb0fSMatt Madia  */
30*c284bb0fSMatt Madia 
31*c284bb0fSMatt Madia 
32a0795c6fSMarcus Overhagen // IAudioOpFactory.h
33a0795c6fSMarcus Overhagen // * PURPOSE
34a0795c6fSMarcus Overhagen //   An interface to an 'algorithm finder' object.  Implementations
35a0795c6fSMarcus Overhagen //   of IAudioOpFactory are given format and parameter information,
36a0795c6fSMarcus Overhagen //   and are required to return the best-matching algorithm (IAudioOp
37a0795c6fSMarcus Overhagen //   implementation) -- or 0 if no algorithm can handle the given
38a0795c6fSMarcus Overhagen //   formats.
39a0795c6fSMarcus Overhagen //
40a0795c6fSMarcus Overhagen //   One subclass of IAudioOpFactory should exist for each
41a0795c6fSMarcus Overhagen //   algorithm family, since create() provides no way to select a
42a0795c6fSMarcus Overhagen //   particular algorithm.  The stock create() should produce an
43a0795c6fSMarcus Overhagen //   operation initialized to acceptible defaults, but you can
44a0795c6fSMarcus Overhagen //   always overload create() to provide more options.
45a0795c6fSMarcus Overhagen //
46a0795c6fSMarcus Overhagen // * UP IN THE AIR +++++
47a0795c6fSMarcus Overhagen //   - query mechanism -- determine if a format/parameter change
48a0795c6fSMarcus Overhagen //     will require an algorithm switch?
49a0795c6fSMarcus Overhagen //   - explicit parameter support?  seems a better approach than
50a0795c6fSMarcus Overhagen //     overloading the create() method with parameters for each
51a0795c6fSMarcus Overhagen //     type of filter operation... ?
52a0795c6fSMarcus Overhagen //
53a0795c6fSMarcus Overhagen // * HISTORY
54a0795c6fSMarcus Overhagen //   e.moon		26aug99		Begun.
55a0795c6fSMarcus Overhagen 
56a0795c6fSMarcus Overhagen #ifndef __IAudioOpFactory_H__
57a0795c6fSMarcus Overhagen #define __IAudioOpFactory_H__
58a0795c6fSMarcus Overhagen 
59a0795c6fSMarcus Overhagen #include <MediaDefs.h>
60a0795c6fSMarcus Overhagen 
61a0795c6fSMarcus Overhagen class IAudioOp;
62a0795c6fSMarcus Overhagen class IAudioOpHost;
63a0795c6fSMarcus Overhagen class IParameterSet;
64a0795c6fSMarcus Overhagen 
65a0795c6fSMarcus Overhagen class IAudioOpFactory {
66a0795c6fSMarcus Overhagen public:											// *** INTERFACE
67a0795c6fSMarcus Overhagen 	// The basic operation-creation method.
68a0795c6fSMarcus Overhagen 	// Return 0 if no algorithm could be found for the given format.
69a0795c6fSMarcus Overhagen 
70a0795c6fSMarcus Overhagen 	virtual IAudioOp* createOp(
71a0795c6fSMarcus Overhagen 		IAudioOpHost*										host,
72a0795c6fSMarcus Overhagen 		const media_raw_audio_format&		inputFormat,
73a0795c6fSMarcus Overhagen 		const media_raw_audio_format&		outputFormat) =0;
74a0795c6fSMarcus Overhagen 
75a0795c6fSMarcus Overhagen 	// Return an IParameter object for the category of
76a0795c6fSMarcus Overhagen 	// operation you create.
77a0795c6fSMarcus Overhagen 
78a0795c6fSMarcus Overhagen 	virtual IParameterSet* createParameterSet() =0;
79a0795c6fSMarcus Overhagen 
80a0795c6fSMarcus Overhagen public:											// *** HOOKS
~IAudioOpFactory()81a0795c6fSMarcus Overhagen 	virtual ~IAudioOpFactory() {}
82a0795c6fSMarcus Overhagen };
83a0795c6fSMarcus Overhagen 
84a0795c6fSMarcus Overhagen #endif /*__IAudioOpFactory_H__*/
85