AeN64DriverConfig.c++
6 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
//
// This file contains routines for posing a configuration
// dialog for the n64 device. The user can apply changes
// to the configuration information which should take effect
// immediately
//
#include <stdio.h>
#include <stdlib.h>
#include "AeN64DriverConfig.h"
#include "AeN64Driver.h"
#include "AeConfig.h"
String AeN64ConfigDialog::_defaultResources[] =
{
"*frameGroupLabel.labelString: Audio Frame Prefs",
"*outputRateLabel.labelString: output rate:",
"*frameSizeLabel.labelString: samples per frame:",
"*maxCommandsLabel.labelString: max commands per frame:",
"*dmaGroupLabel.labelString: Audio DMA Prefs",
"*dmaBuffersLabel.labelString: DMA buffers:",
"*dmaBufferSizeLabel.labelString: DMA buffer size:",
"*dmaQueueSizeLabel.labelString: max DMA requests:",
"*dmaFrameLagLabel.labelString: # frames to hold DMA buffers:",
"*synthGroupLabel.labelString: Synthesizer Prefs",
"*maxVVoicesLabel.labelString: max virtual voices:",
"*maxPVoicesLabel.labelString: max physical voices:",
"*maxUpdatesLabel.labelString: max control updates:",
"*playerGroupLabel.labelString: MIDI Player Prefs",
"*maxChannelsLabel.labelString: max channels:",
"*maxEventsLabel.labelString: max events:",
NULL
};
AeN64ConfigDialog::AeN64ConfigDialog (AeN64Config * config)
: VkPrefDialog ("AeN64ConfigDialog")
{
setTitle ("N64 Audio Configuration");
fConfig = config;
}
void
AeN64ConfigDialog::GetValues (AeN64Config * config)
{
char s[8];
sprintf (s, "%d", config->c.synConfig.outputRate);
outputRate->setValue (s);
sprintf (s, "%d", config->c.frameSize);
frameSize->setValue (s);
sprintf (s, "%d", config->c.maxCmdListSize);
maxCommands->setValue (s);
sprintf (s, "%d", config->c.numDMABuffs);
dmaBuffers->setValue (s);
sprintf (s, "%d", config->c.dmaBufSize);
dmaBufferSize->setValue (s);
sprintf (s, "%d", config->c.dmaQSize);
dmaQueueSize->setValue (s);
sprintf (s, "%d", config->c.frameLag);
dmaFrameLag->setValue (s);
sprintf (s, "%d", config->c.synConfig.maxVVoices);
maxVVoices->setValue (s);
sprintf (s, "%d", config->c.synConfig.maxPVoices);
maxPVoices->setValue (s);
sprintf (s, "%d", config->c.synConfig.maxUpdates);
maxUpdates->setValue (s);
sprintf (s, "%d", config->c.seqpConfig.maxChannels);
maxChannels->setValue (s);
sprintf (s, "%d", config->c.seqpConfig.maxEvents);
maxEvents->setValue (s);
}
void
AeN64ConfigDialog::SetValues (AeN64Config * config)
{
config->c.synConfig.outputRate = atoi (outputRate->getValue());
config->c.frameSize = atoi (frameSize->getValue());
config->c.maxCmdListSize = atoi (maxCommands->getValue());
config->c.numDMABuffs = atoi (dmaBuffers->getValue());
config->c.dmaBufSize = atoi (dmaBufferSize->getValue());
config->c.dmaQSize = atoi (dmaQueueSize->getValue());
config->c.frameLag = atoi (dmaFrameLag->getValue ());
config->c.synConfig.maxVVoices = atoi (maxVVoices->getValue());
config->c.synConfig.maxPVoices = atoi (maxPVoices->getValue());
config->c.synConfig.maxUpdates = atoi (maxUpdates->getValue());
config->c.seqpConfig.maxChannels = atoi (maxChannels->getValue());
config->c.seqpConfig.maxEvents = atoi (maxEvents->getValue());
config->c.seqpConfig.maxVoices = config->c.synConfig.maxVVoices;
}
Widget AeN64ConfigDialog::createDialog(Widget parent)
{
setDefaultResources (parent, _defaultResources);
frameGroup = new VkPrefGroup ("frameGroup");
outputRate = new VkPrefText ("outputRate");
frameSize = new VkPrefText ("frameSize");
maxCommands = new VkPrefText ("maxCommands");
frameGroup->addItem(outputRate);
frameGroup->addItem(frameSize);
frameGroup->addItem(maxCommands);
sep1 = new VkPrefSeparator("sep1");
dmaGroup = new VkPrefGroup ("dmaGroup");
dmaBuffers = new VkPrefText ("dmaBuffers");
dmaBufferSize = new VkPrefText ("dmaBufferSize");
dmaQueueSize = new VkPrefText ("dmaQueueSize");
dmaFrameLag = new VkPrefText ("dmaFrameLag");
dmaGroup->addItem(dmaBuffers);
dmaGroup->addItem(dmaBufferSize);
dmaGroup->addItem(dmaQueueSize);
dmaGroup->addItem(dmaFrameLag);
sep2 = new VkPrefSeparator("sep2");
synthGroup = new VkPrefGroup ("synthGroup");
maxVVoices = new VkPrefText ("maxVVoices");
maxPVoices = new VkPrefText ("maxPVoices");
maxUpdates = new VkPrefText ("maxUpdates");
synthGroup->addItem(maxVVoices);
synthGroup->addItem(maxPVoices);
synthGroup->addItem(maxUpdates);
sep3 = new VkPrefSeparator("sep3");
playerGroup = new VkPrefGroup ("playerGroup");
maxChannels = new VkPrefText ("maxChannels");
maxEvents = new VkPrefText ("maxEvents");
playerGroup->addItem(maxChannels);
playerGroup->addItem(maxEvents);
prefList = new VkPrefList ("prefList");
prefList->addItem (frameGroup);
prefList->addItem (sep1);
prefList->addItem (dmaGroup);
prefList->addItem (sep2);
prefList->addItem (synthGroup);
prefList->addItem (sep3);
prefList->addItem (playerGroup);
setItem (prefList);
GetValues (fConfig);
Widget base = VkPrefDialog::createDialog (parent);
return base;
}
AeN64ConfigDialog::~AeN64ConfigDialog()
{
// Empty
}
const char* AeN64ConfigDialog::className()
{
return "AeN64ConfigDialog";
}
void
AeN64Driver::PoseConfigure (void)
{
AeN64ConfigDialog * n64Prefs = new AeN64ConfigDialog (fConfig);
n64Prefs->addCallback(VkPrefDialog::prefCallback, (VkCallbackObject *)n64Prefs,
(VkCallbackMethod)&AeN64ConfigDialog::configCallback,
(void *)this);
n64Prefs->post ();
}
void
AeN64ConfigDialog::configCallback (VkCallbackObject * obj, void * clientData, void * callData)
{
AeN64ConfigDialog * dialog = (AeN64ConfigDialog *) obj;
AeN64Driver * driver = (AeN64Driver *) clientData;
VkDialogManager::VkDialogReason reason = (VkDialogManager::VkDialogReason) callData;
if (reason == VkDialogManager::APPLY)
{
SetValues (driver->GetConfig ());
driver->ReconfigureAudio ();
}
}