Jump to content

How to use ISoundHandler?


Wa_delma

Recommended Posts

I am trying to get my mod to register sound with it but I keep getting error to the console:

 

 

C:\Users\****\Desktop\MCPs\mcp62_forge_updated\jars\mods\Psientic\psi\fx\swoosh.ogg true

Error in class 'LibraryLWJGLOpenAL'

    No codec found for file 'swoosh.1' in method 'loadSound'

Error in class 'LibraryLWJGLOpenAL'

    Source 'sound_1' was not created because an error occurred while loading swoosh.1

Error in class 'LibraryLWJGLOpenAL'

    Source 'sound_1' not found in method 'play'

 

 

And as you can see from my code:

 

 

package net.minecraft.src.psientic.mods.data;

import java.io.File;
import java.net.URL;

import net.minecraft.src.SoundManager;
import net.minecraft.src.mod_psientic;
import net.minecraft.src.forge.adaptors.SoundHandlerAdaptor;

public class CaveshroomSoundHandler extends SoundHandlerAdaptor{
public void onSetupAudio(SoundManager soundManager){

}

public void onLoadSoundSettings(SoundManager soundManager){
	URL resource = mod_psientic.getInstance().getClass().getResource("swoosh.ogg");
	File file = new File("C:/Users/****/Desktop/MCPs/mcp62_forge_updated/jars/mods/Psientic/psi/fx/swoosh.ogg");
	System.out.println(file + " " + file.exists());
	soundManager.addSound("swoosh.1", file);
	soundManager.playSound("swoosh", 0, 0, 0, 1.0F, 1.0F);
}
}

 

 

the file is in .ogg format which should be supported so I have no idea why it says that there is no codec for that.

 

Here is the sound effect I tried to get to play.

 

I know that it isn't wise to use absolute path for that file but it's just for testing purposes as I weren't able to find correct relative one. I will try to make that happen after ensuring it actually plays it.

 

Link to comment
Share on other sites

because you're telling it that the file name is 'swoosh.1'

'1' is a unknown codec, hence the error.

:o;D Such a noob mistake.. I assumed that what comes after that dot is secondary "category" as in other sounds added to soundPoolSounds (First thing I did was to print what that contained and tried to copy that).

 

Anyway thanks for helping... I will try to it.

 

Edit: And it works! This topic can be locked now.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.