Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (541)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
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  
  SoundSystem and fadeIn  (Read 2827 times)
0 Members and 1 Guest are viewing this topic.
Offline divxdede

Junior Devvie





« Posted 2010-10-04 18:42:22 »

Hi,

After wrote this simple API http://www.java-gaming.org/topics/simple-api-for-javasound-use/23004/view.html
I'm starting to replace it by SoundSystem in my game and see how it works, especially with the openAL plugin.

One of the functionnality that i need to refactor is "starting a sound with a fadeIn".

I'm trying this kind of code but it doesn't work (the sound starts without fades):

1  
2  
3  
4  
5  
 
            SoundSystem ss = new SoundSystem(); // plugins and codec was previously configured
            ss.newStreamingSource(false,"espace_01","espace_01.ogg",true, 0, 0, 0, SoundSystemConfig.ATTENUATION_NONE, 0 );
            ss.fadeOutIn(null , "espace_01" , 0L , 2000L );
            ss.play("espace_01");

I'm sure i miss something important, but i'm not be able to find it..

In the counterpart, the fadeOut works fine with:
           
1  
           ss.fadeOut("espace_01" , null , 1500 );


Sébastien.
Offline paulscode

Senior Devvie


Medals: 12


Staff Sergeant


« Reply #1 - Posted 2010-10-05 00:48:44 »

I think the reason might be that the sound has to be playing for fadeOutIn to function.  I'm not sure if or why I made it behave this way - I'll look at the code to see if it can be changed.  Obviously, being able to fade in is an important capability.  In the meantime, try and see if you can fix the problem by creating the streaming source from a small silent sound effect, play it, and then call fadeOutIn

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Offline divxdede

Junior Devvie





« Reply #2 - Posted 2010-10-05 06:19:47 »

Tanks for your reply.

I'm trying also this code


1  
2  
3  
4  
5  
6  
            ss.newStreamingSource(false,"espace_01","espace_01.ogg",true, 0, 0, 0, SoundSystemConfig.ATTENUATION_NONE, 0 );
            ss.setVolume( "espace_01" , 0f );
            ss.play("espace_01");
            ss.fadeOutIn( null , "espace_01" , 0L , 5000L );
            ss.setVolume( "espace_01" , 1f ); // without : the sequence is completely silent
                                              // with : the sound play at the normal volume without any fadeIn


But now way to start the fadeIn.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline paulscode

Senior Devvie


Medals: 12


Staff Sergeant


« Reply #3 - Posted 2010-10-05 20:32:07 »

That definitely looks like a bug.  I'll let you know what I find out.

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Offline divxdede

Junior Devvie





« Reply #4 - Posted 2010-10-06 12:05:19 »

Thanks, i will keep an eye here  Wink
Offline divxdede

Junior Devvie





« Reply #5 - Posted 2010-10-23 08:12:39 »

Hello, have you any news of this issue ?

Best regards,
Sébastien.
Offline paulscode

Senior Devvie


Medals: 12


Staff Sergeant


« Reply #6 - Posted 2010-10-23 15:08:35 »

Sorry for the delay.  My hard drive recently crashed and I've had to go through the tedious process of restoring backups.  I'm back up and running now, though, so I'll work on this later today.

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Offline paulscode

Senior Devvie


Medals: 12


Staff Sergeant


« Reply #7 - Posted 2010-10-24 03:36:41 »

Ok, solved the problem.  For fade-in effect use something like this:
1  
2  
3  
4  
            SoundSystem ss = new SoundSystem(); // plugins and codec was previously configured
            ss.newStreamingSource( false, "espace_01", "espace_01.ogg", true, 0, 0, 0, SoundSystemConfig.ATTENUATION_NONE, 0 );
            ss.fadeOutIn( "espace_01", "espace_01.ogg", 0L, 2000L );
            ss.play( "espace_01" );



Bug-Fixes Update

Sound System jPCT
Sound System

JavaSound library pluggin

WAV codec pluggin


What's New:
- Updated CodecWav link to current version
- Improved LibraryJavaSound performance slightly in non-Sun Java versions
- Handled rare pan-control exception
- Fixed fadeOutIn bug which caused fade-in effect to be silent

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Offline divxdede

Junior Devvie





« Reply #8 - Posted 2010-10-24 07:40:05 »

I donwload it, i try it and let you a feedback.
Tanks you.

Sébastien.
Offline divxdede

Junior Devvie





« Reply #9 - Posted 2010-10-24 11:06:29 »

It works, thanks !!
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.

Mr.CodeIt (10 views)
2014-12-27 04:03:04

TheDudeFromCI (13 views)
2014-12-27 02:14:49

Mr.CodeIt (25 views)
2014-12-23 03:34:11

rwatson462 (56 views)
2014-12-15 09:26:44

Mr.CodeIt (46 views)
2014-12-14 19:50:38

BurntPizza (92 views)
2014-12-09 22:41:13

BurntPizza (113 views)
2014-12-08 04:46:31

JscottyBieshaar (85 views)
2014-12-05 12:39:02

SHC (95 views)
2014-12-03 16:27:13

CopyableCougar4 (102 views)
2014-11-29 21:32:03
Resources for WIP games
by kpars
2014-12-18 10:26:14

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
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!