X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsoundscape.cpp;h=cc07285bfdded63e99909852f259764847a103ef;hb=d035e638b940f25cb5d46a049a00b34dc60dc5e0;hp=0b126ac01bde48190480adb6a0f94fce5568652c;hpb=2a685e572e2ab8d9f50129de3f0869628edb3d8e;p=libs%2Fal.git diff --git a/source/soundscape.cpp b/source/soundscape.cpp index 0b126ac..cc07285 100644 --- a/source/soundscape.cpp +++ b/source/soundscape.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of libmspal -Copyright © 2008 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include "source.h" #include "soundscape.h" @@ -13,12 +6,23 @@ using namespace std; namespace Msp { namespace AL { +SoundScape::SoundScape(): + gain(1) +{ } + SoundScape::~SoundScape() { for(list::iterator i=sources.begin(); i!=sources.end(); ++i) delete *i; } +void SoundScape::set_gain(float g) +{ + gain = g; + for(list::iterator i=sources.begin(); i!=sources.end(); ++i) + (*i)->set_gain(gain); +} + void SoundScape::add_source(Source &src) { sources.push_back(&src); @@ -30,6 +34,7 @@ Source &SoundScape::play(const Buffer &buf, float x, float y, float z) add_source(*src); src->set_buffer(buf); src->set_position(x, y, z); + src->set_gain(gain); src->play(); return *src; }