xref: /haiku/src/apps/cortex/addons/Flanger/FlangerAddOn.cpp (revision 268f99dd7dc4bd7474a8bd2742d3f1ec1de6752a)
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 // FlangerAddOn.cpp
33a0795c6fSMarcus Overhagen // e.moon 16jun99
34a0795c6fSMarcus Overhagen 
35a0795c6fSMarcus Overhagen #include "FlangerNode.h"
36a0795c6fSMarcus Overhagen #include "FlangerAddOn.h"
372cba2d56SDancsó Róbert #include <Catalog.h>
38a0795c6fSMarcus Overhagen #include <Entry.h>
39a0795c6fSMarcus Overhagen #include <Debug.h>
40a0795c6fSMarcus Overhagen #include <cstring>
41a0795c6fSMarcus Overhagen #include <cstdlib>
42a0795c6fSMarcus Overhagen 
432cba2d56SDancsó Róbert #undef B_TRANSLATION_CONTEXT
442cba2d56SDancsó Róbert #define B_TRANSLATION_CONTEXT "CortexAddOnsFlanger"
452cba2d56SDancsó Róbert 
46a0795c6fSMarcus Overhagen // instantiation function
47a0795c6fSMarcus Overhagen extern "C" _EXPORT BMediaAddOn* make_media_addon(image_id image);
make_media_addon(image_id image)48a0795c6fSMarcus Overhagen extern "C" _EXPORT BMediaAddOn* make_media_addon(image_id image) {
49a0795c6fSMarcus Overhagen 	return new FlangerAddOn(image);
50a0795c6fSMarcus Overhagen }
51a0795c6fSMarcus Overhagen 
52a0795c6fSMarcus Overhagen // -------------------------------------------------------- //
53a0795c6fSMarcus Overhagen // ctor/dtor
54a0795c6fSMarcus Overhagen // -------------------------------------------------------- //
55a0795c6fSMarcus Overhagen 
~FlangerAddOn()56a0795c6fSMarcus Overhagen FlangerAddOn::~FlangerAddOn() {
57a0795c6fSMarcus Overhagen 	PRINT(("~FlangerAddOn()\n"));
58a0795c6fSMarcus Overhagen }
FlangerAddOn(image_id image)59a0795c6fSMarcus Overhagen FlangerAddOn::FlangerAddOn(image_id image) :
60a0795c6fSMarcus Overhagen 	BMediaAddOn(image) {}
61a0795c6fSMarcus Overhagen 
62a0795c6fSMarcus Overhagen // -------------------------------------------------------- //
63a0795c6fSMarcus Overhagen // BMediaAddOn impl
64a0795c6fSMarcus Overhagen // -------------------------------------------------------- //
65a0795c6fSMarcus Overhagen 
InitCheck(const char ** out_failure_text)66a0795c6fSMarcus Overhagen status_t FlangerAddOn::InitCheck(
67a0795c6fSMarcus Overhagen 	const char** out_failure_text) {
68a0795c6fSMarcus Overhagen 	return B_OK;
69a0795c6fSMarcus Overhagen }
70a0795c6fSMarcus Overhagen 
CountFlavors()71a0795c6fSMarcus Overhagen int32 FlangerAddOn::CountFlavors() {
72a0795c6fSMarcus Overhagen 	return 1;
73a0795c6fSMarcus Overhagen }
74a0795c6fSMarcus Overhagen 
GetFlavorAt(int32 n,const flavor_info ** out_info)75a0795c6fSMarcus Overhagen status_t FlangerAddOn::GetFlavorAt(
76a0795c6fSMarcus Overhagen 	int32 n,
77a0795c6fSMarcus Overhagen 	const flavor_info** out_info) {
78a0795c6fSMarcus Overhagen 	if(n)
79a0795c6fSMarcus Overhagen 		return B_ERROR;
80a0795c6fSMarcus Overhagen 
81a0795c6fSMarcus Overhagen 	flavor_info* pInfo = new flavor_info;
82a0795c6fSMarcus Overhagen 	pInfo->internal_id = n;
83*fb5c24d8SAdrien Destugues 	pInfo->name = B_TRANSLATE("Flanger");
84*fb5c24d8SAdrien Destugues 	pInfo->info = B_TRANSLATE("An add-on version of FlangerNode.\n"
852cba2d56SDancsó Róbert 		"by Eric Moon (16 June, 1999)");
86a0795c6fSMarcus Overhagen 	pInfo->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE;
87a0795c6fSMarcus Overhagen 	pInfo->flavor_flags = 0;
88a0795c6fSMarcus Overhagen 	pInfo->possible_count = 0;
89a0795c6fSMarcus Overhagen 
90a0795c6fSMarcus Overhagen 	pInfo->in_format_count = 1;
91a0795c6fSMarcus Overhagen 	media_format* pFormat = new media_format;
92a0795c6fSMarcus Overhagen 	pFormat->type = B_MEDIA_RAW_AUDIO;
93a0795c6fSMarcus Overhagen 	pFormat->u.raw_audio = media_raw_audio_format::wildcard;
94a0795c6fSMarcus Overhagen 	pFormat->u.raw_audio.format = media_raw_audio_format::B_AUDIO_FLOAT;
95a0795c6fSMarcus Overhagen 	pInfo->in_formats = pFormat;
96a0795c6fSMarcus Overhagen 
97a0795c6fSMarcus Overhagen 	pInfo->out_format_count = 1;
98a0795c6fSMarcus Overhagen 	pFormat = new media_format;
99a0795c6fSMarcus Overhagen 	pFormat->type = B_MEDIA_RAW_AUDIO;
100a0795c6fSMarcus Overhagen 	pFormat->u.raw_audio = media_raw_audio_format::wildcard;
101a0795c6fSMarcus Overhagen 	pFormat->u.raw_audio.format = media_raw_audio_format::B_AUDIO_FLOAT;
102a0795c6fSMarcus Overhagen 	pInfo->out_formats = pFormat;
103a0795c6fSMarcus Overhagen 
104a0795c6fSMarcus Overhagen 	*out_info = pInfo;
105a0795c6fSMarcus Overhagen 	return B_OK;
106a0795c6fSMarcus Overhagen }
107a0795c6fSMarcus Overhagen 
InstantiateNodeFor(const flavor_info * info,BMessage * config,status_t * out_error)108a0795c6fSMarcus Overhagen BMediaNode* FlangerAddOn::InstantiateNodeFor(
109a0795c6fSMarcus Overhagen 	const flavor_info* info,
110a0795c6fSMarcus Overhagen 	BMessage* config,
111a0795c6fSMarcus Overhagen 	status_t* out_error) {
112a0795c6fSMarcus Overhagen 
113a0795c6fSMarcus Overhagen 	FlangerNode* pNode = new FlangerNode(this);
114a0795c6fSMarcus Overhagen 	return pNode;
115a0795c6fSMarcus Overhagen }
116a0795c6fSMarcus Overhagen 
GetConfigurationFor(BMediaNode * your_node,BMessage * into_message)117a0795c6fSMarcus Overhagen status_t FlangerAddOn::GetConfigurationFor(
118a0795c6fSMarcus Overhagen 	BMediaNode* your_node,
119a0795c6fSMarcus Overhagen 	BMessage* into_message) {
120a0795c6fSMarcus Overhagen 
121a0795c6fSMarcus Overhagen 	// no config yet
122a0795c6fSMarcus Overhagen 	return B_OK;
123a0795c6fSMarcus Overhagen }
124a0795c6fSMarcus Overhagen 
125a0795c6fSMarcus Overhagen // END -- FlangerAddOn.h --
126