1/*
2 * Copyright 1999, Be Incorporated.
3 * Copyright (c) 1999-2000, Eric Moon.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions, and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions, and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 *
17 * 3. The name of the author may not be used to endorse or promote products
18 *    derived from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
28 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32
33// ToneProducerAddOn.cpp
34// e.moon 4jun99
35
36#include "ToneProducer.h"
37#include "ToneProducerAddOn.h"
38#include <cstring>
39#include <cstdlib>
40
41// instantiation function
42extern "C" _EXPORT BMediaAddOn* make_media_addon(image_id image) {
43	return new ToneProducerAddOn(image);
44}
45
46// -------------------------------------------------------- //
47// ctor/dtor
48// -------------------------------------------------------- //
49
50ToneProducerAddOn::~ToneProducerAddOn() {}
51ToneProducerAddOn::ToneProducerAddOn(image_id image) :
52	BMediaAddOn(image) {}
53
54// -------------------------------------------------------- //
55// BMediaAddOn impl
56// -------------------------------------------------------- //
57
58status_t ToneProducerAddOn::InitCheck(
59	const char** out_failure_text) {
60	return B_OK;
61}
62
63int32 ToneProducerAddOn::CountFlavors() {
64	return 1;
65}
66
67status_t ToneProducerAddOn::GetFlavorAt(
68	int32 n,
69	const flavor_info** out_info) {
70	if(n)
71		return B_ERROR;
72
73	flavor_info* pInfo = new flavor_info;
74	pInfo->internal_id = n;
75	pInfo->name = "ToneProducer";
76	pInfo->info =
77		"An add-on version of the ToneProducer node.\n"
78		"See the Be Developer Newsletter: 2 June, 1999\n"
79		"adapted by Eric Moon (4 June, 1999)";
80	pInfo->kinds = B_BUFFER_PRODUCER | B_CONTROLLABLE;
81	pInfo->flavor_flags = 0;
82	pInfo->possible_count = 0;
83
84	pInfo->in_format_count = 0;
85	pInfo->in_formats = 0;
86
87	pInfo->out_format_count = 1;
88	media_format* pFormat = new media_format;
89	pFormat->type = B_MEDIA_RAW_AUDIO;
90	pFormat->u.raw_audio = media_raw_audio_format::wildcard;
91	pInfo->out_formats = pFormat;
92
93	*out_info = pInfo;
94	return B_OK;
95}
96
97BMediaNode* ToneProducerAddOn::InstantiateNodeFor(
98	const flavor_info* info,
99	BMessage* config,
100	status_t* out_error) {
101
102	return new ToneProducer(this);
103}
104
105status_t ToneProducerAddOn::GetConfigurationFor(
106	BMediaNode* your_node,
107	BMessage* into_message) {
108
109	// no config yet
110	return B_OK;
111}
112
113// END -- ToneProducerAddOn.cpp
114