2 * Copyright 2002 David Shipman,
3 * Copyright 2003-2007 Marcus Overhagen
4 * Copyright 2007 Haiku Inc. All rights reserved.
5 * Distributed under the terms of the MIT License.
9 #include "MixerAddOn.h"
14 #include <MediaRoster.h>
15 #include <MediaNode.h>
17 #include "AudioMixer.h"
20 // instantiation function
21 extern "C" _EXPORT BMediaAddOn
* make_media_addon(image_id image
) {
22 return new AudioMixerAddon(image
);
26 AudioMixerAddon::AudioMixerAddon(image_id image
)
29 fFormat(new media_format
),
30 fInfo(new flavor_info
)
32 memset(fFormat
, 0, sizeof(*fFormat
));
33 fFormat
->type
= B_MEDIA_RAW_AUDIO
;
34 fFormat
->u
.raw_audio
= media_raw_audio_format::wildcard
;
36 fInfo
->internal_id
= 0;
37 fInfo
->name
= (char *)"Audio Mixer (Haiku)";
38 fInfo
->info
= (char *)"Haiku Audio Mixer media addon";
39 fInfo
->kinds
= B_BUFFER_PRODUCER
| B_BUFFER_CONSUMER
| B_SYSTEM_MIXER
| B_CONTROLLABLE
;
40 fInfo
->flavor_flags
= 0; // 0 = global or local instantiation allowed, no restrictions
41 fInfo
->possible_count
= 0; // 0 = infinite
42 fInfo
->in_format_count
= 1;
43 fInfo
->in_formats
= fFormat
;
44 fInfo
->out_format_count
= 1;
45 fInfo
->out_formats
= fFormat
;
49 AudioMixerAddon::~AudioMixerAddon()
56 // #pragma mark - BMediaAddOn implementation
60 AudioMixerAddon::InitCheck(const char** out_failure_text
)
67 AudioMixerAddon::CountFlavors()
74 AudioMixerAddon::GetFlavorAt(int32 n
, const flavor_info
** out_info
)
76 // only the 0th flavor exists
86 AudioMixerAddon::InstantiateNodeFor(const flavor_info
* info
, BMessage
* config
,
89 return new AudioMixer(this, false);
94 AudioMixerAddon::GetConfigurationFor(BMediaNode
* your_node
,
95 BMessage
* into_message
)
103 AudioMixerAddon::WantsAutoStart()
110 AudioMixerAddon::AutoStart(int in_index
, BMediaNode
**out_node
,
111 int32
*out_internal_id
, bool *out_has_more
)
113 *out_has_more
= false;
118 *out_internal_id
= 0;
119 AudioMixer
*mixer
= new AudioMixer(this, true);