summaryrefslogtreecommitdiffstats
path: root/src/server/mix.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-23 18:57:14 +0000
committerDavid Robillard <d@drobilla.net>2012-05-23 18:57:14 +0000
commited081d30c860eb8ad3e9d9ec6136422dc2e2d9d0 (patch)
tree600beb40780b0aae88fedcc8740276169823e1f4 /src/server/mix.hpp
parent77cfdf0f5086e26c7811330c6b44ca02eb3337dd (diff)
downloadingen-ed081d30c860eb8ad3e9d9ec6136422dc2e2d9d0.tar.gz
ingen-ed081d30c860eb8ad3e9d9ec6136422dc2e2d9d0.tar.bz2
ingen-ed081d30c860eb8ad3e9d9ec6136422dc2e2d9d0.zip
Move mixing stuff to mix.cpp.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4452 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/mix.hpp')
-rw-r--r--src/server/mix.hpp72
1 files changed, 11 insertions, 61 deletions
diff --git a/src/server/mix.hpp b/src/server/mix.hpp
index f0a14d79..65dd8de2 100644
--- a/src/server/mix.hpp
+++ b/src/server/mix.hpp
@@ -17,73 +17,23 @@
#ifndef INGEN_ENGINE_MIX_HPP
#define INGEN_ENGINE_MIX_HPP
-#include "ingen/shared/URIs.hpp"
-#include "raul/log.hpp"
-
-#include "AudioBuffer.hpp"
-#include "Buffer.hpp"
-#include "Context.hpp"
+#include <stdint.h>
namespace Ingen {
-namespace Server {
-inline bool
-is_audio(Shared::URIs& uris, LV2_URID type)
-{
- return type == uris.atom_Float || type == uris.atom_Sound;
-}
+namespace Shared { class URIs; }
-inline void
-mix(Context& context,
- Shared::URIs& uris,
- Buffer* dst,
- Buffer** srcs,
- uint32_t num_srcs)
-{
- if (num_srcs == 1) {
- dst->copy(context, srcs[0]);
- } else if (is_audio(uris, dst->type())) {
- // Copy the first source
- dst->copy(context, srcs[0]);
+namespace Server {
- // Mix in the rest
- for (uint32_t i = 1; i < num_srcs; ++i) {
- assert(is_audio(uris, srcs[i]->type()));
- ((AudioBuffer*)dst)->accumulate(context, (AudioBuffer*)srcs[i]);
- }
- } else {
- std::cerr << "FIXME: event mix" << std::endl;
- }
-#if 0
- case PortType::EVENTS:
- dst->clear();
- for (uint32_t i = 0; i < num_srcs; ++i) {
- assert(srcs[i]->type() == PortType::EVENTS);
- srcs[i]->rewind();
- }
+class Context;
+class Buffer;
- while (true) {
- const EventBuffer* first = NULL;
- for (uint32_t i = 0; i < num_srcs; ++i) {
- const EventBuffer* const src = (const EventBuffer*)srcs[i];
- if (src->is_valid()) {
- if (!first || src->get_event()->frames < first->get_event()->frames)
- first = src;
- }
- }
- if (first) {
- const LV2_Event* const ev = first->get_event();
- ((EventBuffer*)dst)->append(
- ev->frames, ev->subframes, ev->type, ev->size,
- (const uint8_t*)ev + sizeof(LV2_Event));
- first->increment();
- } else {
- break;
- }
- }
- dst->rewind();
-#endif
-}
+void
+mix(Context& context,
+ Shared::URIs& uris,
+ Buffer* dst,
+ const Buffer*const* srcs,
+ uint32_t num_srcs);
} // namespace Server
} // namespace Ingen