@@ -199,6 +199,16 @@ void AudioDevice::audioOutObject(ofSoundBuffer &outputBuffer){
199199
200200// --------------------------------------------------------------
201201void AudioDevice::resetSystemObject (){
202+
203+ vector<bool > tempInletsConn;
204+ for (int i=0 ;i<this ->numInlets ;i++){
205+ if (this ->inletsConnected [i]){
206+ tempInletsConn.push_back (true );
207+ }else {
208+ tempInletsConn.push_back (false );
209+ }
210+ }
211+
202212 ofxXmlSettings XML;
203213
204214 deviceLoaded = false ;
@@ -263,6 +273,18 @@ void AudioDevice::resetSystemObject(){
263273 this ->inletsConnected .clear ();
264274 this ->initInletsState ();
265275
276+ for (int i=0 ;i<this ->numInlets ;i++){
277+ if (i<static_cast <int >(tempInletsConn.size ())){
278+ if (tempInletsConn.at (i)){
279+ this ->inletsConnected .push_back (true );
280+ }else {
281+ this ->inletsConnected .push_back (false );
282+ }
283+ }else {
284+ this ->inletsConnected .push_back (false );
285+ }
286+ }
287+
266288 this ->height = OBJECT_HEIGHT;
267289
268290 if (this ->numInlets > 6 || this ->numOutlets > 6 ){
@@ -291,7 +313,7 @@ void AudioDevice::resetSystemObject(){
291313 XML.popTag ();
292314 }
293315 }else {
294- // remove links to the this object
316+ // remove links to this object if exceed new inlets number
295317 if (XML.pushTag (" outlets" )){
296318 int totalLinks = XML.getNumTags (" link" );
297319 for (int l=0 ;l<totalLinks;l++){
@@ -300,7 +322,7 @@ void AudioDevice::resetSystemObject(){
300322 vector<bool > delLinks;
301323 for (int t=0 ;t<totalTo;t++){
302324 if (XML.pushTag (" to" ,t)){
303- if (XML.getValue (" id" , -1 ) == this ->nId ){
325+ if (XML.getValue (" id" , -1 ) == this ->nId && XML. getValue ( " inlet " , - 1 ) > this -> getNumInlets ()- 1 ){
304326 delLinks.push_back (true );
305327 }else {
306328 delLinks.push_back (false );
@@ -333,6 +355,16 @@ void AudioDevice::resetSystemObject(){
333355
334356// --------------------------------------------------------------
335357void AudioDevice::loadDeviceInfo (){
358+
359+ vector<bool > tempInletsConn;
360+ for (int i=0 ;i<this ->numInlets ;i++){
361+ if (this ->inletsConnected [i]){
362+ tempInletsConn.push_back (true );
363+ }else {
364+ tempInletsConn.push_back (false );
365+ }
366+ }
367+
336368 ofxXmlSettings XML;
337369
338370 if (XML.loadFile (patchFile)){
@@ -407,6 +439,18 @@ void AudioDevice::loadDeviceInfo(){
407439 this ->inletsConnected .clear ();
408440 this ->initInletsState ();
409441
442+ for (int i=0 ;i<this ->numInlets ;i++){
443+ if (i<static_cast <int >(tempInletsConn.size ())){
444+ if (tempInletsConn.at (i)){
445+ this ->inletsConnected .push_back (true );
446+ }else {
447+ this ->inletsConnected .push_back (false );
448+ }
449+ }else {
450+ this ->inletsConnected .push_back (false );
451+ }
452+ }
453+
410454 this ->height = OBJECT_HEIGHT;
411455
412456 if (this ->numInlets > 6 || this ->numOutlets > 6 ){
0 commit comments