🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #8175

How I can build correctly in Java a subclass of sound who use threads?

#8175
From: Mircea Cretu
Date: Mon, 09 Apr 2001 17:41
73 lines
2317 bytes
Hello,

How I can build correctly subclass of sound who use threads in Java?

I made a subclass of Sound in Java. The code below:

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.io.File;
import java.applet.*;

public class CSound extends Applet implements Runnable
{
 private String filename = "untitled";
 private String extension;
 protected boolean mute;
 int nAudioType;
    String errStr;
    protected double duration, seconds;
    File file;
    AudioClip clip;
 Thread  thread;

 public CSound2() throws Exception
 {
  clip = getAudioClip(getDocumentBase(),filename);
 }

 public void play()
 {
  clip.play();
 }

 public void loop()
 {
  clip.loop();
 }

 public void stop()
 {
  clip.stop();
 }

 public void run()
 {
  //
 }

 //return extension file name
 public static String FindExtension(String filename)
 {
  //determine which is the last occurence of "." in filename string
  int ind = filename.lastIndexOf(".");

  if (ind == -1 ||
  ind == filename.length() ||
  filename.lastIndexOf(File.separator) > ind)
  {
   return filename;
  }
  return filename.substring(ind+1,3);
 }
}


and this subclass I want to use in a sample, instead of classic sound class.



Thank you,

Mike
Technical Details
Message-ID: <7vmA6.537615$Pm2.8808107@news20.bellglobal.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!sn-xit-04!supernews.com!europa.netcrusader.net!205.252.116.205!howland.erols.net!news3.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,9460a1d9e4ade2b6,start
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-04-09 10:46:01 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!sn-xit-04!supernews.com!europa.netcrusader.net!205.252.116.205!howland.erols.net!news3.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail
From: "Mircea Cretu" <mcretu@den-o-tech.com>
Newsgroups: borland.public.jbuilder.java.language
Subject: How I can build correctly in Java  a subclass of sound who use threads?
Lines: 76
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2462.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2462.0000
Message-ID: <7vmA6.537615$Pm2.8808107@news20.bellglobal.com>
Date: Mon, 09 Apr 2001 17:41:23 GMT
NNTP-Posting-Host: 216.208.136.194
X-Trace: news20.bellglobal.com 986838083 216.208.136.194 (Mon, 09 Apr 2001 13:41:23 EDT)
NNTP-Posting-Date: Mon, 09 Apr 2001 13:41:23 EDT
Organization: Sympatico