mirror of
https://review.haiku-os.org/haiku
synced 2025-01-21 05:53:46 +01:00
Adjusted the copyright header, to account for Be Sample Code License and
copyrights. Automatic whitespace cleanup. No functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42635 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
c284bb0ff6
commit
a820304d86
@ -1,31 +0,0 @@
|
||||
----------------------
|
||||
Be Sample Code License
|
||||
----------------------
|
||||
|
||||
Copyright 1991-1999, Be Incorporated.
|
||||
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.
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1991-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -145,7 +146,7 @@ LogWriter::~LogWriter()
|
||||
//
|
||||
// This method, called by the client, really just enqueues a message to the writer thread,
|
||||
// which will deal with it in the HandleMessage() method.
|
||||
void
|
||||
void
|
||||
LogWriter::Log(log_what what, const log_message& data)
|
||||
{
|
||||
bigtime_t now = ::system_time();
|
||||
@ -155,7 +156,7 @@ LogWriter::Log(log_what what, const log_message& data)
|
||||
}
|
||||
|
||||
// Enable or disable a particular log_what code's output
|
||||
void
|
||||
void
|
||||
LogWriter::SetEnabled(log_what what, bool enable)
|
||||
{
|
||||
if (enable) mFilters.erase(what);
|
||||
@ -163,7 +164,7 @@ LogWriter::SetEnabled(log_what what, bool enable)
|
||||
}
|
||||
|
||||
// enabling everything means just clearing out the filter set
|
||||
void
|
||||
void
|
||||
LogWriter::EnableAllMessages()
|
||||
{
|
||||
mFilters.clear();
|
||||
@ -171,7 +172,7 @@ LogWriter::EnableAllMessages()
|
||||
|
||||
// disabling everything is more tedious -- we have to add them all to the
|
||||
// filter set, one by one
|
||||
void
|
||||
void
|
||||
LogWriter::DisableAllMessages()
|
||||
{
|
||||
// mFilters.insert(LOG_QUIT); // don't disable our quit messages
|
||||
@ -222,7 +223,7 @@ LogWriter::DisableAllMessages()
|
||||
|
||||
// Writer thread's message handling function -- this is where messages are actuall
|
||||
// formatted and written to the log file
|
||||
void
|
||||
void
|
||||
LogWriter::HandleMessage(log_what what, const log_message& msg)
|
||||
{
|
||||
char buf[256]; // scratch buffer for building logged output
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1991-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1991-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -92,7 +93,7 @@ static BParameterWeb* build_parameter_web()
|
||||
LoggingConsumer::LoggingConsumer(
|
||||
const entry_ref& logFile,
|
||||
BMediaAddOn* pAddOn)
|
||||
|
||||
|
||||
: BMediaNode("LoggingConsumer"),
|
||||
BBufferConsumer(B_MEDIA_UNKNOWN_TYPE),
|
||||
BControllable(),
|
||||
@ -135,19 +136,19 @@ LoggingConsumer::~LoggingConsumer()
|
||||
// Log message filtering control
|
||||
//
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::SetEnabled(log_what what, bool enable)
|
||||
{
|
||||
mLogger->SetEnabled(what, enable);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::EnableAllMessages()
|
||||
{
|
||||
mLogger->EnableAllMessages();
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::DisableAllMessages()
|
||||
{
|
||||
mLogger->DisableAllMessages();
|
||||
@ -170,7 +171,7 @@ LoggingConsumer::AddOn(int32 *internal_id) const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::SetRunMode(run_mode mode)
|
||||
{
|
||||
// !!! Need to handle offline mode etc. properly!
|
||||
@ -181,7 +182,7 @@ LoggingConsumer::SetRunMode(run_mode mode)
|
||||
BMediaEventLooper::SetRunMode(mode);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::Preroll()
|
||||
{
|
||||
log_message logMsg;
|
||||
@ -191,7 +192,7 @@ LoggingConsumer::Preroll()
|
||||
BMediaEventLooper::Preroll();
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::SetTimeSource(BTimeSource* time_source)
|
||||
{
|
||||
log_message logMsg;
|
||||
@ -201,7 +202,7 @@ LoggingConsumer::SetTimeSource(BTimeSource* time_source)
|
||||
BMediaNode::SetTimeSource(time_source);
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
LoggingConsumer::RequestCompleted(const media_request_info &info)
|
||||
{
|
||||
log_message logMsg;
|
||||
@ -211,7 +212,7 @@ LoggingConsumer::RequestCompleted(const media_request_info &info)
|
||||
return BMediaNode::RequestCompleted(info);
|
||||
}
|
||||
|
||||
// e.moon [11jun99; testing add-on]
|
||||
// e.moon [11jun99; testing add-on]
|
||||
status_t
|
||||
LoggingConsumer::DeleteHook(BMediaNode* pNode) {
|
||||
PRINT(("LoggingConsumer::DeleteHook(%p)\n", pNode));
|
||||
@ -225,7 +226,7 @@ LoggingConsumer::DeleteHook(BMediaNode* pNode) {
|
||||
// BControllable methods
|
||||
//
|
||||
|
||||
status_t
|
||||
status_t
|
||||
LoggingConsumer::GetParameterValue(int32 id, bigtime_t* last_change, void* value, size_t* ioSize)
|
||||
{
|
||||
log_message logMsg;
|
||||
@ -266,7 +267,7 @@ LoggingConsumer::GetParameterValue(int32 id, bigtime_t* last_change, void* value
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::SetParameterValue(int32 id, bigtime_t performance_time, const void* value, size_t size)
|
||||
{
|
||||
log_message logMsg;
|
||||
@ -298,7 +299,7 @@ LoggingConsumer::SetParameterValue(int32 id, bigtime_t performance_time, const v
|
||||
// BBufferConsumer methods
|
||||
//
|
||||
|
||||
status_t
|
||||
status_t
|
||||
LoggingConsumer::HandleMessage(int32 message, const void *data, size_t size)
|
||||
{
|
||||
log_message logMsg;
|
||||
@ -315,7 +316,7 @@ LoggingConsumer::HandleMessage(int32 message, const void *data, size_t size)
|
||||
|
||||
// all of these next methods are pure virtual in BBufferConsumer
|
||||
|
||||
status_t
|
||||
status_t
|
||||
LoggingConsumer::AcceptFormat(const media_destination& dest, media_format* format)
|
||||
{
|
||||
char formatStr[256];
|
||||
@ -334,14 +335,14 @@ LoggingConsumer::AcceptFormat(const media_destination& dest, media_format* forma
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
LoggingConsumer::GetNextInput(int32* cookie, media_input* out_input)
|
||||
{
|
||||
// we have a single hardcoded input that can accept any kind of media data
|
||||
if (0 == *cookie)
|
||||
{
|
||||
mInput.format.type = B_MEDIA_UNKNOWN_TYPE; // accept any format
|
||||
|
||||
|
||||
*out_input = mInput;
|
||||
*cookie = 1;
|
||||
return B_OK;
|
||||
@ -349,14 +350,14 @@ LoggingConsumer::GetNextInput(int32* cookie, media_input* out_input)
|
||||
else return B_BAD_INDEX;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::DisposeInputCookie(int32 /*cookie*/ )
|
||||
{
|
||||
// we don't use any kind of state or extra storage for iterating over our
|
||||
// inputs, so we don't have to do any special disposal of input cookies.
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::BufferReceived(BBuffer* buffer)
|
||||
{
|
||||
bigtime_t bufferStart = buffer->Header()->start_time;
|
||||
@ -393,7 +394,7 @@ LoggingConsumer::BufferReceived(BBuffer* buffer)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::ProducerDataStatus(const media_destination& for_whom, int32 status, bigtime_t at_performance_time)
|
||||
{
|
||||
log_message logMsg;
|
||||
@ -409,7 +410,7 @@ LoggingConsumer::ProducerDataStatus(const media_destination& for_whom, int32 sta
|
||||
}
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
LoggingConsumer::GetLatencyFor(const media_destination& for_whom, bigtime_t* out_latency, media_node_id* out_timesource)
|
||||
{
|
||||
// make sure this is one of my valid inputs
|
||||
@ -422,7 +423,7 @@ LoggingConsumer::GetLatencyFor(const media_destination& for_whom, bigtime_t* out
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
LoggingConsumer::Connected(
|
||||
const media_source& producer,
|
||||
const media_destination& where,
|
||||
@ -454,7 +455,7 @@ LoggingConsumer::Connected(
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::Disconnected(
|
||||
const media_source& producer,
|
||||
const media_destination& where)
|
||||
@ -467,7 +468,7 @@ LoggingConsumer::Disconnected(
|
||||
memset(&mInput, 0, sizeof(mInput));
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
LoggingConsumer::FormatChanged(
|
||||
const media_source& producer,
|
||||
const media_destination& consumer,
|
||||
@ -481,7 +482,7 @@ LoggingConsumer::FormatChanged(
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
LoggingConsumer::SeekTagRequested(
|
||||
const media_destination& destination,
|
||||
bigtime_t in_target_time,
|
||||
@ -501,7 +502,7 @@ LoggingConsumer::SeekTagRequested(
|
||||
// BMediaEventLooper virtual methods
|
||||
//
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::NodeRegistered()
|
||||
{
|
||||
log_message logMsg;
|
||||
@ -523,7 +524,7 @@ LoggingConsumer::NodeRegistered()
|
||||
strcpy(mInput.name, "Logged input");
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::Start(bigtime_t performance_time)
|
||||
{
|
||||
PRINT(("LoggingConsumer::Start(%Ld): now %Ld\n", performance_time, TimeSource()->Now()));
|
||||
@ -535,7 +536,7 @@ LoggingConsumer::Start(bigtime_t performance_time)
|
||||
BMediaEventLooper::Start(performance_time);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::Stop(bigtime_t performance_time, bool immediate)
|
||||
{
|
||||
log_message logMsg;
|
||||
@ -545,7 +546,7 @@ LoggingConsumer::Stop(bigtime_t performance_time, bool immediate)
|
||||
BMediaEventLooper::Stop(performance_time, immediate);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::Seek(bigtime_t media_time, bigtime_t performance_time)
|
||||
{
|
||||
log_message logMsg;
|
||||
@ -555,7 +556,7 @@ LoggingConsumer::Seek(bigtime_t media_time, bigtime_t performance_time)
|
||||
BMediaEventLooper::Seek(media_time, performance_time);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::TimeWarp(bigtime_t at_real_time, bigtime_t to_performance_time)
|
||||
{
|
||||
log_message logMsg;
|
||||
@ -565,7 +566,7 @@ LoggingConsumer::TimeWarp(bigtime_t at_real_time, bigtime_t to_performance_time)
|
||||
BMediaEventLooper::TimeWarp(at_real_time, to_performance_time);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LoggingConsumer::HandleEvent(const media_timed_event *event, bigtime_t /* lateness */, bool /* realTimeEvent */)
|
||||
{
|
||||
log_message logMsg;
|
||||
@ -628,12 +629,12 @@ LoggingConsumer::HandleEvent(const media_timed_event *event, bigtime_t /* latene
|
||||
break;
|
||||
|
||||
// !!! change to B_PARAMETER as soon as it's available
|
||||
|
||||
|
||||
// +++++ e.moon [16jun99]
|
||||
// !!! this can't be right: the parameter value is accessed by the pointer
|
||||
// originally passed to SetParameterValue(). there's no guarantee that
|
||||
// value's still valid, is there?
|
||||
|
||||
|
||||
case BTimedEventQueue::B_USER_EVENT:
|
||||
{
|
||||
size_t dataSize = size_t(event->data);
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1991-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -138,7 +139,7 @@ public:
|
||||
/* the format; you should not ask him about it in here. */
|
||||
status_t FormatChanged(
|
||||
const media_source& producer,
|
||||
const media_destination& consumer,
|
||||
const media_destination& consumer,
|
||||
int32 change_tag,
|
||||
const media_format& format);
|
||||
|
||||
@ -149,7 +150,7 @@ public:
|
||||
status_t SeekTagRequested(
|
||||
const media_destination& destination,
|
||||
bigtime_t in_target_time,
|
||||
uint32 in_flags,
|
||||
uint32 in_flags,
|
||||
media_seek_tag* out_seek_tag,
|
||||
bigtime_t* out_tagged_time,
|
||||
uint32* out_flags);
|
||||
@ -181,7 +182,7 @@ private:
|
||||
bigtime_t mLastLatencyChange; // when did we last change our latency?
|
||||
bigtime_t mLastSpinChange; // when did we last change our CPU usage?
|
||||
bigtime_t mLastPrioChange; // when did we last change thread priority?
|
||||
|
||||
|
||||
// host addon
|
||||
// [11jun99] e.moon
|
||||
BMediaAddOn* m_pAddOn;
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1991-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -57,7 +58,7 @@ LoggingConsumerAddOn::~LoggingConsumerAddOn() {
|
||||
}
|
||||
LoggingConsumerAddOn::LoggingConsumerAddOn(image_id image) :
|
||||
BMediaAddOn(image) {}
|
||||
|
||||
|
||||
// -------------------------------------------------------- //
|
||||
// BMediaAddOn impl
|
||||
// -------------------------------------------------------- //
|
||||
@ -66,7 +67,7 @@ status_t LoggingConsumerAddOn::InitCheck(
|
||||
const char** out_failure_text) {
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
int32 LoggingConsumerAddOn::CountFlavors() {
|
||||
return 1;
|
||||
}
|
||||
@ -76,7 +77,7 @@ status_t LoggingConsumerAddOn::GetFlavorAt(
|
||||
const flavor_info** out_info) {
|
||||
if(n)
|
||||
return B_ERROR;
|
||||
|
||||
|
||||
flavor_info* pInfo = new flavor_info;
|
||||
pInfo->internal_id = n;
|
||||
pInfo->name = "LoggingConsumer";
|
||||
@ -87,7 +88,7 @@ status_t LoggingConsumerAddOn::GetFlavorAt(
|
||||
pInfo->kinds = B_BUFFER_CONSUMER | B_CONTROLLABLE;
|
||||
pInfo->flavor_flags = 0;
|
||||
pInfo->possible_count = 0;
|
||||
|
||||
|
||||
pInfo->in_format_count = 1;
|
||||
media_format* pFormat = new media_format;
|
||||
pFormat->type = B_MEDIA_UNKNOWN_TYPE;
|
||||
@ -95,8 +96,8 @@ status_t LoggingConsumerAddOn::GetFlavorAt(
|
||||
|
||||
pInfo->out_format_count = 0;
|
||||
pInfo->out_formats = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
*out_info = pInfo;
|
||||
return B_OK;
|
||||
}
|
||||
@ -109,7 +110,7 @@ BMediaNode* LoggingConsumerAddOn::InstantiateNodeFor(
|
||||
// initialize log file
|
||||
entry_ref ref;
|
||||
get_ref_for_path(g_pLogPath, &ref);
|
||||
LoggingConsumer* pNode = new LoggingConsumer(ref, this);
|
||||
LoggingConsumer* pNode = new LoggingConsumer(ref, this);
|
||||
|
||||
// trim down the log's verbosity a touch
|
||||
pNode->SetEnabled(LOG_HANDLE_EVENT, false);
|
||||
@ -120,7 +121,7 @@ BMediaNode* LoggingConsumerAddOn::InstantiateNodeFor(
|
||||
status_t LoggingConsumerAddOn::GetConfigurationFor(
|
||||
BMediaNode* your_node,
|
||||
BMessage* into_message) {
|
||||
|
||||
|
||||
// no config yet
|
||||
return B_OK;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1991-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -46,11 +47,11 @@
|
||||
class LoggingConsumerAddOn :
|
||||
public BMediaAddOn {
|
||||
typedef BMediaAddOn _inherited;
|
||||
|
||||
|
||||
public: // ctor/dtor
|
||||
virtual ~LoggingConsumerAddOn();
|
||||
explicit LoggingConsumerAddOn(image_id image);
|
||||
|
||||
|
||||
public: // BMediaAddOn impl
|
||||
virtual status_t InitCheck(
|
||||
const char** out_failure_text);
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1991-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -32,7 +33,7 @@
|
||||
// LoggingConsumerApp.cpp
|
||||
//
|
||||
// HISTORY
|
||||
// eamoon@meadgroup.com 11june99
|
||||
// eamoon@meadgroup.com 11june99
|
||||
// [origin: Be Developer Newsletter III.18: 5may99]
|
||||
|
||||
#include "NodeHarnessApp.h"
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1991-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -39,7 +40,7 @@ NodeHarnessApp::NodeHarnessApp(const char *signature)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
NodeHarnessApp::ReadyToRun()
|
||||
{
|
||||
BWindow* win = new NodeHarnessWin(BRect(100, 200, 210, 330), "NodeLogger");
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1991-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1991-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -98,14 +99,14 @@ NodeHarnessWin::~NodeHarnessWin()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
NodeHarnessWin::Quit()
|
||||
{
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
BWindow::Quit();
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
NodeHarnessWin::MessageReceived(BMessage *msg)
|
||||
{
|
||||
status_t err;
|
||||
@ -199,7 +200,7 @@ NodeHarnessWin::MessageReceived(BMessage *msg)
|
||||
bigtime_t latency;
|
||||
r->GetLatencyFor(mConnection.producer, &latency);
|
||||
printf("Setting producer run mode latency to %Ld\n", latency);
|
||||
r->SetProducerRunModeDelay(mConnection.producer, latency + 6000);
|
||||
r->SetProducerRunModeDelay(mConnection.producer, latency + 6000);
|
||||
|
||||
// preroll first, to be a good citizen
|
||||
r->PrerollNode(mConnection.consumer);
|
||||
@ -239,7 +240,7 @@ NodeHarnessWin::MessageReceived(BMessage *msg)
|
||||
}
|
||||
|
||||
// Private routines
|
||||
void
|
||||
void
|
||||
NodeHarnessWin::StopNodes()
|
||||
{
|
||||
mStartButton->SetEnabled(true);
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1991-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -1,31 +0,0 @@
|
||||
----------------------
|
||||
Be Sample Code License
|
||||
----------------------
|
||||
|
||||
Copyright 1991-1999, Be Incorporated.
|
||||
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.
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -29,13 +30,6 @@
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
NodeHarnessApp.cpp
|
||||
|
||||
Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
This file may be used under the terms of the Be Sample Code License.
|
||||
*/
|
||||
|
||||
#include "NodeHarnessApp.h"
|
||||
#include "NodeHarnessWin.h"
|
||||
|
||||
@ -44,7 +38,7 @@ NodeHarnessApp::NodeHarnessApp(const char *signature)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
NodeHarnessApp::ReadyToRun()
|
||||
{
|
||||
BWindow* win = new NodeHarnessWin(BRect(100, 200, 210, 330), "ToneProducer");
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -29,13 +30,6 @@
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
NodeHarnessApp.h
|
||||
|
||||
Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
This file may be used under the terms of the Be Sample Code License.
|
||||
*/
|
||||
|
||||
#ifndef NodeHarnessApp_H
|
||||
#define NodeHarnessApp_H 1
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -29,13 +30,6 @@
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
NodeHarnessWin.cpp
|
||||
|
||||
Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
This file may be used under the terms of the Be Sample Code License.
|
||||
*/
|
||||
|
||||
#include "NodeHarnessWin.h"
|
||||
#include "ToneProducer.h"
|
||||
#include <app/Application.h>
|
||||
@ -83,7 +77,7 @@ NodeHarnessWin::NodeHarnessWin(BRect frame, const char *title)
|
||||
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();
|
||||
@ -120,14 +114,14 @@ NodeHarnessWin::~NodeHarnessWin()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
NodeHarnessWin::Quit()
|
||||
{
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
BWindow::Quit();
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
NodeHarnessWin::MessageReceived(BMessage *msg)
|
||||
{
|
||||
status_t err;
|
||||
@ -176,7 +170,7 @@ NodeHarnessWin::MessageReceived(BMessage *msg)
|
||||
|
||||
// got the endpoints; now we connect it!
|
||||
media_format format;
|
||||
format.type = B_MEDIA_RAW_AUDIO;
|
||||
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");
|
||||
@ -228,7 +222,7 @@ NodeHarnessWin::MessageReceived(BMessage *msg)
|
||||
}
|
||||
|
||||
// Private routines
|
||||
void
|
||||
void
|
||||
NodeHarnessWin::StopNodes()
|
||||
{
|
||||
mStartButton->SetEnabled(true);
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -29,13 +30,6 @@
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
NodeHarnessWin.h
|
||||
|
||||
Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
This file may be used under the terms of the Be Sample Code License.
|
||||
*/
|
||||
|
||||
#ifndef NodeHarnessWin_H
|
||||
#define NodeHarnessWin_H 1
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -32,9 +33,6 @@
|
||||
/*
|
||||
ToneProducer.cpp
|
||||
|
||||
Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
This file may be used under the terms of the Be Sample Code License.
|
||||
|
||||
NOTE: to compile this code under Genki beta releases, do a search-
|
||||
and-replace to change "B_PARAMETER" to "B_USER_EVENT+1"
|
||||
*/
|
||||
@ -150,7 +148,7 @@ ToneProducer::AddOn(int32 *internal_id) const
|
||||
//#pragma mark -
|
||||
|
||||
// BControllable methods
|
||||
status_t
|
||||
status_t
|
||||
ToneProducer::GetParameterValue(int32 id, bigtime_t* last_change, void* value, size_t* ioSize)
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::GetParameterValue\n");
|
||||
@ -191,7 +189,7 @@ ToneProducer::GetParameterValue(int32 id, bigtime_t* last_change, void* value, s
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::SetParameterValue(int32 id, bigtime_t performance_time, const void* value, size_t size)
|
||||
{
|
||||
switch (id)
|
||||
@ -224,14 +222,14 @@ status_t ToneProducer::StartControlPanel(
|
||||
if(pMessenger && pMessenger->IsValid()) {
|
||||
PRINT(("\tgot valid control panel\n"));
|
||||
}
|
||||
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
//#pragma mark -
|
||||
|
||||
// BBufferProducer methods
|
||||
status_t
|
||||
status_t
|
||||
ToneProducer::FormatSuggestionRequested(media_type type, int32 /*quality*/, media_format* format)
|
||||
{
|
||||
// FormatSuggestionRequested() is not necessarily part of the format negotiation
|
||||
@ -256,7 +254,7 @@ ToneProducer::FormatSuggestionRequested(media_type type, int32 /*quality*/, medi
|
||||
else return B_OK;
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
ToneProducer::FormatProposal(const media_source& output, media_format* format)
|
||||
{
|
||||
// FormatProposal() is the first stage in the BMediaRoster::Connect() process. We hand
|
||||
@ -272,7 +270,7 @@ ToneProducer::FormatProposal(const media_source& output, media_format* format)
|
||||
|
||||
// we only support floating-point raw audio, so we always return that, but we
|
||||
// supply an error code depending on whether we found the proposal acceptable.
|
||||
|
||||
|
||||
media_type requestedType = format->type;
|
||||
*format = mPreferredFormat;
|
||||
if ((requestedType != B_MEDIA_UNKNOWN_TYPE) && (requestedType != B_MEDIA_RAW_AUDIO))
|
||||
@ -283,7 +281,7 @@ ToneProducer::FormatProposal(const media_source& output, media_format* format)
|
||||
else return B_OK; // raw audio or wildcard type, either is okay by us
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
ToneProducer::FormatChangeRequested(const media_source& source, const media_destination& destination, media_format* io_format, int32* _deprecated_)
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::FormatChangeRequested\n");
|
||||
@ -292,7 +290,7 @@ ToneProducer::FormatChangeRequested(const media_source& source, const media_dest
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
ToneProducer::GetNextOutput(int32* cookie, media_output* out_output)
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::GetNextOutput\n");
|
||||
@ -309,7 +307,7 @@ ToneProducer::GetNextOutput(int32* cookie, media_output* out_output)
|
||||
else return B_BAD_INDEX;
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
ToneProducer::DisposeOutputCookie(int32 cookie)
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::DisposeOutputCookie\n");
|
||||
@ -318,7 +316,7 @@ ToneProducer::DisposeOutputCookie(int32 cookie)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
ToneProducer::SetBufferGroup(const media_source& for_source, BBufferGroup* newGroup)
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::SetBufferGroup\n");
|
||||
@ -353,7 +351,7 @@ ToneProducer::SetBufferGroup(const media_source& for_source, BBufferGroup* newGr
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
ToneProducer::GetLatency(bigtime_t* out_latency)
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::GetLatency\n");
|
||||
@ -363,7 +361,7 @@ ToneProducer::GetLatency(bigtime_t* out_latency)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
ToneProducer::PrepareToConnect(const media_source& what, const media_destination& where, media_format* format, media_source* out_source, char* out_name)
|
||||
{
|
||||
// PrepareToConnect() is the second stage of format negotiations that happens
|
||||
@ -396,7 +394,7 @@ ToneProducer::PrepareToConnect(const media_source& what, const media_destination
|
||||
format->u.raw_audio.channel_count = 2;
|
||||
return B_MEDIA_BAD_FORMAT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// !!! validate all other fields except for buffer_size here, because the consumer might have
|
||||
// supplied different values from AcceptFormat()?
|
||||
@ -429,13 +427,13 @@ ToneProducer::PrepareToConnect(const media_source& what, const media_destination
|
||||
{
|
||||
FPRINTF(stderr, "\tconsumer suggested buffer_size %lu\n", format->u.raw_audio.buffer_size);
|
||||
}
|
||||
|
||||
|
||||
// Now reserve the connection, and return information about it
|
||||
mOutput.destination = where;
|
||||
mOutput.format = *format;
|
||||
*out_source = mOutput.source;
|
||||
strncpy(out_name, mOutput.name, B_MEDIA_NAME_LENGTH);
|
||||
|
||||
|
||||
char formatStr[256];
|
||||
string_for_format(*format, formatStr, 255);
|
||||
FPRINTF(stderr, "\treturning format: %s\n", formatStr);
|
||||
@ -443,7 +441,7 @@ ToneProducer::PrepareToConnect(const media_source& what, const media_destination
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::Connect(status_t error, const media_source& source, const media_destination& destination, const media_format& format, char* io_name)
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::Connect\n");
|
||||
@ -470,7 +468,7 @@ ToneProducer::Connect(status_t error, const media_source& source, const media_de
|
||||
// FPRINTF(stderr, "\tcorrupted format; falling back to last suggested format\n");
|
||||
// format = mOutput.format;
|
||||
// }
|
||||
//
|
||||
//
|
||||
|
||||
// Okay, the connection has been confirmed. Record the destination and format
|
||||
// that we agreed on, and report our connection name again.
|
||||
@ -505,7 +503,7 @@ ToneProducer::Connect(status_t error, const media_source& source, const media_de
|
||||
// reset our buffer duration, etc. to avoid later calculations
|
||||
// +++++ e.moon 11jun99: crashes w/ divide-by-zero when connecting to LoggingConsumer
|
||||
ASSERT(mOutput.format.u.raw_audio.frame_rate);
|
||||
|
||||
|
||||
bigtime_t duration = bigtime_t(1000000) * samplesPerBuffer / bigtime_t(mOutput.format.u.raw_audio.frame_rate);
|
||||
SetBufferDuration(duration);
|
||||
|
||||
@ -516,7 +514,7 @@ ToneProducer::Connect(status_t error, const media_source& source, const media_de
|
||||
if (!mBufferGroup) AllocateBuffers();
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::Disconnect(const media_source& what, const media_destination& where)
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::Disconnect\n");
|
||||
@ -536,7 +534,7 @@ ToneProducer::Disconnect(const media_source& what, const media_destination& wher
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::LateNoticeReceived(const media_source& what, bigtime_t how_much, bigtime_t performance_time)
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::LateNoticeReceived\n");
|
||||
@ -577,7 +575,7 @@ ToneProducer::LateNoticeReceived(const media_source& what, bigtime_t how_much, b
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::EnableOutput(const media_source& what, bool enabled, int32* _deprecated_)
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::EnableOutput\n");
|
||||
@ -592,7 +590,7 @@ ToneProducer::EnableOutput(const media_source& what, bool enabled, int32* _depre
|
||||
}
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
ToneProducer::SetPlayRate(int32 numer, int32 denom)
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::SetPlayRate\n");
|
||||
@ -602,7 +600,7 @@ ToneProducer::SetPlayRate(int32 numer, int32 denom)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
ToneProducer::HandleMessage(int32 message, const void* data, size_t size)
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::HandleMessage(%ld = 0x%lx)\n", message, message);
|
||||
@ -615,7 +613,7 @@ ToneProducer::HandleMessage(int32 message, const void* data, size_t size)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::AdditionalBufferRequested(const media_source& source, media_buffer_id prev_buffer, bigtime_t prev_time, const media_seek_tag* prev_tag)
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::AdditionalBufferRequested\n");
|
||||
@ -624,7 +622,7 @@ ToneProducer::AdditionalBufferRequested(const media_source& source, media_buffer
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::LatencyChanged(
|
||||
const media_source& source,
|
||||
const media_destination& destination,
|
||||
@ -645,7 +643,7 @@ ToneProducer::LatencyChanged(
|
||||
}
|
||||
/*
|
||||
// Workaround for a Metrowerks PPC compiler bug
|
||||
status_t
|
||||
status_t
|
||||
ToneProducer::DeleteHook(BMediaNode* node)
|
||||
{
|
||||
return BMediaEventLooper::DeleteHook(node);
|
||||
@ -655,7 +653,7 @@ ToneProducer::DeleteHook(BMediaNode* node)
|
||||
*/
|
||||
|
||||
// BMediaEventLooper methods
|
||||
void
|
||||
void
|
||||
ToneProducer::NodeRegistered()
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::NodeRegistered\n");
|
||||
@ -672,7 +670,7 @@ ToneProducer::NodeRegistered()
|
||||
SetParameterWeb(mWeb);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::Start(bigtime_t performance_time)
|
||||
{
|
||||
PRINT(("ToneProducer::Start(%Ld): now %Ld\n", performance_time, TimeSource()->Now()));
|
||||
@ -686,7 +684,7 @@ ToneProducer::Start(bigtime_t performance_time)
|
||||
BMediaEventLooper::Start(performance_time);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::Stop(bigtime_t performance_time, bool immediate)
|
||||
{
|
||||
// send 'data not available' message
|
||||
@ -700,7 +698,7 @@ ToneProducer::Stop(bigtime_t performance_time, bool immediate)
|
||||
BMediaEventLooper::Stop(performance_time, immediate);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::Seek(bigtime_t media_time, bigtime_t performance_time)
|
||||
{
|
||||
// A bug in the current PowerPC compiler demands that we implement
|
||||
@ -708,7 +706,7 @@ ToneProducer::Seek(bigtime_t media_time, bigtime_t performance_time)
|
||||
BMediaEventLooper::Seek(media_time, performance_time);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::TimeWarp(bigtime_t at_real_time, bigtime_t to_performance_time)
|
||||
{
|
||||
// A bug in the current PowerPC compiler demands that we implement
|
||||
@ -716,7 +714,7 @@ ToneProducer::TimeWarp(bigtime_t at_real_time, bigtime_t to_performance_time)
|
||||
BMediaEventLooper::TimeWarp(at_real_time, to_performance_time);
|
||||
}
|
||||
|
||||
status_t
|
||||
status_t
|
||||
ToneProducer::AddTimer(bigtime_t at_performance_time, int32 cookie)
|
||||
{
|
||||
// A bug in the current PowerPC compiler demands that we implement
|
||||
@ -724,7 +722,7 @@ ToneProducer::AddTimer(bigtime_t at_performance_time, int32 cookie)
|
||||
return BMediaEventLooper::AddTimer(at_performance_time, cookie);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::SetRunMode(run_mode mode)
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::SetRunMode\n");
|
||||
@ -737,7 +735,7 @@ ToneProducer::SetRunMode(run_mode mode)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::HandleEvent(const media_timed_event* event, bigtime_t lateness, bool realTimeEvent)
|
||||
{
|
||||
// FPRINTF(stderr, "ToneProducer::HandleEvent\n");
|
||||
@ -862,7 +860,7 @@ ToneProducer::HandleEvent(const media_timed_event* event, bigtime_t lateness, bo
|
||||
}
|
||||
|
||||
/*
|
||||
void
|
||||
void
|
||||
ToneProducer::CleanUpEvent(const media_timed_event *event)
|
||||
{
|
||||
// A bug in the current PowerPC compiler demands that we implement
|
||||
@ -870,7 +868,7 @@ ToneProducer::CleanUpEvent(const media_timed_event *event)
|
||||
BMediaEventLooper::CleanUpEvent(event);
|
||||
}
|
||||
|
||||
bigtime_t
|
||||
bigtime_t
|
||||
ToneProducer::OfflineTime()
|
||||
{
|
||||
// A bug in the current PowerPC compiler demands that we implement
|
||||
@ -878,7 +876,7 @@ ToneProducer::OfflineTime()
|
||||
return BMediaEventLooper::OfflineTime();
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::ControlLoop()
|
||||
{
|
||||
// A bug in the current PowerPC compiler demands that we implement
|
||||
@ -889,11 +887,11 @@ ToneProducer::ControlLoop()
|
||||
//#pragma mark -
|
||||
*/
|
||||
|
||||
void
|
||||
void
|
||||
ToneProducer::AllocateBuffers()
|
||||
{
|
||||
FPRINTF(stderr, "ToneProducer::AllocateBuffers\n");
|
||||
|
||||
|
||||
// allocate enough buffers to span our downstream latency, plus one
|
||||
size_t size = mOutput.format.u.raw_audio.buffer_size;
|
||||
int32 count = int32(mLatency / BufferDuration() + 1 + 1);
|
||||
@ -918,7 +916,7 @@ ToneProducer::FillNextBuffer(bigtime_t event_time)
|
||||
|
||||
// now fill it with data, continuing where the last buffer left off
|
||||
// 20sep99: multichannel support
|
||||
|
||||
|
||||
size_t numFrames =
|
||||
mOutput.format.u.raw_audio.buffer_size /
|
||||
(sizeof(float)*mOutput.format.u.raw_audio.channel_count);
|
||||
@ -978,7 +976,7 @@ ToneProducer::FillNextBuffer(bigtime_t event_time)
|
||||
void
|
||||
ToneProducer::FillSineBuffer(float *data, size_t numFrames, bool stereo)
|
||||
{
|
||||
|
||||
|
||||
|
||||
// cover 2pi radians in one period
|
||||
double dTheta = 2*M_PI * double(mFrequency) / mOutput.format.u.raw_audio.frame_rate;
|
||||
@ -992,7 +990,7 @@ ToneProducer::FillSineBuffer(float *data, size_t numFrames, bool stereo)
|
||||
++data;
|
||||
*data = val;
|
||||
}
|
||||
|
||||
|
||||
mTheta += dTheta;
|
||||
if (mTheta > 2*M_PI)
|
||||
{
|
||||
@ -1017,7 +1015,7 @@ ToneProducer::FillTriangleBuffer(float *data, size_t numFrames, bool stereo)
|
||||
++data;
|
||||
*data = val;
|
||||
}
|
||||
|
||||
|
||||
mTheta += dTheta;
|
||||
if (mTheta >= 1)
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -32,18 +33,15 @@
|
||||
/*
|
||||
ToneProducer.h
|
||||
|
||||
Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
This file may be used under the terms of the Be Sample Code License.
|
||||
|
||||
NOTES eamoon@meadgroup.com 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
|
||||
eamoon 17jun99
|
||||
* Can't handle 2 channels, but is too polite to refuse.
|
||||
How embarrassing.
|
||||
|
||||
@ -89,7 +87,7 @@ public:
|
||||
bigtime_t when,
|
||||
const void* value,
|
||||
size_t size);
|
||||
|
||||
|
||||
status_t StartControlPanel(
|
||||
BMessenger* pMessenger);
|
||||
|
||||
@ -142,7 +140,7 @@ public:
|
||||
char* out_name);
|
||||
|
||||
void Connect(
|
||||
status_t error,
|
||||
status_t error,
|
||||
const media_source& source,
|
||||
const media_destination& destination,
|
||||
const media_format& format,
|
||||
@ -217,7 +215,7 @@ protected:
|
||||
|
||||
// Workaround for a Metrowerks PPC compiler bug
|
||||
void ControlLoop();
|
||||
|
||||
|
||||
// Workaround for a Metrowerks PPC compiler bug
|
||||
status_t DeleteHook(BMediaNode* node);
|
||||
*/
|
||||
@ -251,7 +249,7 @@ private:
|
||||
bigtime_t mGainLastChanged;
|
||||
bigtime_t mFreqLastChanged;
|
||||
bigtime_t mWaveLastChanged;
|
||||
|
||||
|
||||
// host addon
|
||||
// [8jun99] e.moon
|
||||
BMediaAddOn* m_pAddOn;
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -49,7 +50,7 @@ extern "C" _EXPORT BMediaAddOn* make_media_addon(image_id image) {
|
||||
ToneProducerAddOn::~ToneProducerAddOn() {}
|
||||
ToneProducerAddOn::ToneProducerAddOn(image_id image) :
|
||||
BMediaAddOn(image) {}
|
||||
|
||||
|
||||
// -------------------------------------------------------- //
|
||||
// BMediaAddOn impl
|
||||
// -------------------------------------------------------- //
|
||||
@ -58,7 +59,7 @@ status_t ToneProducerAddOn::InitCheck(
|
||||
const char** out_failure_text) {
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
int32 ToneProducerAddOn::CountFlavors() {
|
||||
return 1;
|
||||
}
|
||||
@ -68,7 +69,7 @@ status_t ToneProducerAddOn::GetFlavorAt(
|
||||
const flavor_info** out_info) {
|
||||
if(n)
|
||||
return B_ERROR;
|
||||
|
||||
|
||||
flavor_info* pInfo = new flavor_info;
|
||||
pInfo->internal_id = n;
|
||||
pInfo->name = "ToneProducer";
|
||||
@ -79,16 +80,16 @@ status_t ToneProducerAddOn::GetFlavorAt(
|
||||
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;
|
||||
}
|
||||
@ -98,15 +99,15 @@ BMediaNode* ToneProducerAddOn::InstantiateNodeFor(
|
||||
BMessage* config,
|
||||
status_t* out_error) {
|
||||
|
||||
return new ToneProducer(this);
|
||||
return new ToneProducer(this);
|
||||
}
|
||||
|
||||
status_t ToneProducerAddOn::GetConfigurationFor(
|
||||
BMediaNode* your_node,
|
||||
BMessage* into_message) {
|
||||
|
||||
|
||||
// no config yet
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
// END -- ToneProducerAddOn.cpp
|
||||
// END -- ToneProducerAddOn.cpp
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -46,11 +47,11 @@
|
||||
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);
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -29,13 +30,6 @@
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
ToneProducerApp main.cpp
|
||||
|
||||
Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
This file may be used under the terms of the Be Sample Code License.
|
||||
*/
|
||||
|
||||
#include "NodeHarnessApp.h"
|
||||
#include "MediaNodeControlApp.h"
|
||||
#include <cstring>
|
||||
@ -57,6 +51,6 @@ int main(int argc, char** argv) {
|
||||
MediaNodeControlApp app(g_pAppSignature, id);
|
||||
app.Run();
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,31 +0,0 @@
|
||||
----------------------
|
||||
Be Sample Code License
|
||||
----------------------
|
||||
|
||||
Copyright 1991-1999, Be Incorporated.
|
||||
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.
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -35,8 +36,6 @@
|
||||
/
|
||||
/ Description: Utility functions for handling audio data.
|
||||
/
|
||||
/ Copyright 1998-1999, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#include "SoundUtils.h"
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -35,8 +36,6 @@
|
||||
/
|
||||
/ Description: Utility functions for handling audio data.
|
||||
/
|
||||
/ Copyright 1998-1999, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#if ! defined( _SoundUtils_h )
|
||||
@ -78,7 +77,7 @@ enum {
|
||||
B_DISCONNECTED, //
|
||||
B_FORMAT_CHANGED, // media_raw_audio_format*
|
||||
B_NODE_DIES, // node will die!
|
||||
B_HOOKS_CHANGED, //
|
||||
B_HOOKS_CHANGED, //
|
||||
B_OP_TIMED_OUT, // timeout that expired -- Consumer only
|
||||
B_PRODUCER_DATA_STATUS, // status performance_time -- Consumer only
|
||||
B_LATE_NOTICE // how_much performance_time -- Producer only
|
||||
|
@ -1,40 +0,0 @@
|
||||
|
||||
This license applies to the following files:
|
||||
|
||||
array_delete.h
|
||||
MultiInvoker.cpp
|
||||
MultiInvoker.h
|
||||
SoundUtils.cpp
|
||||
SoundUtils.h
|
||||
|
||||
----------------------
|
||||
Be Sample Code License
|
||||
----------------------
|
||||
|
||||
Copyright 1991-1999, Be Incorporated.
|
||||
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.
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -34,9 +35,6 @@
|
||||
// ----------------
|
||||
// Implements the MultiInvoker class.
|
||||
//
|
||||
// Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
// This file may be used under the terms of the Be Sample
|
||||
// Code License.
|
||||
|
||||
#include <Messenger.h>
|
||||
#include "MultiInvoker.h"
|
||||
@ -111,7 +109,7 @@ status_t MultiInvoker::AddTarget(const BHandler* h, const BLooper* loop)
|
||||
m_messengers.AddItem(msgr);
|
||||
else
|
||||
delete msgr;
|
||||
return err;
|
||||
return err;
|
||||
}
|
||||
|
||||
status_t MultiInvoker::AddTarget(BMessenger* msgr)
|
||||
@ -204,8 +202,8 @@ status_t MultiInvoker::Invoke(BMessage* msg)
|
||||
if (! sendMsg)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
status_t err, finalResult=B_OK;
|
||||
BMessage replyMsg;
|
||||
status_t err, finalResult=B_OK;
|
||||
BMessage replyMsg;
|
||||
int32 len = CountTargets();
|
||||
for (int32 i=0; i<len; i++) {
|
||||
BMessenger* msgr = MessengerAt(i);
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -34,9 +35,7 @@
|
||||
// --------------
|
||||
// Declares the MultiInvoker class.
|
||||
//
|
||||
// Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
// This file may be used under the terms of the Be Sample
|
||||
// Code License.
|
||||
|
||||
|
||||
#ifndef _MultiInvoker_h
|
||||
#define _MultiInvoker_h
|
||||
@ -56,13 +55,13 @@ public:
|
||||
MultiInvoker();
|
||||
MultiInvoker(const MultiInvoker& src);
|
||||
virtual ~MultiInvoker();
|
||||
|
||||
|
||||
MultiInvoker& operator=(const MultiInvoker& src);
|
||||
|
||||
|
||||
virtual void SetMessage(BMessage* message);
|
||||
BMessage* Message() const;
|
||||
uint32 Command() const;
|
||||
|
||||
|
||||
virtual status_t AddTarget(const BHandler* h, const BLooper* loop=0);
|
||||
|
||||
// For this version of AddTarget, the MultiInvoker
|
||||
@ -78,20 +77,20 @@ virtual void RemoveTarget(int32 index);
|
||||
|
||||
void SetTimeout(bigtime_t timeout);
|
||||
bigtime_t Timeout() const;
|
||||
|
||||
|
||||
virtual void SetHandlerForReply(BHandler* h);
|
||||
BHandler* HandlerForReply() const;
|
||||
|
||||
|
||||
virtual status_t Invoke(BMessage* msg =0);
|
||||
|
||||
|
||||
private:
|
||||
void Clear();
|
||||
void Clone(const MultiInvoker& src);
|
||||
|
||||
|
||||
BMessage* m_message;
|
||||
BList m_messengers;
|
||||
bigtime_t m_timeout;
|
||||
BHandler* m_replyHandler;
|
||||
BHandler* m_replyHandler;
|
||||
};
|
||||
|
||||
#endif /* _MultiInvoker_h */
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -35,8 +36,6 @@
|
||||
/
|
||||
/ Description: Utility functions for handling audio data.
|
||||
/
|
||||
/ Copyright 1998-1999, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#include "SoundUtils.h"
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -35,8 +36,6 @@
|
||||
/
|
||||
/ Description: Utility functions for handling audio data.
|
||||
/
|
||||
/ Copyright 1998-1999, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#if ! defined( _SoundUtils_h )
|
||||
@ -78,7 +77,7 @@ enum {
|
||||
B_DISCONNECTED, //
|
||||
B_FORMAT_CHANGED, // media_raw_audio_format*
|
||||
B_NODE_DIES, // node will die!
|
||||
B_HOOKS_CHANGED, //
|
||||
B_HOOKS_CHANGED, //
|
||||
B_OP_TIMED_OUT, // timeout that expired -- Consumer only
|
||||
B_PRODUCER_DATA_STATUS, // status performance_time -- Consumer only
|
||||
B_LATE_NOTICE // how_much performance_time -- Producer only
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-1999, Be Incorporated.
|
||||
* Copyright (c) 1999-2000, Eric Moon.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -35,8 +36,6 @@
|
||||
/
|
||||
/ Description: Template for deleting a new[] array of something.
|
||||
/
|
||||
/ Copyright 1998-1999, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user