Examples of Zoeos


Examples of com.pcmsolutions.system.Zoeos

    private void dropIsolatedPresets(final ContextPresetSelection ips, final Object[] destRowObjects) {
        final Object progressOwner = new Object();
        final Thread mt = new ZDBModifyThread("D&D: Transfer IsolatedPresets") {
            public void run() {
                final Zoeos z = Zoeos.getInstance();
                z.beginProgressElement(progressOwner, ZUtilities.makeExactLengthString("Copying Presets", progressLabelWidth), destRowObjects.length * 2);
                int errors = 0;
                try {
                    final int j = destRowObjects.length;
                    for (int i = 0; i < j; i++) {
                        final int f_i = i;
                        final Object pobj = destRowObjects[i];
                        if (pobj instanceof ContextEditablePreset) {
                            final IsolatedPreset ip = ips.getIsolatedPreset(i);
                            z.updateProgressElement(progressOwner);
                            if (ip == null) {
                                z.updateProgressElement(progressOwner);
                                if (i >= j - 1)
                                    z.endProgressElement(progressOwner);
                                errors++;
                                continue;
                            }
                            new ZDBModifyThread("D&D: New Presets from IsolatedPresets") {
                                public void run() {
                                    // TODO!! should use a signal here to achieve correct ordering of threads
                                    try {
                                        z.updateProgressElementTitle(progressOwner, "Copying " + ip.getName() + " to " + ((ContextEditablePreset) pobj).getPresetDisplayName());
                                        ((ContextEditablePreset) pobj).newPreset(((ContextEditablePreset) pobj).getPresetNumber(), ip.getName(), ip);
                                    } catch (NoSuchPresetException e) {
                                        e.printStackTrace();
                                    } finally {
                                        z.updateProgressElement(progressOwner);
                                        if (f_i >= j - 1)
                                            z.endProgressElement(progressOwner);
                                    }
                                }
                            }.start();
                        } else {
                            z.updateProgressElement(progressOwner);
                            z.updateProgressElement(progressOwner);
                            if (i >= j - 1)
                                z.endProgressElement(progressOwner);
                            errors++;
                        }
                    }
                } finally {
                    if (errors == destRowObjects.length)
View Full Code Here

Examples of com.pcmsolutions.system.Zoeos

    }

    private void dropContextLocalPresets(final Object[] destRowObjects, final ReadablePreset[] readablePresets, final PresetContextTable pct) {
        new ZDBModifyThread("D&D: Copy Presets") {
            public void run() {
                final Zoeos z = Zoeos.getInstance();
                z.beginProgressElement(this, ZUtilities.makeExactLengthString("Copying Presets", progressLabelWidth), destRowObjects.length);
                int errors = 0;
                for (int i = readablePresets.length - 1; i >= 0; i--) {
                    try {
                        if (destRowObjects[i] instanceof ReadablePreset) {
                            z.updateProgressElementTitle(this, "Copying " + readablePresets[i].getPresetName() + " to " + ((ReadablePreset) destRowObjects[i]).getPresetDisplayName());
                            pct.getPresetContext().copyPreset(readablePresets[i].getPresetNumber(), ((ReadablePreset) destRowObjects[i]).getPresetNumber());
                        }
                    } catch (NoSuchPresetException e) {
                        errors++;
                        e.printStackTrace();
                    } catch (PresetEmptyException e) {
                        errors++;
                        e.printStackTrace();
                    } catch (NoSuchContextException e) {
                        errors++;
                        e.printStackTrace();
                    } finally {
                        z.updateProgressElement(this);
                    }
                }
                z.endProgressElement(this);
                if (errors == readablePresets.length)
                    JOptionPane.showMessageDialog(ZoeosFrame.getInstance(), (destRowObjects.length > 1 ? "None of the source presets could be copied" : "The source preset could not be copied"), "Problem", JOptionPane.ERROR_MESSAGE);
                else if (errors > 0)
                    JOptionPane.showMessageDialog(ZoeosFrame.getInstance(), errors + " of " + destRowObjects.length + " source presets could not be copied", "Problem", JOptionPane.ERROR_MESSAGE);
            }
View Full Code Here

Examples of com.pcmsolutions.system.Zoeos

    private void dropIsolatedSamples(final ContextSampleSelection ips, final Object[] destRowObjects) {
        final Object progressOwner = new Object();
        final Thread mt = new ZDBModifyThread("D&D: Transfer IsolatedSamples") {
            public void run() {
                final Zoeos z = Zoeos.getInstance();
                z.beginProgressElement(progressOwner, ZUtilities.makeExactLengthString("Copying Samples", progressLabelWidth), destRowObjects.length * 2);
                int errors = 0;
                try {
                    final int j = destRowObjects.length;
                    for (int i = j - 1; i >= 0; i--) {
                        final int f_i = i;
                        final Object sobj = destRowObjects[i];
                        if (sobj instanceof ContextEditableSample) {
                            IsolatedSample is = null;
                            try {
                                if (i == 0)
                                    is = ips.getIsolatedSample(i);
                                else
                                    is = ips.getIsolatedSample(i);
                                is.doAssert();
                            } catch (IsolatedSampleUnavailableException e) {
                                e.printStackTrace();
                            } finally {
                                z.updateProgressElement(progressOwner);
                                if (is == null) {
                                    z.updateProgressElement(progressOwner);
                                    if (i >= j - 1)
                                        z.endProgressElement(progressOwner);
                                    errors++;
                                    continue;
                                }
                            }
                            final IsolatedSample f_is = is;
                            // new ZDBModifyThread("D&D: New Samples from IsolatedSamples") {
                            //   public void run() {
                            // TODO!! should use a signal here to achieve correct ordering of threads
                            try {
                                z.setProgressElementIndeterminate(progressOwner, true);
                                z.updateProgressElementTitle(progressOwner, "Copying " + f_is.getName() + " to " + ((ContextEditableSample) sobj).getSampleDisplayName());
                                ((ContextEditableSample) sobj).newSample(f_is, f_is.getName());
                                f_is.zDispose();
                            } catch (NoSuchSampleException e) {
                                JOptionPane.showMessageDialog(ZoeosFrame.getInstance(), e.getMessage(), "Problem", JOptionPane.ERROR_MESSAGE);
                                errors++;
                                continue;
                            } catch (IsolatedSampleUnavailableException e) {
                                JOptionPane.showMessageDialog(ZoeosFrame.getInstance(), e.getMessage(), "Problem", JOptionPane.ERROR_MESSAGE);
                                errors++;
                                continue;
                            } finally {
                                z.setProgressElementIndeterminate(progressOwner, false);
                                z.updateProgressElement(progressOwner);
                                if (f_i >= j - 1)
                                    z.endProgressElement(progressOwner);
                            }
                            //  }
                            // }.stateStart();

                        } else {
                            z.updateProgressElement(progressOwner);
                            z.updateProgressElement(progressOwner);
                            if (i >= j - 1)
                                z.endProgressElement(progressOwner);
                            errors++;
                        }
                    }
                } finally {
                    if (errors == destRowObjects.length)
View Full Code Here

Examples of com.pcmsolutions.system.Zoeos

    private double devVer;

    public Impl_DeviceParameterContext(DeviceContext dc, com.pcmsolutions.device.EMU.E4.Remotable remote) throws RemoteDeviceDidNotRespondException, com.pcmsolutions.device.EMU.E4.RemoteUnreachableException, RemoteMessagingException {
        this.devVer = remote.getDeviceVersion();
        this.dc = dc;
        Zoeos z = Zoeos.getInstance();
        z.beginProgressElement(this, dc.makeDeviceProgressTitle("Initializing Device Parameter Context "), 6);
        try {
            generateMultiModeIds(remote);
            z.updateProgressElement(this);
            generateMasterIds(remote);
            z.updateProgressElement(this);
            generatePresetIds(remote);
            z.updateProgressElement(this);
            generateLinkIds(remote);
            z.updateProgressElement(this);
            generateZoneIds(remote);
            z.updateProgressElement(this);
            generateVoiceIds(remote);
            z.updateProgressElement(this);
        } finally {
            z.endProgressElement(this);
        }
    }
View Full Code Here

Examples of com.pcmsolutions.system.Zoeos

            }
        }

        if (f != null) {
            int errors = 0;
            Zoeos z = Zoeos.getInstance();
            z.beginProgressElement(this, ZUtilities.makeExactLengthString(prefix + " Samples", 80), samples.length);
            int overwriteMode = sap.getOverwriteMode();
            try {
                String name = "";
                String nameMode;
                int im = sap.getIndexMode();
                switch (im) {
                    case SaveAccessoryPanel.MODE_PREFIXED_INDEX:
                        nameMode = AudioUtilities.SAMPLE_NAMING_MODE_IN;
                        break;
                    case SaveAccessoryPanel.MODE_POSTFIXED_INDEX:
                        nameMode = AudioUtilities.SAMPLE_NAMING_MODE_NI;
                        break;
                    case SaveAccessoryPanel.MODE_NO_INDEX:
                        nameMode = AudioUtilities.SAMPLE_NAMING_MODE_N;
                        break;
                    default:
                        throw new IllegalArgumentException("illegal index mode");
                }
                for (int i = 0; i < samples.length; i++) {
                    try {
                        name = samples[i].getSampleDisplayName();
                        z.setProgressElementIndeterminate(this, true);
                        File sf;
                        SampleRetrievalInfo sri = new Impl_SampleRetrievalInfo(samples[i].getSample(), samples[i].getSampleName(), f, afap.getActiveType(), nameMode, true, (overwriteMode == SaveAccessoryPanel.MODE_ALWAYS_OVERWRITE ? true : false));
                        z.updateProgressElementTitle(this, prefix + " " + name + " to \"" + sri.getFile().getName() + "\"");
                        try {
                            sf = samples[i].retrieveCustomLocalCopy(sri);

                            if (sf == null && (overwriteMode == SaveAccessoryPanel.MODE_ASK_OVERWRITE)) {
                                //int r = UserMessaging.askYesNoYesAll("File for " + "\"" + name + "\"" + " already exists, overwrite?", "File Already Exists");
                                int r = UserMessaging.askYesNoYesAllNoAll("File \"" + sri.getFile().getName() + "\" already exists, overwrite?", "File Already Exists");

                                if (r == 2)
                                    overwriteMode = SaveAccessoryPanel.MODE_ALWAYS_OVERWRITE;
                                if (r == 3)
                                    overwriteMode = SaveAccessoryPanel.MODE_NEVER_OVERWRITE;
                                if (r == 0 && r == 2)
                                    samples[i].retrieveCustomLocalCopy(new Impl_SampleRetrievalInfo(samples[i].getSample(), samples[i].getSampleName(), f, afap.getActiveType(), nameMode, true, true));
                            }
                        } finally {
                            z.setProgressElementIndeterminate(this, false);
                            z.updateProgressElement(this, "Finished " + name);
                        }
                    } catch (NoSuchSampleException e) {
                        errors++;
                    } catch (SampleEmptyException e) {
                        errors++;
                    } catch (SampleRetrievalException e) {
                        errors++;
                    } finally {
                    }
                }
            } finally {
                try {
                    if (samples.length > 0)
                        samples[0].getDeviceContext().sampleMemoryDefrag(false);
                } catch (ZDeviceNotRunningException e) {
                } catch (RemoteUnreachableException e) {
                }
                z.updateProgressElement(this, ProgressMultiBox.PROGRESS_DONE_TITLE);
                z.endProgressElement(this);
            }
            if (errors == samples.length)
                JOptionPane.showMessageDialog(ZoeosFrame.getInstance(), (samples.length > 1 ? "None of the source samples could be retrieved" : "The source sample could not be retrieved"), "Problem", JOptionPane.ERROR_MESSAGE);
            else if (errors > 0)
                JOptionPane.showMessageDialog(ZoeosFrame.getInstance(), errors + " of " + samples.length + " source samples could not be retrieved", "Problem", JOptionPane.ERROR_MESSAGE);
View Full Code Here

Examples of com.pcmsolutions.system.Zoeos

            synchronized (deviceMap) {
                MidiDevice.Info[] devices;
                devices = MidiSystem.getMidiDeviceInfo();
                Map dm_clone = (Map) deviceMap.clone();
                deviceMap.clear();
                Zoeos z = Zoeos.getInstance();
                if (visualFeedback)
                    z.beginProgressElement(this, "Initializing Midi System", devices.length);
                MidiDevice.Info info;
                try {
                    for (int n = 0; n < devices.length; n++) {
                        try {
                            info = devices[n];
                            if (!dm_clone.containsKey(info)) {
                                deviceMap.put(info, new MidiDeviceFacade(info));
                            } else
                                deviceMap.put(info, dm_clone.get(info));
                        } finally {
                            if (visualFeedback)
                                z.updateProgressElement(this);
                        }
                    }
                } finally {
                    if (visualFeedback)
                        z.endProgressElement(this);
                }
            }
        } finally {
            midiLock.unlock();
        }
View Full Code Here

Examples of com.pcmsolutions.system.Zoeos

            this.timeout = timeout;
        }

        private List performHunt(int id) {
            Zoeos z = Zoeos.getInstance();
            List replies = new ArrayList();
            z.beginProgressElement(this, "Hunting for Devices...", huntOutlets.size());
            try {
                IdentityRequest msg = new IdentityRequest((byte) id);

                for (Iterator i = huntOutlets.iterator(); i.hasNext();) {
                    currOutlet = (Outlet) i.next();

                    currOutlet.dispatch(msg, -1);
                    System.out.println(Zoeos.getZoeosTime() + ": " + "Sending Identity Request on port:" + currOutlet.getDeviceInfo().toString() + " ; while listening on  " + huntInlets.size() + " ports");
                    try {
                        Thread.sleep(timeout);
                    } catch (IllegalStateException e) {
                        System.out.println(e);
                    } catch (InterruptedException e) {
                        System.out.println(e);
                    }

                    for (Iterator j = huntInlets.iterator(); j.hasNext();) {
                        final BufferedInlet inlet = (BufferedInlet) j.next();
                        final List buf = inlet.clearBuffer();

                        for (Iterator k = buf.iterator(); k.hasNext();) {
                            Object o = k.next();
                            final IdentityReply irm = (IdentityReply) o;
                            final IdentityRequest reqMsg = (IdentityRequest) msg.clone();
                            final MidiDevice.Info inInfo = inlet.getDeviceInfo();
                            final MidiDevice.Info outInfo = currOutlet.getDeviceInfo();
                            System.out.println("REPLY:");
                            System.out.println(irm);
                            System.out.println("OUT PORT->" + outInfo.toString());
                            System.out.println("IN PORT->" + inInfo.toString());
                            replies.add(new SysexTransactionRecord() {
                                public MidiDevice.Info getOutDeviceInfo() {
                                    return outInfo;
                                }

                                public MidiDevice.Info getInDeviceInfo() {
                                    return inInfo;
                                }

                                public FinalMidiMessage getReply() {
                                    return irm;
                                }

                                public IdentityRequest getRequest() {
                                    return reqMsg;
                                }
                            });
                        }
                    }
                    z.updateProgressElement(this);
                }
            } catch (Exception e) {
                System.out.println(e);
            } finally {
                z.endProgressElement(this);
            }
            return replies;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.