AeN64Config.c++
3.06 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/******************************************************************************
*
* Configuration Manager for AudioEditor
*
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "n64.h"
#include "AeErr.h"
#include "AeConfig.h"
#include "AeN64ConfigFile.h"
#if 0
#define ms2smp(a) (((int)((float)a * (float)OUTPUT_RATE/1000))&~0x7)
#endif
#define SECTION_SIZE 8
#define DEF_NUMBER_DMA_BUFFS 80
#define DEF_DMA_BUFF_SIZE 1024
#define DEF_DMA_FRAME_LAG 4
#define DEF_NUMBER_SYNTH_VIRTUAL_VOICES 32
#define DEF_NUMBER_SYNTH_PHYSICAL_VOICES 32
#define DEF_NUMBER_SEQP_VOICES 32
#define DEF_DMA_QUEUE_SIZE 50
#define DEF_NUMBER_SYNTH_UPDATES 128
#define DEF_NUMBER_SEQP_EVENTS 128
#define DEF_CMD_LIST_SIZE 5000
#define DEF_SAMPLES_PER_FRAME 640 /* Best if a multiple of 160 */
#define DEF_OUTPUT_RATE 44100
#define DEF_NUMBER_CHANNELS 16
AeN64Config::AeN64Config (void)
{
c.audioHeap = 0; // should be set by giomgr
c.heapSize = 0; // should be set by giomgr
c.frameSize = DEF_SAMPLES_PER_FRAME;
c.maxCmdListSize = DEF_CMD_LIST_SIZE;
c.numDMABuffs = DEF_NUMBER_DMA_BUFFS;
c.dmaBufSize = DEF_DMA_BUFF_SIZE;
c.frameLag = DEF_DMA_FRAME_LAG;
c.dmaQSize = DEF_DMA_QUEUE_SIZE;
c.synConfig.maxVVoices = DEF_NUMBER_SYNTH_VIRTUAL_VOICES;
c.synConfig.maxPVoices = DEF_NUMBER_SYNTH_PHYSICAL_VOICES;
c.synConfig.maxUpdates = DEF_NUMBER_SYNTH_UPDATES;
c.synConfig.maxFXbusses = 1;
c.synConfig.outputRate = DEF_OUTPUT_RATE;
c.synConfig.fxType = AL_FX_NONE;
c.synConfig.params = 0;
c.synConfig.heap = 0; // set by AudioApp
c.synConfig.dmaproc = 0; // set by AudioApp
c.seqpConfig.maxVoices = DEF_NUMBER_SYNTH_VIRTUAL_VOICES;
c.seqpConfig.maxEvents = DEF_NUMBER_SEQP_EVENTS;
c.seqpConfig.maxChannels = DEF_NUMBER_CHANNELS;
c.seqpConfig.debugFlags = NO_SOUND_ERR_MASK | NOTE_OFF_ERR_MASK | NO_VOICE_ERR_MASK;
c.seqpConfig.heap = 0; // set by AudioApp
c.seqpConfig.initOsc = 0;
c.seqpConfig.updateOsc = 0;
c.seqpConfig.stopOsc = 0;
fFx = NULL;
fFile = NULL;
}
AeN64Config::~AeN64Config (void)
{
if (fFile)
delete fFile;
}
AeErr
AeN64Config::ReadFromFile (const char * fileName)
{
AeErr err = kAeNoErr;
if (fFile)
fFile->SetFullName (fileName);
else
fFile = new AeN64ConfigFile (fileName);
if (fFile)
err = fFile->Read (this);
return err;
}
AeErr
AeN64Config::WriteToFile (const char * fileName)
{
AeErr err = kAeNoErr;
if (fFile)
fFile->SetFullName (fileName);
else
fFile = new AeN64ConfigFile (fileName);
if (fFile)
err = fFile->Write (this);
return err;
}
void
AeN64Config::SetFxAsset (AeFxAsset * fx)
{
fFx = fx;
if (fFx)
c.synConfig.fxType = AL_FX_CUSTOM;
else
c.synConfig.fxType = AL_FX_NONE;
}