Welcome to mirror list, hosted at ThFree Co, Russian Federation.

AUD_SequencerFactory.cpp « intern « audaspace « intern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bb5cf27fb5f103d9d8adab579a3aa9433c6065c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 * $Id$
 *
 * ***** BEGIN LGPL LICENSE BLOCK *****
 *
 * Copyright 2009 Jörg Hermann Müller
 *
 * This file is part of AudaSpace.
 *
 * AudaSpace is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AudaSpace is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with AudaSpace.  If not, see <http://www.gnu.org/licenses/>.
 *
 * ***** END LGPL LICENSE BLOCK *****
 */

#include "AUD_SequencerFactory.h"
#include "AUD_SequencerReader.h"

typedef std::list<AUD_SequencerReader*>::iterator AUD_ReaderIterator;

AUD_SequencerFactory::AUD_SequencerFactory(AUD_Specs specs, void* data, AUD_volumeFunction volume)
{
	m_specs = specs;
	m_data = data;
	m_volume = volume;
}

AUD_SequencerFactory::~AUD_SequencerFactory()
{
	AUD_SequencerReader* reader;
	AUD_SequencerEntry* entry;

	while(!m_readers.empty())
	{
		reader = m_readers.front();
		m_readers.pop_front();
		reader->destroy();
	}

	while(!m_entries.empty())
	{
		entry = m_entries.front();
		m_entries.pop_front();
		delete entry; AUD_DELETE("seqentry")
	}
}

AUD_SequencerEntry* AUD_SequencerFactory::add(AUD_IFactory** sound, float begin, float end, float skip, void* data)
{
	AUD_SequencerEntry* entry = new AUD_SequencerEntry; AUD_NEW("seqentry")
	entry->sound = sound;
	entry->begin = begin;
	entry->skip = skip;
	entry->end = end;
	entry->muted = false;
	entry->data = data;

	m_entries.push_front(entry);

	for(AUD_ReaderIterator i = m_readers.begin(); i != m_readers.end(); i++)
		(*i)->add(entry);

	return entry;
}

void AUD_SequencerFactory::remove(AUD_SequencerEntry* entry)
{
	for(AUD_ReaderIterator i = m_readers.begin(); i != m_readers.end(); i++)
		(*i)->remove(entry);

	m_entries.remove(entry);

	delete entry; AUD_DELETE("seqentry")
}

void AUD_SequencerFactory::move(AUD_SequencerEntry* entry, float begin, float end, float skip)
{
	entry->begin = begin;
	entry->skip = skip;
	entry->end = end;
}

void AUD_SequencerFactory::mute(AUD_SequencerEntry* entry, bool mute)
{
	entry->muted = mute;
}

AUD_IReader* AUD_SequencerFactory::createReader()
{
	AUD_SequencerReader* reader = new AUD_SequencerReader(this, m_entries, m_specs, m_data, m_volume); AUD_NEW("reader")
	m_readers.push_front(reader);

	return reader;
}

void AUD_SequencerFactory::removeReader(AUD_SequencerReader* reader)
{
	m_readers.remove(reader);
}