Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (426)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  [1.5.0]sampled stuff isn't working anymore  (Read 6300 times)
0 Members and 1 Guest are viewing this topic.
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Posted 2004-10-02 07:46:44 »

Ye, just like that. No exception... nothing... just silence :-/

Even Sun's "JavaSoundDemo" is silent... no wav, no aif, no midi, no rmf... silence Sad

Win98se, sb128, directx9 (dx tests work flawlessly) [dunno if direct sound is used].

弾幕 ☆ @mahonnaiseblog
Offline Bombadil

Senior Member





« Reply #1 - Posted 2004-10-02 10:06:24 »

Well yes, something seems broken with Java 1.5 sound. :-(

The official Javasound Demo does produce these results on a Win2000 box:
0. 1-welcome.wav : works
1. 22-new.aif : works
2. sfx-medley.rmf : silence
3. spacemusic.au : works
4. trippygaia1.mid : silence

My own little code outputting some wavs which worked with Java 1.4.x does produce some hiccup with Java 1.5.0: you hear something but it's wrong.
Offline DrBizzar0

Junior Member




Raj raj!


« Reply #2 - Posted 2004-10-02 10:17:56 »

for me it seems like sound clips under 1 second in length for the most time produces silence and sometimes static noice.  Huh
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline erikd

JGO Ninja


Medals: 15
Projects: 4
Exp: 14 years


Maximumisness


« Reply #3 - Posted 2004-10-03 00:16:16 »

I had a problem too with 1.5 and javasound. The initialization behaved differently, causing initialization to fail. I filed a bug report but I have to check if they fixed that one.
Dunno if it's the same problem though...

EDIT: Just checked, should be fixed in the RC version.

Offline princec

JGO Kernel


Medals: 284
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #4 - Posted 2004-10-04 09:33:01 »

No sounds in Puppy Invaders (applet we've got) either. Bugger.

Cas Smiley

Offline Bombadil

Senior Member





« Reply #5 - Posted 2004-10-05 08:37:18 »

Does this mean that many games won't sound correct (or be silent?) when being used with the new Java 1.5 ?

If so: Erik, could you please post the URL to your bug report so that we can vote on this. Maybe we should even start a general topic to ask people to vote for a bug fix.
A JVM which produces wrong or no sounds is very bad for games!

---

Sun article from 30-Sep-2004... Tiger Roars: The Release of Java 2 Platform, Standard Edition (J2SE) 5.0, an Interview with Sun Fellow Graham Hamilton. (He's the lead architect for J2SE releases 1.3, 1.4, and now, 5.0.)
Quote
I'm also happy to report that Tiger looks like our highest quality J2SE release ever. Quality had been job #1 throughout the release development and this has paid off. In his recent blog, Mark Reinhold, Chief Engineer for J2SE, talks about how well we are doing on our various quality metrics. (..)
Theme #1 is quality. By quality, we mean stability, robustness, and compatibility. We want your earlier applications to just plain work with Tiger. We want to maintain previous behavior. We want this to be a release that can stay up for months or years at a time.

Ahem. So nobody of those many quality testers of "job #1" ever run the Java sound demo with Java 1.5 ? Sigh, maybe they shouldn't hear music with headphones at work.
Offline princec

JGO Kernel


Medals: 284
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #6 - Posted 2004-10-06 10:11:17 »

"Tiger squeaks" may have been a better title.

Cas Smiley

Offline erikd

JGO Ninja


Medals: 15
Projects: 4
Exp: 14 years


Maximumisness


« Reply #7 - Posted 2004-10-06 11:39:51 »

Quote
Does this mean that many games won't sound correct (or be silent?) when being used with the new Java 1.5 ?

If so: Erik, could you please post the URL to your bug report so that we can vote on this. Maybe we should even start a general topic to ask people to vote for a bug fix.
A JVM which produces wrong or no sounds is very bad for games!


The problem was that bahaviour of initialization was different than before, but in cases where initialization was not done correctly. Because that wrong way of initializing was a very common mistake, they decided to revert back to old behaviour.
Should be fixed in 1.5.0 RC.
Read about it here: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5053380

Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #8 - Posted 2004-10-06 12:12:22 »

>Apparently, this mis-use of DataLine.Info's audio format is quite common.

Hm... yea... very funny. I only found examples which "mis-use" that.

So what's the proper way then? And why don't they mention it?

Should I try open() without params, because that wrong way was commonly used and got fixed?

Bah. It's so screwed.

弾幕 ☆ @mahonnaiseblog
Offline Malohkan

Senior Member




while (true) System.out.println("WOO!!!!");


« Reply #9 - Posted 2004-10-06 12:52:43 »

why couldn't they, for backward compatibility purposes, make them both work?

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Bombadil

Senior Member





« Reply #10 - Posted 2004-10-06 12:54:52 »

Quote

The problem was that bahaviour of initialization was different than before, but in cases where initialization was not done correctly.

Thanks, good to hear. So it's just the JavaSound demo which is partly broken and many sound play routines, including mine. So we're to blame? :)

I checked my routine against the format parameter and it's there. I don't see what I am doing wrong to play a simple clip...
I tried to follow the Sound programmer's guide in the Javadoc. Here's my version. Does anybody see what's the problem?
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
BufferedInputStream is = new BufferedInputStream(new FileInputStream("Sam.wav"));

AudioInputStream audiostream = AudioSystem.getAudioInputStream(is);
AudioFormat audioformat = audiostream.getFormat();

int bytelength = (int) (audioformat.getFrameSize() * audiostream.getFrameLength());
byte[] sampledata  = new byte[bytelength];
audiostream.read(sampledata, 0, bytelength);

DataLine.Info datalineinfo = new DataLine.Info(Clip.class, audioformat, bytelength);
Clip klip = (Clip) AudioSystem.getLine(datalineinfo);
klip.open(audioformat, sampledata, 0, bytelength);
klip.start();

Offline wmjoers

Senior Newbie




Nobody can be uncheered with a balloon.


« Reply #11 - Posted 2004-10-07 06:20:00 »

I'm using java.applet.AudioClip (wich is very old but has been working until now).  

Some of my wav's has gone silent...most of them are less than 1 sec but some works and some don't.

Has anyone filed a bug report regarding the sound problems?
Offline erikd

JGO Ninja


Medals: 15
Projects: 4
Exp: 14 years


Maximumisness


« Reply #12 - Posted 2004-10-07 07:53:28 »

Quote
Does anybody see what's the problem?

Looks fine to me.
If this worked in 1.4, maybe you can use it to create a small test case and file a bug report (if it's not there already)?

In any way, even if there was something wrong, bahaviour shouldn't change with a new version I think.

Offline Bombadil

Senior Member





« Reply #13 - Posted 2004-10-07 09:08:38 »

Quote

Looks fine to me.
If this worked in 1.4, maybe you can use it to create a small test case and file a bug report (if it's not there already)?

It worked fine for all Java 1.4 versions.
Plus I can't see the "missing format parameter" which your originally quoted bug mentioned. So I think this sample should work. Which it doesn't. I think I'm going to issue a bug report soon.

Wmjoers: Yes, "Applet.AudioClip" ist very easy to use, but isn't one problem of it that you can't play the same Clip (which maps to a wav file for example) several times at once?
Offline wmjoers

Senior Newbie




Nobody can be uncheered with a balloon.


« Reply #14 - Posted 2004-10-07 12:14:19 »

Well anyway.. i've used AudioClip in a game(not an applet) and it allways worked perfect (even in the 1.5 beta) but suddenly in 5.0 (1.5) some of the wav files are silent. It seems to me that some fundamental things has been broken in Java Sound.    Cry
Offline dranonymous

Junior Member




Hoping to become a Java Titan someday!


« Reply #15 - Posted 2004-10-07 14:31:42 »

As a small note about AudioClips and WAVs.  I've had nothing but problems with them.. Some work, some don't.  My solution, which seems to always work, is to only use AIFF format.  You'll have to convert your existing sounds, but you can get Audacity from sourceForge and you'll be on your way.

Dr. A>
Offline Hansdampf

Senior Member


Projects: 3


too offending?


« Reply #16 - Posted 2004-10-07 19:40:41 »

Quote

Some of my wav's has gone silent...most of them are less than 1 sec but some works and some don't.


same here, short sounds don't work (occasionally? they do), longer ones work (some do not).
Does'nt seem to have to do anything with the audio format because I'm generating them (not loading from a file)

lots of sillystupid games: http://www.emaggame.com
Offline Bombadil

Senior Member





« Reply #17 - Posted 2004-10-08 06:49:45 »

Looks like there's some real bug in there...
Would some of you knowing more about Javasound, like to file a bug report to SUN's database?
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #18 - Posted 2004-10-08 09:12:34 »

Kickin midi events manually in surprisingly works.

Playing rmf also (sometimes) works if you play, pause, wait, unpause... alright (midi should "work" like that too)... but of course - just for the fun of it - the last seconds are cut off. Yea, very funny indeed :-/

弾幕 ☆ @mahonnaiseblog
Offline wmjoers

Senior Newbie




Nobody can be uncheered with a balloon.


« Reply #19 - Posted 2004-10-11 12:53:31 »

Found a bugreport on AudioClip... http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5070730
Offline Bombadil

Senior Member





« Reply #20 - Posted 2004-10-12 16:33:09 »

Quote

Ah, there it is:
Quote

Thus this is java sound's problem, not applet's one.
xxxxx@xxxxx  2004-09-17

This might be either java sound or io problem, reassigning to javasound for further
investigation.
xxxxx@xxxxx  2004-09-17


So I guess we should all vote on this bug? It's just four votes so far. :-(
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #21 - Posted 2004-10-12 17:25:11 »

Quote

Ah, there it is:

So I guess we should all vote on this bug? It's just four votes so far. :-(


Ye, well I'm wondering if it's the right one to vote for. The whole sound stuff is b0rked in my case (except manually triggered midi events).

弾幕 ☆ @mahonnaiseblog
Offline Bombadil

Senior Member





« Reply #22 - Posted 2004-10-12 17:37:08 »

Quote
Ye, well I'm wondering if it's the right one to vote for. The whole sound stuff is b0rked in my case (except manually triggered midi events).

Ok. Then somebody please file a "borq sound" bug and annotate it here so we all can vote for it.
Offline Yuri Vl. Gushchin

Senior Member




Speak Java!


« Reply #23 - Posted 2004-11-07 11:46:47 »

Bombadil,

I was checking the problem with JavaSound driver of Xith3D and found that the problems happen only with direct audio drivers. I tried to fall back to Software Mixer, and everything is working fine again. If this workaround is OK for you, you can use the following code to get software mixer:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
    public Mixer getMixer() {
        Mixer.Info[] mixers = AudioSystem.getMixerInfo();
        for (int i = 0; i < mixers.length; i++) {
            if ("Java Sound Audio Engine".equals(mixers[i].getName())) {
                return AudioSystem.getMixer(mixers[i]);
            }
        }
        return null;
    }

...
        Mixer mix = getMixer();
        // Use selected (compatible) Mixer, or fall back to default system Mixer if no compatible one found
       if (mix != null)
            clip = (Clip) mix.getLine(...);
        else
            clip = (Clip) AudioSystem.getLine(...);
        clip.open(sb.af,sb.data,0,sb.size);
    }


Yuri

Yuri Vl. Gushchin
JProof Group
Offline Bombadil

Senior Member





« Reply #24 - Posted 2004-11-08 05:35:34 »

Quote
I was checking the problem with JavaSound driver of Xith3D and found that the problems happen only with direct audio drivers. I tried to fall back to Software Mixer, and everything is working fine again. If this workaround is OK for you, you can use the following code to get software mixer

Thanks Yuri, this works perfect. Welcome back on the forum. :-)
So, does Xith now also use this workaround, ie Java software mixer for sound?

Does the software mixer mean a big performance decrease in contrast to other mixers, or is it marginal?
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #25 - Posted 2004-11-08 07:11:29 »

That workaround isn't working for me :-/

However, I just found out that I can play rather long wavs pretty fine. Eg like so:
http://www.jsresources.org/examples/SimpleAudioPlayer.java.html

But short ones doesn't work at all and rather short ones randomly work Sad

弾幕 ☆ @mahonnaiseblog
Offline Yuri Vl. Gushchin

Senior Member




Speak Java!


« Reply #26 - Posted 2004-11-08 07:22:09 »

Hi,

Quote
So, does Xith now also use this workaround, ie Java software mixer for sound?


Yes.

Quote
Does the software mixer mean a big performance decrease in contrast to other mixers, or is it marginal?


Not really. It was default implementation in Java 1.4.2.

Yuri

Yuri Vl. Gushchin
JProof Group
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #27 - Posted 2004-11-08 07:37:50 »

Alright. I just voted for 5070730 after some research.

弾幕 ☆ @mahonnaiseblog
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #28 - Posted 2004-11-10 07:14:06 »

just got hit by same bug - reverting to software mixer works - go figure.

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #29 - Posted 2004-11-10 07:22:53 »

but when I shutdown the sound engine, I get some strange sounds - like something run backwards.

I shutdown the sound engine by enumerating all clips and calling close on them. If I don't do that, it shutdowns quicker and I don't get any distorted sound effects.

Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (72 views)
2014-04-15 18:08:23

BurntPizza (68 views)
2014-04-15 03:46:01

UprightPath (79 views)
2014-04-14 17:39:50

UprightPath (65 views)
2014-04-14 17:35:47

Porlus (80 views)
2014-04-14 15:48:38

tom_mai78101 (104 views)
2014-04-10 04:04:31

BurntPizza (164 views)
2014-04-08 23:06:04

tom_mai78101 (260 views)
2014-04-05 13:34:39

trollwarrior1 (210 views)
2014-04-04 12:06:45

CJLetsGame (220 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!