1 /* Written by Eric Moon, from the Cortex Source code archive. 2 * Distributed under the terms of the Be Sample Code License 3 */ 4 5 // ToneProducerAddOn.cpp 6 // e.moon 4jun99 7 8 #include "ToneProducer.h" 9 #include "ToneProducerAddOn.h" 10 #include <cstring> 11 #include <cstdlib> 12 13 // instantiation function 14 extern "C" _EXPORT BMediaAddOn* make_media_addon(image_id image) { 15 return new ToneProducerAddOn(image); 16 } 17 18 // -------------------------------------------------------- // 19 // ctor/dtor 20 // -------------------------------------------------------- // 21 22 ToneProducerAddOn::~ToneProducerAddOn() {} 23 ToneProducerAddOn::ToneProducerAddOn(image_id image) : 24 BMediaAddOn(image) {} 25 26 // -------------------------------------------------------- // 27 // BMediaAddOn impl 28 // -------------------------------------------------------- // 29 30 status_t ToneProducerAddOn::InitCheck( 31 const char** out_failure_text) { 32 return B_OK; 33 } 34 35 int32 ToneProducerAddOn::CountFlavors() { 36 return 1; 37 } 38 39 status_t ToneProducerAddOn::GetFlavorAt( 40 int32 n, 41 const flavor_info** out_info) { 42 if(n) 43 return B_ERROR; 44 45 flavor_info* pInfo = new flavor_info; 46 pInfo->internal_id = n; 47 pInfo->name = (char *)"Demo Audio Producer"; 48 pInfo->info = (char *) 49 "An add-on version of the ToneProducer node.\n" 50 "See the Be Developer Newsletter: 2 June, 1999\n" 51 "adapted by Eric Moon (4 June, 1999)"; 52 pInfo->kinds = B_BUFFER_PRODUCER | B_CONTROLLABLE; 53 pInfo->flavor_flags = 0; 54 pInfo->possible_count = 0; 55 56 pInfo->in_format_count = 0; 57 pInfo->in_formats = 0; 58 59 pInfo->out_format_count = 1; 60 media_format* pFormat = new media_format; 61 pFormat->type = B_MEDIA_RAW_AUDIO; 62 pFormat->u.raw_audio = media_raw_audio_format::wildcard; 63 pInfo->out_formats = pFormat; 64 65 *out_info = pInfo; 66 return B_OK; 67 } 68 69 BMediaNode* ToneProducerAddOn::InstantiateNodeFor( 70 const flavor_info* info, 71 BMessage* config, 72 status_t* out_error) { 73 74 return new ToneProducer(this); 75 } 76 77 status_t ToneProducerAddOn::GetConfigurationFor( 78 BMediaNode* your_node, 79 BMessage* into_message) { 80 81 // no config yet 82 return B_OK; 83 } 84 85 // END -- ToneProducerAddOn.cpp 86