xref: /haiku/src/apps/cortex/addons/common/IAudioOpFactory.h (revision 002f37b0cca92e4cf72857c72ac95db5a8b09615)
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 // IAudioOpFactory.h
33 // * PURPOSE
34 //   An interface to an 'algorithm finder' object.  Implementations
35 //   of IAudioOpFactory are given format and parameter information,
36 //   and are required to return the best-matching algorithm (IAudioOp
37 //   implementation) -- or 0 if no algorithm can handle the given
38 //   formats.
39 //
40 //   One subclass of IAudioOpFactory should exist for each
41 //   algorithm family, since create() provides no way to select a
42 //   particular algorithm.  The stock create() should produce an
43 //   operation initialized to acceptible defaults, but you can
44 //   always overload create() to provide more options.
45 //
46 // * UP IN THE AIR +++++
47 //   - query mechanism -- determine if a format/parameter change
48 //     will require an algorithm switch?
49 //   - explicit parameter support?  seems a better approach than
50 //     overloading the create() method with parameters for each
51 //     type of filter operation... ?
52 //
53 // * HISTORY
54 //   e.moon		26aug99		Begun.
55 
56 #ifndef __IAudioOpFactory_H__
57 #define __IAudioOpFactory_H__
58 
59 #include <MediaDefs.h>
60 
61 class IAudioOp;
62 class IAudioOpHost;
63 class IParameterSet;
64 
65 class IAudioOpFactory {
66 public:											// *** INTERFACE
67 	// The basic operation-creation method.
68 	// Return 0 if no algorithm could be found for the given format.
69 
70 	virtual IAudioOp* createOp(
71 		IAudioOpHost*										host,
72 		const media_raw_audio_format&		inputFormat,
73 		const media_raw_audio_format&		outputFormat) =0;
74 
75 	// Return an IParameter object for the category of
76 	// operation you create.
77 
78 	virtual IParameterSet* createParameterSet() =0;
79 
80 public:											// *** HOOKS
81 	virtual ~IAudioOpFactory() {}
82 };
83 
84 #endif /*__IAudioOpFactory_H__*/
85