Captive Imagination
August 01, 2010, 12:00:45 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Check out the teaser site for the first official game by Captive Imagination: http://www.galaxiesbeyond.com
 
   Home   Help Search Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: How do I play sound?  (Read 1077 times)
0 Members and 1 Guest are viewing this topic.
Korin
Newbie
*
Offline Offline

Posts: 7


View Profile
« on: December 14, 2008, 12:41:24 PM »

Hello,

I am trying to play mp3 using jseamless, but with no success. Any help..examples?

Thanks.
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #1 on: December 14, 2008, 01:56:13 PM »

Yes, you instantiate an instance of org.jseamless.sound.Sound, call application.addSound(sound), then invoke application.play(sound) when you wish to play it.

If you have trouble from there feel free to post a sample code.
Logged
Korin
Newbie
*
Offline Offline

Posts: 7


View Profile
« Reply #2 on: December 14, 2008, 03:08:22 PM »

Hey thanks for the fast reply. I really like the way it has to be written, but I have another problem. It can not pass the ID3Tags and it needs them somewhere than an Exception is trown. I managed to reach three types of exceptions though.
First one:

java.lang.IllegalArgumentException: Can not set org.jseamless.sound.ID3Info field org.jseamless.event.SoundID3Event.id3Info to java.lang.String
   at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
   at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
   at sun.reflect.UnsafeObjectFieldAccessorImpl.set(Unknown Source)
   at java.lang.reflect.Field.set(Unknown Source)
   at org.jseamless.remote.rpc.CommunicationImpl.send(CommunicationImpl.java:280)
   at org.jseamless.remote.rpc.SessionCommunication.send(SessionCommunication.java:82)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
   at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:164)
   at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
   at org.jseamless.remote.j2ee.JSLServlet.doPost(JSLServlet.java:154)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Unknown Source)


Second one:


java.lang.RuntimeException: RemoteConverter.readField() - UNKNOWN TYPE: [12o1 Dance Hits 2008|Anna Grace|www.torrentazos.com|Dance|You Make Me Feel (Radio Edit)|19|2008]
   at org.jseamless.remote.protocol.RemoteConverter.stringToObject(RemoteConverter.java:424)
   at org.jseamless.remote.rpc.CommunicationImpl.send(CommunicationImpl.java:280)
   at org.jseamless.remote.rpc.SessionCommunication.send(SessionCommunication.java:82)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)


And the third one is that it can not parse an integer in RemoteConverter.stringToObject if the ID3Tag starts with a letter similar to the constants there..

Any sugestions?

Thanks.
Logged
Korin
Newbie
*
Offline Offline

Posts: 7


View Profile
« Reply #3 on: December 14, 2008, 03:09:35 PM »

Ahh and my Code:

public Loader() throws IOException{
      InputStream mp3 = new FileInputStream("c:\\test3.mp3");
      System.out.print(mp3.available());
      Resource res = new InputStreamResource(mp3, "application-x/binary", -1);      
      Sound s = new Sound(res);
      
      addSound(s);
      this.play(s);
      if (s.isPlaying()){
         Label l = new Label("I play");
         add(l);         
      }
   
   }
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #4 on: December 14, 2008, 06:03:09 PM »

Ah, sorry about that.  I hadn't correctly added support to the RPC layer for ID3Info objects.  Update and give it a try and it should be fixed.
Logged
Korin
Newbie
*
Offline Offline

Posts: 7


View Profile
« Reply #5 on: December 14, 2008, 06:06:13 PM »

Well ...that was fast Smiley I will give it a try tomorrow. Thanks.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.19 seconds with 20 queries.