Example #1
0
 public final boolean init(VSDFile vf, BufferMode mode) {
   AudioManager am = jmri.InstanceManager.getDefault(jmri.AudioManager.class);
   if (!initialized) {
     try {
       sound_src = (AudioSource) am.provideAudio(SrcSysNamePrefix + system_name);
       sound_src.setUserName(BufUserNamePrefix + user_name);
       setLooped(false);
       if (mode == BufferMode.BOUND_MODE) {
         sound_buf = (AudioBuffer) am.provideAudio(BufSysNamePrefix + system_name);
         sound_buf.setUserName(BufUserNamePrefix + user_name);
         if (vf == null) {
           sound_buf.setURL(vsd_file_base + filename);
         } else {
           java.io.InputStream ins = vf.getInputStream(filename);
           if (ins != null) {
             sound_buf.setInputStream(ins);
           } else {
             return (false);
           }
         }
         sound_src.setAssignedBuffer(sound_buf);
         setLength();
       }
     } catch (AudioException | IllegalArgumentException ex) {
       log.warn("Problem creating SoundBite: " + ex);
     }
   }
   return (true);
 }
Example #2
0
 public void setURL(String filename) {
   this.filename = filename;
   sound_buf.setURL(vsd_file_base + filename);
 }