Cortex: delete ToneProducer add-on.
The version of this in src/add-ons/media/media-add-ons/tone_producer_demo/ is virtually identical, plus it is under a more permissive license (Be Sample Code vs. BSD 3-Clause) and already fixed for 64bit.
This commit is contained in:
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999, Be Incorporated.
|
|
||||||
* Copyright (c) 1999-2000, Eric Moon.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
* OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
||||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "NodeHarnessApp.h"
|
|
||||||
#include "NodeHarnessWin.h"
|
|
||||||
|
|
||||||
NodeHarnessApp::NodeHarnessApp(const char *signature)
|
|
||||||
: BApplication(signature)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
NodeHarnessApp::ReadyToRun()
|
|
||||||
{
|
|
||||||
BWindow* win = new NodeHarnessWin(BRect(100, 200, 210, 330), "ToneProducer");
|
|
||||||
win->Show();
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999, Be Incorporated.
|
|
||||||
* Copyright (c) 1999-2000, Eric Moon.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
* OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
||||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NodeHarnessApp_H
|
|
||||||
#define NodeHarnessApp_H 1
|
|
||||||
|
|
||||||
#include <app/Application.h>
|
|
||||||
|
|
||||||
class NodeHarnessApp : public BApplication
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NodeHarnessApp(const char* signature);
|
|
||||||
void ReadyToRun();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,237 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999, Be Incorporated.
|
|
||||||
* Copyright (c) 1999-2000, Eric Moon.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
* OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
||||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "NodeHarnessWin.h"
|
|
||||||
#include "ToneProducer.h"
|
|
||||||
#include <app/Application.h>
|
|
||||||
#include <interface/Button.h>
|
|
||||||
#include <storage/Entry.h>
|
|
||||||
#include <media/MediaRoster.h>
|
|
||||||
#include <media/MediaAddOn.h>
|
|
||||||
#include <media/TimeSource.h>
|
|
||||||
#include <media/MediaTheme.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
const int32 BUTTON_CONNECT = 'Cnct';
|
|
||||||
const int32 BUTTON_START = 'Strt';
|
|
||||||
const int32 BUTTON_STOP = 'Stop';
|
|
||||||
|
|
||||||
#define TEST_WITH_AUDIO 1
|
|
||||||
|
|
||||||
// --------------------
|
|
||||||
// static utility functions
|
|
||||||
static void ErrorCheck(status_t err, const char* msg)
|
|
||||||
{
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "* FATAL ERROR (%s): %s\n", strerror(err), msg);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------
|
|
||||||
// NodeHarnessWin implementation
|
|
||||||
NodeHarnessWin::NodeHarnessWin(BRect frame, const char *title)
|
|
||||||
: BWindow(frame, title, B_TITLED_WINDOW, B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS),
|
|
||||||
mToneNode(NULL), mIsConnected(false), mIsRunning(false)
|
|
||||||
{
|
|
||||||
// build the UI
|
|
||||||
BRect r(10, 10, 100, 40);
|
|
||||||
mConnectButton = new BButton(r, "Connect", "Connect", new BMessage(BUTTON_CONNECT));
|
|
||||||
mConnectButton->SetEnabled(true);
|
|
||||||
AddChild(mConnectButton);
|
|
||||||
r.OffsetBy(0, 40);
|
|
||||||
mStartButton = new BButton(r, "Start", "Start", new BMessage(BUTTON_START));
|
|
||||||
mStartButton->SetEnabled(false);
|
|
||||||
AddChild(mStartButton);
|
|
||||||
r.OffsetBy(0, 40);
|
|
||||||
mStopButton = new BButton(r, "Stop", "Stop", new BMessage(BUTTON_STOP));
|
|
||||||
mStopButton->SetEnabled(false);
|
|
||||||
AddChild(mStopButton);
|
|
||||||
|
|
||||||
// e.moon 2jun99: create the node
|
|
||||||
BMediaRoster* roster = BMediaRoster::Roster();
|
|
||||||
mToneNode = new ToneProducer();
|
|
||||||
|
|
||||||
status_t err = roster->RegisterNode(mToneNode);
|
|
||||||
ErrorCheck(err, "unable to register ToneProducer node!\n");
|
|
||||||
// make sure the Media Roster knows that we're using the node
|
|
||||||
roster->GetNodeFor(mToneNode->Node().node, &mConnection.producer);
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeHarnessWin::~NodeHarnessWin()
|
|
||||||
{
|
|
||||||
BMediaRoster* r = BMediaRoster::Roster();
|
|
||||||
|
|
||||||
// tear down the node network
|
|
||||||
if (mIsRunning) StopNodes();
|
|
||||||
if (mIsConnected)
|
|
||||||
{
|
|
||||||
status_t err;
|
|
||||||
|
|
||||||
// Ordinarily we'd stop *all* of the nodes in the chain at this point. However,
|
|
||||||
// one of the nodes is the System Mixer, and stopping the Mixer is a Bad Idea (tm).
|
|
||||||
// So, we just disconnect from it, and release our references to the nodes that
|
|
||||||
// we're using. We *are* supposed to do that even for global nodes like the Mixer.
|
|
||||||
err = r->Disconnect(mConnection.producer.node, mConnection.source,
|
|
||||||
mConnection.consumer.node, mConnection.destination);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "* Error disconnecting nodes: %ld (%s)\n", err, strerror(err));
|
|
||||||
}
|
|
||||||
|
|
||||||
r->ReleaseNode(mConnection.producer);
|
|
||||||
r->ReleaseNode(mConnection.consumer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
NodeHarnessWin::Quit()
|
|
||||||
{
|
|
||||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
|
||||||
BWindow::Quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
NodeHarnessWin::MessageReceived(BMessage *msg)
|
|
||||||
{
|
|
||||||
status_t err;
|
|
||||||
|
|
||||||
switch (msg->what)
|
|
||||||
{
|
|
||||||
case BUTTON_CONNECT:
|
|
||||||
mIsConnected = true;
|
|
||||||
|
|
||||||
// set the button states appropriately
|
|
||||||
mConnectButton->SetEnabled(false);
|
|
||||||
mStartButton->SetEnabled(true);
|
|
||||||
|
|
||||||
// set up the node network
|
|
||||||
{
|
|
||||||
BMediaRoster* r = BMediaRoster::Roster();
|
|
||||||
|
|
||||||
// connect to the mixer
|
|
||||||
err = r->GetAudioMixer(&mConnection.consumer);
|
|
||||||
ErrorCheck(err, "unable to get the system mixer");
|
|
||||||
|
|
||||||
// fire off a window with the ToneProducer's controls in it
|
|
||||||
BParameterWeb* web;
|
|
||||||
r->GetParameterWebFor(mConnection.producer, &web);
|
|
||||||
BView* view = BMediaTheme::ViewFor(web);
|
|
||||||
BWindow* win = new BWindow(BRect(250, 200, 300, 300), "Controls",
|
|
||||||
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS);
|
|
||||||
win->AddChild(view);
|
|
||||||
win->ResizeTo(view->Bounds().Width(), view->Bounds().Height());
|
|
||||||
win->Show();
|
|
||||||
|
|
||||||
// set the producer's time source to be the "default" time source, which
|
|
||||||
// the Mixer uses too.
|
|
||||||
r->GetTimeSource(&mTimeSource);
|
|
||||||
r->SetTimeSourceFor(mConnection.producer.node, mTimeSource.node);
|
|
||||||
|
|
||||||
// got the nodes; now we find the endpoints of the connection
|
|
||||||
media_input mixerInput;
|
|
||||||
media_output soundOutput;
|
|
||||||
int32 count = 1;
|
|
||||||
err = r->GetFreeOutputsFor(mConnection.producer, &soundOutput, 1, &count);
|
|
||||||
ErrorCheck(err, "unable to get a free output from the producer node");
|
|
||||||
count = 1;
|
|
||||||
err = r->GetFreeInputsFor(mConnection.consumer, &mixerInput, 1, &count);
|
|
||||||
ErrorCheck(err, "unable to get a free input to the mixer");
|
|
||||||
|
|
||||||
// got the endpoints; now we connect it!
|
|
||||||
media_format format;
|
|
||||||
format.type = B_MEDIA_RAW_AUDIO;
|
|
||||||
format.u.raw_audio = media_raw_audio_format::wildcard;
|
|
||||||
err = r->Connect(soundOutput.source, mixerInput.destination, &format, &soundOutput, &mixerInput);
|
|
||||||
ErrorCheck(err, "unable to connect nodes");
|
|
||||||
|
|
||||||
// the inputs and outputs might have been reassigned during the
|
|
||||||
// nodes' negotiation of the Connect(). That's why we wait until
|
|
||||||
// after Connect() finishes to save their contents.
|
|
||||||
mConnection.format = format;
|
|
||||||
mConnection.source = soundOutput.source;
|
|
||||||
mConnection.destination = mixerInput.destination;
|
|
||||||
|
|
||||||
// Set an appropriate run mode for the producer
|
|
||||||
r->SetRunModeNode(mConnection.producer, BMediaNode::B_INCREASE_LATENCY);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BUTTON_START:
|
|
||||||
mStartButton->SetEnabled(false);
|
|
||||||
mStopButton->SetEnabled(true);
|
|
||||||
|
|
||||||
// start the producer running
|
|
||||||
{
|
|
||||||
BMediaRoster* r = BMediaRoster::Roster();
|
|
||||||
BTimeSource* ts = r->MakeTimeSourceFor(mConnection.producer);
|
|
||||||
if (!ts)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "* ERROR - MakeTimeSourceFor(producer) returned NULL!\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure we give the producer enough time to run buffers through
|
|
||||||
// the node chain, otherwise it'll start up already late
|
|
||||||
bigtime_t latency = 0;
|
|
||||||
r->GetLatencyFor(mConnection.producer, &latency);
|
|
||||||
r->StartNode(mConnection.producer, ts->Now() + latency);
|
|
||||||
ts->Release();
|
|
||||||
mIsRunning = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BUTTON_STOP:
|
|
||||||
StopNodes();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
BWindow::MessageReceived(msg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Private routines
|
|
||||||
void
|
|
||||||
NodeHarnessWin::StopNodes()
|
|
||||||
{
|
|
||||||
mStartButton->SetEnabled(true);
|
|
||||||
mStopButton->SetEnabled(false);
|
|
||||||
|
|
||||||
// generally, one only stops the initial producer(s), and lets the rest of the node
|
|
||||||
// chain just follow along as the buffers drain out.
|
|
||||||
{
|
|
||||||
BMediaRoster* r = BMediaRoster::Roster();
|
|
||||||
r->StopNode(mConnection.producer, 0, true); // synchronous stop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999, Be Incorporated.
|
|
||||||
* Copyright (c) 1999-2000, Eric Moon.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
* OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
||||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NodeHarnessWin_H
|
|
||||||
#define NodeHarnessWin_H 1
|
|
||||||
|
|
||||||
#include <interface/Window.h>
|
|
||||||
#include <media/MediaNode.h>
|
|
||||||
|
|
||||||
class BButton;
|
|
||||||
class ToneProducer;
|
|
||||||
|
|
||||||
// A handy encapsulation of a Media Kit connection, including all
|
|
||||||
// information necessary to do any post-Connect() actions.
|
|
||||||
struct Connection
|
|
||||||
{
|
|
||||||
media_node producer, consumer;
|
|
||||||
media_source source;
|
|
||||||
media_destination destination;
|
|
||||||
media_format format;
|
|
||||||
};
|
|
||||||
|
|
||||||
// The window that runs our simple test application
|
|
||||||
class NodeHarnessWin : public BWindow
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NodeHarnessWin(BRect frame, const char* title);
|
|
||||||
~NodeHarnessWin();
|
|
||||||
|
|
||||||
void Quit();
|
|
||||||
void MessageReceived(BMessage* msg);
|
|
||||||
|
|
||||||
ToneProducer* GetToneNode() const { return mToneNode; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
void StopNodes();
|
|
||||||
|
|
||||||
BButton* mConnectButton;
|
|
||||||
BButton* mStartButton;
|
|
||||||
BButton* mStopButton;
|
|
||||||
|
|
||||||
Connection mConnection;
|
|
||||||
ToneProducer* mToneNode;
|
|
||||||
bool mIsConnected;
|
|
||||||
bool mIsRunning;
|
|
||||||
media_node mTimeSource;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,258 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999, Be Incorporated.
|
|
||||||
* Copyright (c) 1999-2000, Eric Moon.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
* OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
||||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
ToneProducer.h
|
|
||||||
|
|
||||||
NOTES [email protected] 11june99
|
|
||||||
- this node has some holes in it, but it's pretty useful starting
|
|
||||||
point for writing producers.
|
|
||||||
- I've tried to clean up the format negotiation a bit, which didn't
|
|
||||||
fare too well when faced with an apathetic downstream node
|
|
||||||
(LoggingConsumer.)
|
|
||||||
|
|
||||||
KNOWN BUGS
|
|
||||||
eamoon 17jun99
|
|
||||||
* Can't handle 2 channels, but is too polite to refuse.
|
|
||||||
How embarrassing.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ToneProducer_H
|
|
||||||
#define ToneProducer_H 1
|
|
||||||
|
|
||||||
#include <media/BufferProducer.h>
|
|
||||||
#include <media/MediaEventLooper.h>
|
|
||||||
#include <media/Controllable.h>
|
|
||||||
|
|
||||||
class BMediaAddOn;
|
|
||||||
|
|
||||||
// ----------------
|
|
||||||
// ToneProducer - a node to generate precisely defined digital tones
|
|
||||||
class ToneProducer : public BBufferProducer, public BControllable, public BMediaEventLooper
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum event_t {
|
|
||||||
// e.moon 2jun99
|
|
||||||
_PARAMETER_EVENT = BTimedEventQueue::B_USER_EVENT
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
// add-on-friendly ctor
|
|
||||||
// e.moon [8jun99]
|
|
||||||
ToneProducer(BMediaAddOn* pAddOn=0);
|
|
||||||
~ToneProducer();
|
|
||||||
|
|
||||||
// BMediaNode methods
|
|
||||||
BMediaAddOn* AddOn( int32* internal_id) const;
|
|
||||||
|
|
||||||
// BControllable methods
|
|
||||||
status_t GetParameterValue(
|
|
||||||
int32 id,
|
|
||||||
bigtime_t* last_change,
|
|
||||||
void* value,
|
|
||||||
size_t* ioSize);
|
|
||||||
|
|
||||||
void SetParameterValue(
|
|
||||||
int32 id,
|
|
||||||
bigtime_t when,
|
|
||||||
const void* value,
|
|
||||||
size_t size);
|
|
||||||
|
|
||||||
status_t StartControlPanel(
|
|
||||||
BMessenger* pMessenger);
|
|
||||||
|
|
||||||
// BBufferProducer methods
|
|
||||||
status_t FormatSuggestionRequested(
|
|
||||||
media_type type,
|
|
||||||
int32 quality,
|
|
||||||
media_format* format);
|
|
||||||
|
|
||||||
status_t FormatProposal(
|
|
||||||
const media_source& output,
|
|
||||||
media_format* format);
|
|
||||||
|
|
||||||
/* If the format isn't good, put a good format into *io_format and return error */
|
|
||||||
/* If format has wildcard, specialize to what you can do (and change). */
|
|
||||||
/* If you can change the format, return OK. */
|
|
||||||
/* The request comes from your destination sychronously, so you cannot ask it */
|
|
||||||
/* whether it likes it -- you should assume it will since it asked. */
|
|
||||||
status_t FormatChangeRequested(
|
|
||||||
const media_source& source,
|
|
||||||
const media_destination& destination,
|
|
||||||
media_format* io_format,
|
|
||||||
int32* _deprecated_);
|
|
||||||
|
|
||||||
status_t GetNextOutput( /* cookie starts as 0 */
|
|
||||||
int32* cookie,
|
|
||||||
media_output* out_output);
|
|
||||||
|
|
||||||
status_t DisposeOutputCookie(
|
|
||||||
int32 cookie);
|
|
||||||
|
|
||||||
/* In this function, you should either pass on the group to your upstream guy, */
|
|
||||||
/* or delete your current group and hang on to this group. Deleting the previous */
|
|
||||||
/* group (unless you passed it on with the reclaim flag set to false) is very */
|
|
||||||
/* important, else you will 1) leak memory and 2) block someone who may want */
|
|
||||||
/* to reclaim the buffers living in that group. */
|
|
||||||
status_t SetBufferGroup(
|
|
||||||
const media_source& for_source,
|
|
||||||
BBufferGroup* group);
|
|
||||||
|
|
||||||
/* Iterates over all outputs and maxes the latency found */
|
|
||||||
status_t GetLatency(
|
|
||||||
bigtime_t* out_latency);
|
|
||||||
|
|
||||||
status_t PrepareToConnect(
|
|
||||||
const media_source& what,
|
|
||||||
const media_destination& where,
|
|
||||||
media_format* format,
|
|
||||||
media_source* out_source,
|
|
||||||
char* out_name);
|
|
||||||
|
|
||||||
void Connect(
|
|
||||||
status_t error,
|
|
||||||
const media_source& source,
|
|
||||||
const media_destination& destination,
|
|
||||||
const media_format& format,
|
|
||||||
char* io_name);
|
|
||||||
|
|
||||||
void Disconnect(
|
|
||||||
const media_source& what,
|
|
||||||
const media_destination& where);
|
|
||||||
|
|
||||||
void LateNoticeReceived(
|
|
||||||
const media_source& what,
|
|
||||||
bigtime_t how_much,
|
|
||||||
bigtime_t performance_time);
|
|
||||||
|
|
||||||
void EnableOutput(
|
|
||||||
const media_source & what,
|
|
||||||
bool enabled,
|
|
||||||
int32* _deprecated_);
|
|
||||||
|
|
||||||
status_t SetPlayRate(
|
|
||||||
int32 numer,
|
|
||||||
int32 denom);
|
|
||||||
|
|
||||||
status_t HandleMessage(
|
|
||||||
int32 message,
|
|
||||||
const void* data,
|
|
||||||
size_t size);
|
|
||||||
|
|
||||||
void AdditionalBufferRequested(
|
|
||||||
const media_source& source,
|
|
||||||
media_buffer_id prev_buffer,
|
|
||||||
bigtime_t prev_time,
|
|
||||||
const media_seek_tag* prev_tag); // may be NULL
|
|
||||||
|
|
||||||
void LatencyChanged(
|
|
||||||
const media_source& source,
|
|
||||||
const media_destination& destination,
|
|
||||||
bigtime_t new_latency,
|
|
||||||
uint32 flags);
|
|
||||||
|
|
||||||
// BMediaEventLooper methods
|
|
||||||
void NodeRegistered();
|
|
||||||
|
|
||||||
void Start(bigtime_t performance_time);
|
|
||||||
|
|
||||||
// Workaround for a Metrowerks PPC compiler bug
|
|
||||||
void Stop(bigtime_t performance_time, bool immediate);
|
|
||||||
|
|
||||||
// Workaround for a Metrowerks PPC compiler bug
|
|
||||||
void Seek(bigtime_t media_time, bigtime_t performance_time);
|
|
||||||
|
|
||||||
// Workaround for a Metrowerks PPC compiler bug
|
|
||||||
void TimeWarp(bigtime_t at_real_time, bigtime_t to_performance_time);
|
|
||||||
|
|
||||||
// Workaround for a Metrowerks PPC compiler bug
|
|
||||||
status_t AddTimer(bigtime_t at_performance_time, int32 cookie);
|
|
||||||
|
|
||||||
void SetRunMode(run_mode mode);
|
|
||||||
|
|
||||||
void HandleEvent(
|
|
||||||
const media_timed_event* event,
|
|
||||||
bigtime_t lateness,
|
|
||||||
bool realTimeEvent = false);
|
|
||||||
|
|
||||||
/* removed e.moon 2jun99
|
|
||||||
protected:
|
|
||||||
// Workaround for a Metrowerks PPC compiler bug
|
|
||||||
void CleanUpEvent(const media_timed_event *event);
|
|
||||||
|
|
||||||
// Workaround for a Metrowerks PPC compiler bug
|
|
||||||
bigtime_t OfflineTime();
|
|
||||||
|
|
||||||
// Workaround for a Metrowerks PPC compiler bug
|
|
||||||
void ControlLoop();
|
|
||||||
|
|
||||||
// Workaround for a Metrowerks PPC compiler bug
|
|
||||||
status_t DeleteHook(BMediaNode* node);
|
|
||||||
*/
|
|
||||||
|
|
||||||
private:
|
|
||||||
void AllocateBuffers();
|
|
||||||
BBuffer* FillNextBuffer(bigtime_t event_time);
|
|
||||||
|
|
||||||
// 20sep99 e.moon: stereo support
|
|
||||||
void FillSineBuffer(float* data, size_t numFrames, bool stereo);
|
|
||||||
void FillTriangleBuffer(float* data, size_t numFrames, bool stereo);
|
|
||||||
void FillSawtoothBuffer(float* data, size_t numFrames, bool stereo);
|
|
||||||
|
|
||||||
BParameterWeb* mWeb;
|
|
||||||
BBufferGroup* mBufferGroup;
|
|
||||||
bigtime_t mLatency, mInternalLatency;
|
|
||||||
media_output mOutput;
|
|
||||||
bool mOutputEnabled;
|
|
||||||
media_format mPreferredFormat;
|
|
||||||
|
|
||||||
// These next attributes are related to tone buffer generation
|
|
||||||
double mTheta; // generic parameter used by all generators
|
|
||||||
bool mWaveAscending; // used by the triangle-wave generator
|
|
||||||
float mFrequency; // can be anything, in Hertz
|
|
||||||
float mGain; // should be in the range [0,1]
|
|
||||||
int32 mWaveform;
|
|
||||||
uint64 mFramesSent;
|
|
||||||
bigtime_t mStartTime;
|
|
||||||
|
|
||||||
// more parameter handling
|
|
||||||
bigtime_t mGainLastChanged;
|
|
||||||
bigtime_t mFreqLastChanged;
|
|
||||||
bigtime_t mWaveLastChanged;
|
|
||||||
|
|
||||||
// host addon
|
|
||||||
// [8jun99] e.moon
|
|
||||||
BMediaAddOn* m_pAddOn;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999, Be Incorporated.
|
|
||||||
* Copyright (c) 1999-2000, Eric Moon.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
* OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
||||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// ToneProducerAddOn.cpp
|
|
||||||
// e.moon 4jun99
|
|
||||||
|
|
||||||
#include "ToneProducer.h"
|
|
||||||
#include "ToneProducerAddOn.h"
|
|
||||||
#include <cstring>
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
// instantiation function
|
|
||||||
extern "C" _EXPORT BMediaAddOn* make_media_addon(image_id image) {
|
|
||||||
return new ToneProducerAddOn(image);
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------- //
|
|
||||||
// ctor/dtor
|
|
||||||
// -------------------------------------------------------- //
|
|
||||||
|
|
||||||
ToneProducerAddOn::~ToneProducerAddOn() {}
|
|
||||||
ToneProducerAddOn::ToneProducerAddOn(image_id image) :
|
|
||||||
BMediaAddOn(image) {}
|
|
||||||
|
|
||||||
// -------------------------------------------------------- //
|
|
||||||
// BMediaAddOn impl
|
|
||||||
// -------------------------------------------------------- //
|
|
||||||
|
|
||||||
status_t ToneProducerAddOn::InitCheck(
|
|
||||||
const char** out_failure_text) {
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 ToneProducerAddOn::CountFlavors() {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
status_t ToneProducerAddOn::GetFlavorAt(
|
|
||||||
int32 n,
|
|
||||||
const flavor_info** out_info) {
|
|
||||||
if(n)
|
|
||||||
return B_ERROR;
|
|
||||||
|
|
||||||
flavor_info* pInfo = new flavor_info;
|
|
||||||
pInfo->internal_id = n;
|
|
||||||
pInfo->name = "ToneProducer";
|
|
||||||
pInfo->info =
|
|
||||||
"An add-on version of the ToneProducer node.\n"
|
|
||||||
"See the Be Developer Newsletter: 2 June, 1999\n"
|
|
||||||
"adapted by Eric Moon (4 June, 1999)";
|
|
||||||
pInfo->kinds = B_BUFFER_PRODUCER | B_CONTROLLABLE;
|
|
||||||
pInfo->flavor_flags = 0;
|
|
||||||
pInfo->possible_count = 0;
|
|
||||||
|
|
||||||
pInfo->in_format_count = 0;
|
|
||||||
pInfo->in_formats = 0;
|
|
||||||
|
|
||||||
pInfo->out_format_count = 1;
|
|
||||||
media_format* pFormat = new media_format;
|
|
||||||
pFormat->type = B_MEDIA_RAW_AUDIO;
|
|
||||||
pFormat->u.raw_audio = media_raw_audio_format::wildcard;
|
|
||||||
pInfo->out_formats = pFormat;
|
|
||||||
|
|
||||||
*out_info = pInfo;
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
BMediaNode* ToneProducerAddOn::InstantiateNodeFor(
|
|
||||||
const flavor_info* info,
|
|
||||||
BMessage* config,
|
|
||||||
status_t* out_error) {
|
|
||||||
|
|
||||||
return new ToneProducer(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
status_t ToneProducerAddOn::GetConfigurationFor(
|
|
||||||
BMediaNode* your_node,
|
|
||||||
BMessage* into_message) {
|
|
||||||
|
|
||||||
// no config yet
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// END -- ToneProducerAddOn.cpp
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999, Be Incorporated.
|
|
||||||
* Copyright (c) 1999-2000, Eric Moon.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
* OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
||||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// ToneProducerAddOn.h
|
|
||||||
// e.moon 4jun99
|
|
||||||
//
|
|
||||||
// PURPOSE
|
|
||||||
// Quickie AddOn class for the ToneProducer node.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef __ToneProducerAddOn_H__
|
|
||||||
#define __ToneProducerAddOn_H__
|
|
||||||
|
|
||||||
#include <MediaAddOn.h>
|
|
||||||
|
|
||||||
// -------------------------------------------------------- //
|
|
||||||
|
|
||||||
class ToneProducerAddOn :
|
|
||||||
public BMediaAddOn {
|
|
||||||
typedef BMediaAddOn _inherited;
|
|
||||||
|
|
||||||
public: // ctor/dtor
|
|
||||||
virtual ~ToneProducerAddOn();
|
|
||||||
explicit ToneProducerAddOn(image_id image);
|
|
||||||
|
|
||||||
public: // BMediaAddOn impl
|
|
||||||
virtual status_t InitCheck(
|
|
||||||
const char** out_failure_text);
|
|
||||||
virtual int32 CountFlavors();
|
|
||||||
virtual status_t GetFlavorAt(
|
|
||||||
int32 n,
|
|
||||||
const flavor_info ** out_info);
|
|
||||||
virtual BMediaNode * InstantiateNodeFor(
|
|
||||||
const flavor_info * info,
|
|
||||||
BMessage * config,
|
|
||||||
status_t * out_error);
|
|
||||||
virtual status_t GetConfigurationFor(
|
|
||||||
BMediaNode * your_node,
|
|
||||||
BMessage * into_message);
|
|
||||||
|
|
||||||
virtual bool WantsAutoStart() { return false; }
|
|
||||||
virtual status_t AutoStart(
|
|
||||||
int in_count,
|
|
||||||
BMediaNode ** out_node,
|
|
||||||
int32 * out_internal_id,
|
|
||||||
bool * out_has_more) { return B_OK; }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*__ToneProducerAddOn_H__*/
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999, Be Incorporated.
|
|
||||||
* Copyright (c) 1999-2000, Eric Moon.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions, and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
* OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
||||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "NodeHarnessApp.h"
|
|
||||||
#include "MediaNodeControlApp.h"
|
|
||||||
#include <cstring>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <MediaDefs.h>
|
|
||||||
|
|
||||||
const char* const g_pAppSignature = "application/x-vnd.Be.ToneProducerApp";
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
|
||||||
if(argc < 2 || strstr(argv[1], "node=") != argv[1]) {
|
|
||||||
// start in stand-alone app mode
|
|
||||||
NodeHarnessApp app(g_pAppSignature);
|
|
||||||
app.Run();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// start control-panel app
|
|
||||||
media_node_id id = atol(argv[1] + 5);
|
|
||||||
MediaNodeControlApp app(g_pAppSignature, id);
|
|
||||||
app.Run();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
## BeOS Generic Makefile v2.1 ##
|
|
||||||
|
|
||||||
## Fill in this file to specify the project being created, and the referenced
|
|
||||||
## makefile-engine will do all of the hard work for you. This handles both
|
|
||||||
## Intel and PowerPC builds of the BeOS.
|
|
||||||
|
|
||||||
## Application Specific Settings ---------------------------------------------
|
|
||||||
|
|
||||||
# specify the name of the binary
|
|
||||||
NAME= ToneProducerApp
|
|
||||||
|
|
||||||
# specify the type of binary
|
|
||||||
# APP: Application
|
|
||||||
# SHARED: Shared library or add-on
|
|
||||||
# STATIC: Static library archive
|
|
||||||
# DRIVER: Kernel Driver
|
|
||||||
TYPE= APP
|
|
||||||
|
|
||||||
# add support for new Pe and Eddie features
|
|
||||||
# to fill in generic makefile
|
|
||||||
|
|
||||||
#%{
|
|
||||||
# @src->@
|
|
||||||
|
|
||||||
# specify the source files to use
|
|
||||||
# full paths or paths relative to the makefile can be included
|
|
||||||
# all files, regardless of directory, will have their object
|
|
||||||
# files created in the common object directory.
|
|
||||||
# Note that this means this makefile will not work correctly
|
|
||||||
# if two source files with the same name (source.c or source.cpp)
|
|
||||||
# are included from different directories. Also note that spaces
|
|
||||||
# in folder names do not work well with this makefile.
|
|
||||||
SRCS= \
|
|
||||||
ToneProducerAddOn.cpp \
|
|
||||||
../common/MediaNodeControlApp.cpp \
|
|
||||||
ToneProducer.cpp \
|
|
||||||
NodeHarnessApp.cpp \
|
|
||||||
NodeHarnessWin.cpp \
|
|
||||||
main.cpp
|
|
||||||
|
|
||||||
# specify the resource files to use
|
|
||||||
# full path or a relative path to the resource file can be used.
|
|
||||||
RSRCS=
|
|
||||||
|
|
||||||
# @<-src@
|
|
||||||
#%}
|
|
||||||
|
|
||||||
# end support for Pe and Eddie
|
|
||||||
|
|
||||||
# specify additional libraries to link against
|
|
||||||
# there are two acceptable forms of library specifications
|
|
||||||
# - if your library follows the naming pattern of:
|
|
||||||
# libXXX.so or libXXX.a you can simply specify XXX
|
|
||||||
# library: libbe.so entry: be
|
|
||||||
#
|
|
||||||
# - if your library does not follow the standard library
|
|
||||||
# naming scheme you need to specify the path to the library
|
|
||||||
# and it's name
|
|
||||||
# library: my_lib.a entry: my_lib.a or path/my_lib.a
|
|
||||||
LIBS= be media
|
|
||||||
|
|
||||||
# specify additional paths to directories following the standard
|
|
||||||
# libXXX.so or libXXX.a naming scheme. You can specify full paths
|
|
||||||
# or paths relative to the makefile. The paths included may not
|
|
||||||
# be recursive, so include all of the paths where libraries can
|
|
||||||
# be found. Directories where source files are found are
|
|
||||||
# automatically included.
|
|
||||||
LIBPATHS=
|
|
||||||
|
|
||||||
# additional paths to look for system headers
|
|
||||||
# thes use the form: #include <header>
|
|
||||||
# source file directories are NOT auto-included here
|
|
||||||
SYSTEM_INCLUDE_PATHS =
|
|
||||||
|
|
||||||
# additional paths to look for local headers
|
|
||||||
# thes use the form: #include "header"
|
|
||||||
# source file directories are automatically included
|
|
||||||
LOCAL_INCLUDE_PATHS =
|
|
||||||
|
|
||||||
# specify the level of optimization that you desire
|
|
||||||
# NONE, SOME, FULL
|
|
||||||
OPTIMIZE= FULL
|
|
||||||
|
|
||||||
# specify any preprocessor symbols to be defined. The symbols will not
|
|
||||||
# have their values set automatically; you must supply the value (if any)
|
|
||||||
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
|
|
||||||
# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG"
|
|
||||||
# would pass "-DDEBUG" on the compiler's command line.
|
|
||||||
#DEFINES=
|
|
||||||
DEFINES= #DEBUG=1
|
|
||||||
|
|
||||||
# specify special warning levels
|
|
||||||
# if unspecified default warnings will be used
|
|
||||||
# NONE = supress all warnings
|
|
||||||
# ALL = enable all warnings
|
|
||||||
WARNINGS = ALL
|
|
||||||
|
|
||||||
# specify whether image symbols will be created
|
|
||||||
# so that stack crawls in the debugger are meaningful
|
|
||||||
# if TRUE symbols will be created
|
|
||||||
SYMBOLS =
|
|
||||||
|
|
||||||
# specify debug settings
|
|
||||||
# if TRUE will allow application to be run from a source-level
|
|
||||||
# debugger. Note that this will disable all optimzation.
|
|
||||||
DEBUGGER = #TRUE
|
|
||||||
|
|
||||||
# specify additional compiler flags for all files
|
|
||||||
COMPILER_FLAGS =
|
|
||||||
|
|
||||||
# specify additional linker flags
|
|
||||||
LINKER_FLAGS =
|
|
||||||
|
|
||||||
|
|
||||||
## include the makefile-engine
|
|
||||||
include /boot/develop/etc/makefile-engine
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user