Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 45 lines (39 sloc) 1.545 kB
18af219 @mhroth Add samplerate~.
authored
1 /*
29f83db Towards an a stack-based messaging system. First commit.
Martin Roth authored
2 * Copyright 2010,2011 Reality Jockey, Ltd.
18af219 @mhroth Add samplerate~.
authored
3 * info@rjdj.me
4 * http://rjdj.me/
5 *
6 * This file is part of ZenGarden.
7 *
8 * ZenGarden is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * ZenGarden is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with ZenGarden. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23 #include "MessageSamplerate.h"
24 #include "PdGraph.h"
25
7329847 @mhroth Add static factory method to all objects in order to create an object…
authored
26 MessageObject *MessageSamplerate::newObject(PdMessage *initMessage, PdGraph *graph) {
27 return new MessageSamplerate(initMessage, graph);
28 }
29
18af219 @mhroth Add samplerate~.
authored
30 MessageSamplerate::MessageSamplerate(PdMessage *initMessage, PdGraph *graph) : MessageObject(1, 1, graph) {
31 // nothing to do
32 }
33
34 MessageSamplerate::~MessageSamplerate() {
35 // nothing to do
36 }
37
38 void MessageSamplerate::MessageSamplerate::processMessage(int inletIndex, PdMessage *message) {
39 if (message->isBang(0)) {
29f83db Towards an a stack-based messaging system. First commit.
Martin Roth authored
40 PdMessage *outgoingMessage = PD_MESSAGE_ON_STACK(1);
94644e6 MessageSamplerate properly returns graph samplerate.
Martin Roth authored
41 outgoingMessage->initWithTimestampAndFloat(message->getTimestamp(), graph->getSampleRate());
18af219 @mhroth Add samplerate~.
authored
42 sendMessage(0, outgoingMessage);
43 }
44 }
Something went wrong with that request. Please try again.