Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  How to change the sound volume  (Read 4353 times)
0 Members and 1 Guest are viewing this topic.
Offline antoinelechacal

Junior Duke





« Posted 2005-11-04 18:37:27 »

Hi all, I'm using Jorbis/Jogg to play ogg vorbis songs, but I don't know how to change the volume?

Thanks
See ya

My name is nobody
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #1 - Posted 2005-11-04 23:49:15 »

Do a search before you post. Someone asked this exact thing not too long ago.

Check this link.
http://forum.java.sun.com/thread.jspa?threadID=636859&messageID=3716189

See my work:
OTC Software
Offline antoinelechacal

Junior Duke





« Reply #2 - Posted 2005-11-05 22:11:28 »

Thanks for your help, but I don't want to use JMF, I'm just using jorbis and I don't want to change the file I'm reading from.

See ya

My name is nobody
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline antoinelechacal

Junior Duke





« Reply #3 - Posted 2006-02-08 17:59:07 »

Up!
Nobody can answer to this question?
Please, please  Cry

My name is nobody
Offline c_lilian

Senior Duke


Projects: 1


Java games will probably rock someday...


« Reply #4 - Posted 2006-02-11 20:18:00 »

For Jack Flowers I've copied streamed ogg vorbis soundtracks into a Clip object for playback.

Once you've got a Line from the Clip, you can get a MASTER_GAIN control (line.getControl(FloatControler.MASTER_GAIN, if I remember well). and then you just change the gain (for example you set -10 to reduce your signe by 10db). In java 5, the line must be opened before getting the control.

With this method I've got some problems when invoking master gain many times for a fade out effect (sometimes the sound stop totally) but it might be because of a poor implementation from my side... I haven't spent a lot of time on it yet.

You can also have a look at jsresources.org... may be you'll find another way to acheive this.

But if anybody has a better (working) Fade In / Fade out please help us !!

Lilian

Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #5 - Posted 2006-02-12 00:24:27 »

With this method I've got some problems when invoking master gain many times for a fade out effect (sometimes the sound stop totally) but it might be because of a poor implementation from my side... I haven't spent a lot of time on it yet.

Do you have a reproducible test case?

Offline antoinelechacal

Junior Duke





« Reply #6 - Posted 2006-02-13 17:42:20 »

With this method I've got some problems when invoking master gain many times for a fade out effect (sometimes the sound stop totally) but it might be because of a poor implementation from my side... I haven't spent a lot of time on it yet.

Do you have a reproducible test case?

Yep, I'd be also very interested in this.

My name is nobody
Offline c_lilian

Senior Duke


Projects: 1


Java games will probably rock someday...


« Reply #7 - Posted 2006-02-13 17:58:04 »

I'm working on this... the simple test case seems to work fine (I've just adapted the GageSound 1.2 with vorbis SPI, and accessed the master gain control from the clip's lines).

Here's an example (you'll have to install the vorbis java sound SPI to use it, or alternatively provide a long wav file). I haven't digged into gagesound yet, but it seems to load everything into memory before playing.


Lilian


Offline antoinelechacal

Junior Duke





« Reply #8 - Posted 2006-02-13 19:54:06 »

I tried your sample of code, but it doesn't seem to work, maybe I'm soing somethig wrong: I get an javax.sound.sampled.UnsupportedAudioFileException when I try to run it using an ogg file, I've copied the javazoom vorbisspi into my jre/lib/exct directory and jorbis is installed...
I don't understand, what am I doing wrong?

My name is nobody
Offline c_lilian

Senior Duke


Projects: 1


Java games will probably rock someday...


« Reply #9 - Posted 2006-02-14 06:19:24 »

you must have a services file in the META-INF dir of one of your jars.

search for java sound services SPI

Lilian

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline antoinelechacal

Junior Duke





« Reply #10 - Posted 2006-02-14 12:20:53 »

You're right, there are two files: javax.sound.sampled.spi.AudioFileReader
and javax.sound.sampled.spi.FormatConversionProvider

what shoud I do then?

My name is nobody
Offline c_lilian

Senior Duke


Projects: 1


Java games will probably rock someday...


« Reply #11 - Posted 2006-02-14 13:10:45 »

I guess Audiofilereader contains a line like javazoom.spi....VorbisAudioFileReader
and the other file contains javazoom.spi...VorbisFormatConversionProvider

then with these files added to your jar and the appropriate jars (tritonus_share.jar, vorbis.jar) in your classpath, you should be able to read your ogg files (I can).

for my own tests I've not altered the jre directory : everything is in my application's class path.

Lilian

Offline antoinelechacal

Junior Duke





« Reply #12 - Posted 2006-02-14 14:10:57 »

Sorry for being such a newbie, but I still can't use it...
I haven't built any jar of my application software, I'm currently coding it under eclipse, what I want is to be able to test it directly.
I added the jorbis/jogg/vorbisspi/tritonus_share jars to my classpath and copied the files into my sound package, is this what I have to do?

Thanks again

My name is nobody
Offline c_lilian

Senior Duke


Projects: 1


Java games will probably rock someday...


« Reply #13 - Posted 2006-02-14 14:19:25 »

I don't know, I use netbeans and everything in my sources dir is added to the project jar...

Try and create a jar with just the META-INF/services data into it, and add it to your class path, it might work...

(If you don't know how to create a jar... create a zip and rename it as .jar)

Lilian

Offline antoinelechacal

Junior Duke





« Reply #14 - Posted 2006-02-16 22:06:15 »

That works, I just had to put tritaunus into my jre/lib/ext to make it work, thanks for your help c_lilian

My name is nobody
Pages: [1]
  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.

Longarmx (49 views)
2014-10-17 03:59:02

Norakomi (38 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (35 views)
2014-10-15 16:18:58

TehJavaDev (65 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (55 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!