xref: /haiku/src/add-ons/media/media-add-ons/equalizer/EqualizerAddOn.cpp (revision 4a850ca730d8282b5b924e49e09b4ba4d6db7f54)
1 /*
2  * Copyright 2012, Gerasim Troeglazov (3dEyes**), 3dEyes@gmail.com.
3  * All rights reserved.
4  * Distributed under the terms of the MIT License.
5  */
6 
7 #include <Entry.h>
8 
9 #include "EqualizerNode.h"
10 #include "EqualizerAddOn.h"
11 
12 extern "C" _EXPORT BMediaAddOn* make_media_addon(image_id image)
13 {
14 	return new EqualizerAddOn(image);
15 }
16 
17 EqualizerAddOn::~EqualizerAddOn()
18 {
19 }
20 
21 EqualizerAddOn::EqualizerAddOn(image_id image)
22 	:
23 	BMediaAddOn(image)
24 {
25 }
26 
27 status_t
28 EqualizerAddOn::InitCheck(const char **text)
29 {
30 	return B_OK;
31 }
32 
33 int32
34 EqualizerAddOn::CountFlavors()
35 {
36 	return 1;
37 }
38 
39 status_t EqualizerAddOn::GetFlavorAt(int32 idx, const flavor_info** info)
40 {
41 	if (idx < 0 || idx >= CountFlavors())
42 		return B_ERROR;
43 
44 	flavor_info* f_info = new flavor_info;
45 	f_info->internal_id = idx;
46 	f_info->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE;
47 	f_info->possible_count = 0;
48 	f_info->flavor_flags = 0;
49 	f_info->info = "10 Band Equalizer.\nby 3dEyes**";
50 	f_info->name = "Equalizer (10 Band)";
51 
52 	media_format* format = new media_format;
53 	format->type = B_MEDIA_RAW_AUDIO;
54 	format->u.raw_audio = media_raw_audio_format::wildcard;
55 	format->u.raw_audio.format = media_raw_audio_format::B_AUDIO_FLOAT;
56 
57 	f_info->in_format_count = 1;
58 	f_info->in_formats = format;
59 
60 	format = new media_format;
61 	format->type = B_MEDIA_RAW_AUDIO;
62 	format->u.raw_audio = media_raw_audio_format::wildcard;
63 	format->u.raw_audio.format = media_raw_audio_format::B_AUDIO_FLOAT;
64 
65 	f_info->out_format_count = 1;
66 	f_info->out_formats = format;
67 
68 	*info = f_info;
69 
70 	return B_OK;
71 }
72 
73 BMediaNode*
74 EqualizerAddOn::InstantiateNodeFor(const flavor_info* info, BMessage* config,
75 	status_t* err)
76 {
77 	EqualizerNode* node = new EqualizerNode(this);
78 	return node;
79 }
80 
81 status_t
82 EqualizerAddOn::GetConfigurationFor(BMediaNode* node, BMessage* message)
83 {
84 	return B_OK;
85 }
86 
87 bool
88 EqualizerAddOn::WantsAutoStart()
89 {
90 	return false;
91 }
92 
93 status_t
94 EqualizerAddOn::AutoStart(int count, BMediaNode** node,	int32* id, bool* more)
95 {
96 	return B_OK;
97 }
98