forked from kmatheussen/radium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstrument_lock.patch
282 lines (241 loc) · 12.3 KB
/
instrument_lock.patch
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
diff --git a/Qt/Qt_instruments.cpp b/Qt/Qt_instruments.cpp
index 2bcd56f4e..b852c76e0 100644
--- a/Qt/Qt_instruments.cpp
+++ b/Qt/Qt_instruments.cpp
@@ -454,7 +454,7 @@ void InstrumentWidget_create_audio_instrument_widget(struct Patch *patch, bool s
QTimer::singleShot(g_set_current_delay + 3,[patch_id]{
struct Patch *patch = PATCH_get_from_id(patch_id);
if(patch != NULL)
- GFX_PP_Update(patch,false);
+ GFX_PP_Update( patch, false, false );
});
}
@@ -915,10 +915,15 @@ static void GFX_PP_Update_internal(struct Patch *patch, bool is_loading, bool op
called_from_pp_update = false;
}
-void GFX_PP_Update(struct Patch *patch, bool is_loading){
- GFX_PP_Update_internal(patch, is_loading, false);
+void GFX_PP_Update( struct Patch *patch, bool is_loading, bool even_if_locked )
+{
+ GFX_PP_Update_internal( patch, is_loading, even_if_locked );
}
+//void GFX_PP_Update(struct Patch *patch, bool is_loading){
+// GFX_PP_Update_internal(patch, is_loading, false);
+//}
+
void GFX_PP_Update_even_if_locked(struct Patch *patch, bool is_loading){
GFX_PP_Update_internal(patch, is_loading, true);
}
@@ -956,7 +961,7 @@ void InstrumentWidget_delete(struct Patch *patch){
if (!g_is_starting_up && !g_is_loading){
struct Patch *patch = PATCH_get_current();
if (patch!=NULL)
- GFX_PP_Update(patch, false);
+ GFX_PP_Update( patch, false, false );
}
}
@@ -965,9 +970,7 @@ void GFX_update_instrument_patch_gui(struct Patch *patch){
if(patch!=NULL && patch->patchdata!=NULL){
R_ASSERT_RETURN_IF_FALSE(patch->instrument != NULL);
if (patch->instrument->PP_Update!=NULL)
- patch->instrument->PP_Update(patch->instrument,
- patch,
- false);
+ patch->instrument->PP_Update( patch->instrument, patch, false, false );
}
#if 0
if(wblock->wtrack->track->patch!=NULL && wblock->wtrack->track->patch->instrument->PP_Update!=NULL)
diff --git a/api/api_instruments.cpp b/api/api_instruments.cpp
index 606a503f9..8d7b7e9fc 100644
--- a/api/api_instruments.cpp
+++ b/api/api_instruments.cpp
@@ -514,7 +514,7 @@ void setInstrumentForTrack(instrument_t instrument_id, int tracknum, int blocknu
wblock->block->is_dirty = true;
- (*new_patch->instrument->PP_Update)(new_patch->instrument,new_patch,false);
+ ( *new_patch->instrument->PP_Update )( new_patch->instrument, new_patch, false, false );
}
void replaceUseOfInstrument(instrument_t old_instrument_id, instrument_t new_instrument_id){
@@ -594,7 +594,7 @@ void setSendMidiInputToCurrentInstrument(bool doit){
instrument_t createMIDIInstrument(const_char *name) {
struct Patch *patch = PATCH_create_midi(name);
- GFX_PP_Update(patch,false);
+ GFX_PP_Update( patch, false, false );
return patch->id;
}
@@ -1537,7 +1537,7 @@ void setInstrumentEffectChangesValueWhenPressingRandom(instrument_t instrument_i
PLUGIN_set_random_behavior(plugin, effect_num, doit);
- (*patch->instrument->PP_Update)(patch->instrument,patch,false);
+ ( *patch->instrument->PP_Update )( patch->instrument, patch, false, false );
}
bool getInstrumentEffectChangesValueWhenPressingRandom(instrument_t instrument_id, const_char* effect_name){
@@ -1863,7 +1863,7 @@ void setInstrumentData(instrument_t instrument_id, const_char *key, const_char *
patch->instrument->setPatchData(patch, key, value, true);
- (*patch->instrument->PP_Update)(patch->instrument,patch,false);
+ ( *patch->instrument->PP_Update )( patch->instrument, patch, false, false );
}
const_char *getInstrumentData(instrument_t instrument_id, const_char *key) {
@@ -3041,7 +3041,7 @@ void removeModulator(instrument_t instrument_id, const char *effect_name){
MODULATOR_remove_target(modulator_id, patch, effect_num);
if(patch==PATCH_get_current())
- patch->instrument->PP_Update(patch->instrument, patch, false);
+ patch->instrument->PP_Update( patch->instrument, patch, false, false );
}
static const char *get_modulator_patch_description(const struct Patch *modulator_patch){
@@ -3560,7 +3560,7 @@ bool showInstrumentGui(instrument_t instrument_id, int64_t parentgui, bool show_
GFX_InstrumentWindowToFront();
struct Instruments *instrument = get_audio_instrument();
- instrument->PP_Update(instrument,patch,false);
+ instrument->PP_Update( instrument, patch, false, false );
struct SoundPlugin *plugin = (struct SoundPlugin*)patch->patchdata;
if (plugin != NULL){
@@ -3808,7 +3808,7 @@ void setCurrentInstrument(instrument_t instrument_id, bool show_instrument_windo
GFX_InstrumentWindowToFront();
if (only_change_if_unlocked)
- GFX_PP_Update(patch, false);
+ GFX_PP_Update( patch, false, false );
else
GFX_PP_Update_even_if_locked(patch, false);
@@ -3849,7 +3849,7 @@ void setCurrentInstrumentDown(bool set_current_instrument, bool set_current_inst
S7CALL2(void_bool_bool,"FROM_C-move-current-instrument-down", set_current_instrument, set_current_instrument_under_mouse);
}
-static bool g_curr_instrument_is_locked = false;// = createIllegalInstrument();
+static bool g_curr_instrument_is_locked = true;// = createIllegalInstrument();
void setCurrentInstrumentLocked(bool lockit){
if (lockit==g_curr_instrument_is_locked)
diff --git a/api/api_sequencer.cpp b/api/api_sequencer.cpp
index e8a0410de..22ecb2638 100644
--- a/api/api_sequencer.cpp
+++ b/api/api_sequencer.cpp
@@ -578,7 +578,7 @@ static void setCurrSeqtrack2(int seqtracknum, bool called_from_set_curr_seqblock
if(change_curr_instrument){
struct Patch *patch = seqtrack->patch;
if(patch!=NULL)
- patch->instrument->PP_Update(patch->instrument, patch, false);
+ patch->instrument->PP_Update( patch->instrument, patch, false, false );
}
if (seqtracknum != old) {
diff --git a/audio/audio_instrument.cpp b/audio/audio_instrument.cpp
index 928705728..861d037d1 100644
--- a/audio/audio_instrument.cpp
+++ b/audio/audio_instrument.cpp
@@ -1172,13 +1172,14 @@ static void AUDIO_RT_StopPlaying(struct Instruments *instrument){
}END_VECTOR_FOR_EACH;
}
-static void AUDIO_PP_Update(struct Instruments *instrument,struct Patch *patch, bool is_loading){
- if(patch->patchdata==NULL){
- RError("plugin==NULL for %s\n",patch->name);
+static void AUDIO_PP_Update( struct Instruments *instrument, struct Patch *patch, bool is_loading, bool even_if_locked )
+{
+ if( patch->patchdata == NULL )
+ {
+ RError( "plugin==NULL for %s\n", patch->name );
return;
}
-
- GFX_PP_Update(patch, is_loading);
+ GFX_PP_Update( patch, is_loading, even_if_locked );
}
static void *AUDIO_CopyInstrumentData(const struct Tracks *track){
diff --git a/common/OS_visual_input.h b/common/OS_visual_input.h
index 535fa1e17..3216f574e 100755
--- a/common/OS_visual_input.h
+++ b/common/OS_visual_input.h
@@ -195,7 +195,8 @@ extern LANGSPEC struct Patch *GFX_OS_get_system_out(void);
extern LANGSPEC void GFX_update_all_instrument_widgets(void);
-extern LANGSPEC void GFX_PP_Update(struct Patch *patch, bool is_loading);
+//extern LANGSPEC void GFX_PP_Update(struct Patch *patch, bool is_loading);
+extern LANGSPEC void GFX_PP_Update( struct Patch *patch, bool is_loading, bool even_if_locked );
extern LANGSPEC void GFX_PP_Update_even_if_locked(struct Patch *patch, bool is_loading);
extern LANGSPEC void *OS_GFX_get_native_main_window(void);
diff --git a/common/disk_instrument.c b/common/disk_instrument.c
index 6d89b47fb..dba3414f0 100755
--- a/common/disk_instrument.c
+++ b/common/disk_instrument.c
@@ -133,6 +133,6 @@ void DLoadInstrument(struct Instruments *instrument){
void DLoadInstrumentGUI(struct Instruments *instrument){
// Pretty sure this is not necessary.
VECTOR_FOR_EACH(struct Patch *patch, &instrument->patches)
- instrument->PP_Update(instrument, patch, true);
+ instrument->PP_Update( instrument, patch, true, false );
END_VECTOR_FOR_EACH;
}
diff --git a/common/nsmtracker.h b/common/nsmtracker.h
index 6f6990182..1ea09c4e9 100755
--- a/common/nsmtracker.h
+++ b/common/nsmtracker.h
@@ -2366,7 +2366,8 @@ struct Instruments{
void (*CloseInstrument)(struct Instruments *instrument);
void (*StopPlaying)(struct Instruments *instrument);
void (*RT_StopPlaying)(struct Instruments *instrument); // Called from the player thread. StopPlaying is called from the main thread, and only if it apparently wasn't playing before. This function is always called right after the player has set player_state to PLAYER_STATE_STOPPED
- void (*PP_Update)(struct Instruments *instrument,struct Patch *patch, bool is_loading);
+ //void (*PP_Update)(struct Instruments *instrument,struct Patch *patch, bool is_loading);
+ void (*PP_Update)(struct Instruments *instrument,struct Patch *patch, bool is_loading, bool even_if_locked );
void *(*CopyInstrumentData)(const struct Tracks *track); //Necesarry for undo.
void (*PlaySongHook)(struct Instruments *instrument, int64_t abstime);
diff --git a/midi/midi_instrument.cpp b/midi/midi_instrument.cpp
index 6c02dcc9b..f10f0e6c9 100755
--- a/midi/midi_instrument.cpp
+++ b/midi/midi_instrument.cpp
@@ -655,8 +655,8 @@ static void MIDI_remove_patchdata(struct Patch *patch){
}PLAYER_unlock();
}
-static void MIDI_PP_Update(struct Instruments *instrument,struct Patch *patch, bool is_loading){
- GFX_PP_Update(patch,is_loading);
+static void MIDI_PP_Update(struct Instruments *instrument,struct Patch *patch, bool is_loading, bool even_if_locked ){
+ GFX_PP_Update( patch, is_loading, even_if_locked );
}
#define APP_GetVars() \
diff --git a/mixergui/QM_MixerWidget.cpp b/mixergui/QM_MixerWidget.cpp
index 8922476fe..a6edca06e 100644
--- a/mixergui/QM_MixerWidget.cpp
+++ b/mixergui/QM_MixerWidget.cpp
@@ -547,7 +547,7 @@ static void draw_slot(MyScene *myscene, float x, float y){
struct Instruments *instrument = get_audio_instrument();
printf("Calling pp_update\n");
- instrument->PP_Update(instrument,(struct Patch*)patch,false);
+ instrument->PP_Update( instrument, (struct Patch*)patch, false, false );
MW_set_selected_chip(chip);
}
#endif
@@ -956,7 +956,7 @@ static bool mousepress_start_connection(MyScene *scene, radium::MouseCycleEvent
SoundPlugin *plugin = SP_get_plugin(chip->_sound_producer);
volatile struct Patch *patch = plugin->patch;
R_ASSERT_RETURN_IF_FALSE2(patch!=NULL,false);
- instrument->PP_Update(instrument,(struct Patch*)patch,false);
+ instrument->PP_Update( instrument, ( struct Patch*)patch, false, false );
MW_set_selected_chip(chip);
// connection
@@ -1064,7 +1064,7 @@ static bool mousepress_select_chip(MyScene *scene, radium::MouseCycleEvent &even
struct Instruments *instrument = get_audio_instrument();
//printf("Calling pp_update\n");
- instrument->PP_Update(instrument,(struct Patch*)patch,false);
+ instrument->PP_Update( instrument, ( struct Patch* )patch, false, false );
//printf(" ^^^^^^^^ mousepress_select_chip\n");
EVENTLOG_add_event("start_moving_chips called from mousepress_select_chip");
@@ -1987,7 +1987,8 @@ bool MyScene::fix_mousePressEvent(radium::MouseCycleEvent &event){
if(patch==NULL)
R_ASSERT(false);
else
- instrument->PP_Update(instrument,(struct Patch*)patch,false);
+ //instrument->PP_Update(instrument,(struct Patch*)patch,false);
+ instrument->PP_Update( instrument, ( struct Patch* )patch, false, true );
}
//printf(" ^^^^^^^^^^^^ 222 mousepress_select_chip\n");
diff --git a/mixergui/QM_chip.cpp b/mixergui/QM_chip.cpp
index fd75f51e2..8b3a5414e 100644
--- a/mixergui/QM_chip.cpp
+++ b/mixergui/QM_chip.cpp
@@ -993,7 +993,7 @@ static bool CONNECTIONS_apply_changes(QGraphicsScene *scene, const changes::Audi
if (bus_num >= 0){
if (from_patch==PATCH_get_current())
- GFX_PP_Update(from_patch, false);
+ GFX_PP_Update( from_patch, false, false );
}
}
@@ -2713,7 +2713,7 @@ void Chip::mousePressEvent(QGraphicsSceneMouseEvent *event)
//printf("Pressed. %f / %f\n",pos.x(),pos.y());
struct Instruments *instrument = get_audio_instrument();
- instrument->PP_Update(instrument,(struct Patch*)patch,false);
+ instrument->PP_Update( instrument, ( struct Patch* )patch, false, false );
// solo onoff
if(in_solo_button(pos)){