Show Posts
|
|
Pages: [1] 2
|
|
2
|
Java Game APIs & Engines / Java Sound & OpenAL / Problem with the SourceDataLine object in MAC OS
|
on: 2008-07-11 11:22:32
|
|
Hello,
I have written a one program that uses the javax.sound.sampled.SourceDataLine object to play sound. I have tested that program on both MAC and Windows OS.
On windows OS the program works fine. On MAC OS, the program gives some strange behavior.
For example, If i have a SourceDataLine buffer of size 50000 bytes. In while loop i am calling available() method of the SourceDataLine. On windows platform, each call in loop give me some available bytes that i can write to buffer. Like 2000, 4000....etc.
But on MAC OS, i am not getting like that but instead SourceDataLine give me it when all buffer goes empty. I mean i am not getting like 2000,4000 ...etc. but all buffer size like 50000 at once.
The problem is that i am not able to write data to source data line when it has some small amount of buffer free. Due to this, i am feeling some sound smoothness problem on MAC OS. Sound stops few seconds in between.
Thanks In Advance
|
|
|
|
|
6
|
Java Game APIs & Engines / Java Sound & OpenAL / Re: Sound conversion problem using javax.sound......
|
on: 2008-05-22 14:06:29
|
|
Hello,
i got some success in changing the sound volume and balance by shifting the row bits. Here is the code snap shots
for(int Icount=0;Icount<size;Icount+=2){ int b = ((buffer[Icount+1] << 8 ) | (buffer[Icount] & 0xFF)) & 0xFFFF; if(Jcount%2==0){ b = (b * 0)>> 15; Jcount = 1; } else{ b = (b * 32768)>> 15; Jcount = 0; } if(b<0){ out.println(b); } buffer[Icount] = (byte) (b & 0xff); buffer[Icount+1] = (byte) ((b & 0xff00)>>8 ); }
This code is in loop where Icount start from 0....buffer.length...
The problem is that it generates some noise.
Can you help me for that?
Thanks and Regards
|
|
|
|
|
8
|
Java Game APIs & Engines / Java Sound & OpenAL / Re: Sound conversion problem using javax.sound......
|
on: 2008-05-21 05:49:51
|
Hello,  I now able to play the MP3 stream. Here the process what i have done to play that. I have downloaded the MP3 SPI suggested by you and registered it. Now, i am generating one WAV file using audio format and audio data sent by the server. I am creating a file that is in same format as windows WAV file format ( http://ccrma.stanford.edu/courses/422/projects/WaveFormat/). We can play that generated file using the javax.sound classes. Another process, if you have a audio data in the file and MP3 SPI registered, you can directly get AudioInputStream using AudioSystem.getAudioInputStream(InputStream stream) method. It automatically analyse the data and determine the format of that data. Thanks and Regards
|
|
|
|
|
11
|
Java Game APIs & Engines / Java Sound & OpenAL / Re: Sound conversion problem using javax.sound......
|
on: 2008-05-20 11:23:05
|
|
Hello,
Thanks for help...
I have another problem, how i can mix sound balance and volume?. In Java, there are some controls like float control using that i can change volume and balance of the SourceDataLine (javax.sound.sampled). But here i have different situation. I have more than one SourceDataLine opened and all are playing individual audio file (Streams). I have to changed volume and balance (Sterio sound) of only one stream. I mean balancing effect should come on only one stream, other stream should not get effect of balance and volume.
If i use Java float control then it would affect all playing streams/file.
Do you have any idea.....?
Thanks and Regards
|
|
|
|
|
12
|
Java Game APIs & Engines / Java Sound & OpenAL / Re: Sound conversion problem using javax.sound......
|
on: 2008-05-20 07:25:04
|
|
Hello erikd,
Thanks for suggestion.... Following is a audio format class which i am getting from the server. That represents the format of the data.
WaveFormatEX waveFormat = new WaveFormatEX(); waveFormat.wBitsPerSample = 16; waveFormat.nBlockAlign = 1; waveFormat.nAvgBytesPerSec = 2000; waveFormat.nSamplesPerSec = 11025; waveFormat.wFormatTag = 85; /// What is this ? waveFormat.nChannels = 1; waveFormat.cbSize = 12; // What is this ? waveFormat.exData = new byte[12];
Above is one of the data format i am getting. The sound is some how compressed. The original file is .wav but when i opened its property it shows Audio Format - MPEG LAYER - 3
Now from above information i want to create javax.sound.sampled.AudioFormat object.
Do you have any suggesting for that...?
Thanks and Regards
|
|
|
|
|
13
|
Java Game APIs & Engines / Java Sound & OpenAL / Re: Sound conversion problem using javax.sound......
|
on: 2008-05-19 07:09:24
|
|
Hello,
I have one application that originally written in to the C++, that application access the video data from our hand written server. That server work like RTP server. In abstract, server first sends the audio data format (It may be in any format like PCM OR compressed using any of the technique), then sends the audio data in given format. The client application convert that audio data in to PCM if it is not in that format and plays it.
Know we are converting the client application in to the Java, server application is same, not changed. Hence, we have to achieve same functionality in Java.
By default windows has in built API/Functions to convert a different sound format in to PCM format.
But, how i can do that in java.....?
Thanks and Regards
|
|
|
|
|
15
|
Java Game APIs & Engines / Java Sound & OpenAL / Sound conversion problem using javax.sound......
|
on: 2008-05-13 12:10:24
|
|
Hello,
I have a situation, i have data and source sound format. For example, if i wand to process .MP3 file then format of the data like bitRate, sample rate, channels etc. have in the one object (You can consider that object as like simple object containing getter/setter for all properties). And, all related data in another object/file (Like in byte array). I have both format and data separate not in same file like normal .MP3 file.
Know i want to convert that data in to PCM format so that i can play using the javax.sound..... package classes....
If any one have idea then its most welcome. Any help would be appreciated.....
Thanks In Advance
|
|
|
|
|
18
|
Java Game APIs & Engines / JOGL Development / Rendering problem while calling native methods
|
on: 2008-03-27 07:36:03
|
|
Hello,
I am calling native method from the Java Code to create one native Window and then initializing the OpenGL to render on the created window. I am able to create a window, OpenGL context, renderer context etc. OpenGL also clears the color but not render the line i have drawn. here is the code for the same...
JNIEXPORT void drawBox(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // Clear The Screen And The Depth Buffer
glColor4f(1,1,1,1);
glBegin(GL_LINE); // Drawing Using Triangles glVertex3f( 1.0f, 1.0f, 0.0f); // Top glVertex3f(500.0f,500.0f, 0.0f); // Bottom Left //glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right glEnd();
}
JNIEXPORT void init(void) {
/* Use depth buffering for hidden surface elimination. */ glEnable(GL_DEPTH_TEST); // Enables Depth Testing glDepthFunc(GL_LEQUAL);
glViewport(0,0,500,500); glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); glOrtho(0,500, 0,500, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity();
glClearColor(1,0,0,0);
}
JNIEXPORT int main(int argc, char **argv) { init(); while(true){ f_wglMakeCurrent(m_DeviceContext,m_RenderContext); drawBox(); SwapBuffers(m_DeviceContext); f_wglMakeCurrent(NULL,NULL); ::Sleep(2000);
}
return 0; }
Hilighted area with red color works properly.
Any help would be appreciated.......
Thanks In Advance.....
|
|
|
|
|
20
|
Java Game APIs & Engines / JOGL Development / zbuffering issue...
|
on: 2008-02-28 07:17:43
|
|
Hello,
I have created one animation. In animation, i see some weird effects in the animation. What happens is that when i play animation, objects are transfered back and front. Means, hidden objects come to front and front objects goes back...
Any help would be appreciated...
Thanks In Advance
|
|
|
|
|
24
|
Java Game APIs & Engines / JOGL Development / Animation display changes on each run...
|
on: 2007-11-20 10:32:16
|
|
Hello,
Recently, i have found new problem in my application. I am playing same animation each time although it does not give same output.
If i have a 400 x 400 GLCanvs then sometimes it display in 200 x 200 area while sometime in 400 x 400 area.
What could be a reason? Is it problem of Scale property etc...
Thanks In Advance
|
|
|
|
|
27
|
Java Game APIs & Engines / JOGL Development / Render anywhere using JOGL/OpenGL
|
on: 2007-10-16 08:52:03
|
|
Hello, I am doing some research to render a 3D character anywhere, i mean on desktop, On explorer screen etc. I does not want to use canvas, OR if i use it then, i do not want to show it to user. The user should feel that there is only character on Browser or desktop and nothing else.
Any help would be appreciated
Thanks and Regards
|
|
|
|
|
28
|
Java Game APIs & Engines / JOGL Development / Re: GUI blocks when calling method on GUI
|
on: 2007-10-16 06:00:57
|
|
Hello bleb,
I am using an animator class of JOGL. I think that one of the thread is normal awt thread and another one is a thread for animtor.
In stack trace "AWT-EventQueue-2" is showing method of my application and "AWT-EventQueue-1" (Second Stack Trace) is shoowing methods of system related activities.
I think "AWT-EventQueue-2" (First Stack Trace) is a thread for animator of JOGL.
Thanks and Regards
|
|
|
|
|
30
|
Java Game APIs & Engines / JOGL Development / Re: GUI blocks when calling method on GUI
|
on: 2007-10-15 08:28:01
|
|
Hello lhkbob,
Here, i am pasting a stack trace of delocked threads.
Deadlock found :- "AWT-EventQueue-2" Id=27 in BLOCKED Time =-1 on lock=java.awt.Component$AWTTreeLock@1f78040 owned by AWT-EventQueue-1 Id=12 at java.awt.Component.getGraphicsConfiguration(Component.java:815) at com.qedsoft.renderer.abstractfile.renderer.impl.CQ3DRendererOpenGL.makeCurrent(CQ3DRendererOpenGL.java:1341) at com.qedsoft.renderer.abstractfile.renderer.impl.CQ3DRendererOpenGL.beginRendererContext(CQ3DRendererOpenGL.java:1325) at com.qedsoft.q3dplayer.extended.impl.CQ3DPlayerExtended.beginRendererContext(CQ3DPlayerExtended.java:114) at com.qedsoft.realstreamlib.impl.CQ3DRealStream.beginRendererContext(CQ3DRealStream.java:1365) at com.qedsoft.realstreamlib.impl.QEDThreadPlayer.run(QEDThreadPlayer.java:30) at com.qedsoft.player.impl.CRealStreamPlayer.display(CRealStreamPlayer.java:111) at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78) at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:324) at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:194) at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:341) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199) at java.awt.EventQueue.dispatchEvent(EventQueue.java:461) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
"AWT-EventQueue-1" Id=12 in BLOCKED Time =-1 on lock=java.lang.Class@50988 owned by AWT-EventQueue-2 Id=27 at sun.java2d.loops.DrawGlyphListAA.DrawGlyphListAA(Native Method) at sun.java2d.pipe.AATextRenderer.drawGlyphList(AATextRenderer.java:36) at sun.java2d.pipe.GlyphListPipe.drawChars(GlyphListPipe.java:85) at sun.java2d.pipe.ValidatePipe.drawChars(ValidatePipe.java:160) at sun.java2d.SunGraphics2D.drawChars(SunGraphics2D.java:2720) at com.sun.java.swing.SwingUtilities2.drawChars(SwingUtilities2.java:609) at javax.swing.text.Utilities.drawTabbedText(Utilities.java:159) at javax.swing.text.Utilities.drawTabbedText(Utilities.java:89) at javax.swing.text.PlainView.drawUnselectedText(PlainView.java:137) at javax.swing.text.PlainView.drawElement(PlainView.java:96) at javax.swing.text.PlainView.drawLine(PlainView.java:65) at javax.swing.text.PlainView.paint(PlainView.java:288) at javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1338) at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:643) at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:781) at javax.swing.plaf.synth.SynthTextAreaUI.paint(SynthTextAreaUI.java:109) at javax.swing.plaf.synth.SynthTextAreaUI.update(SynthTextAreaUI.java:104) at javax.swing.JComponent.paintComponent(JComponent.java:743) at javax.swing.JComponent.paint(JComponent.java:1006) at javax.swing.JComponent.paintChildren(JComponent.java:843) at javax.swing.JComponent.paint(JComponent.java:1015) at javax.swing.JViewport.paint(JViewport.java:728) at javax.swing.JComponent.paintChildren(JComponent.java:843) at javax.swing.JComponent.paint(JComponent.java:1015) at javax.swing.JComponent.paintChildren(JComponent.java:843) at javax.swing.JComponent.paint(JComponent.java:1015) at javax.swing.JComponent.paintChildren(JComponent.java:843) at javax.swing.JComponent.paint(JComponent.java:1015) at javax.swing.JLayeredPane.paint(JLayeredPane.java:559) at javax.swing.JComponent.paintChildren(JComponent.java:843) at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4979) at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4925) at javax.swing.JComponent.paint(JComponent.java:996) at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21) at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60) at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97) at java.awt.Container.paint(Container.java:1709) at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248) at sun.awt.X11.XRepaintArea.paintComponent(XRepaintArea.java:56) at sun.awt.RepaintArea.paint(RepaintArea.java:224) at sun.awt.X11.XComponentPeer.handleEvent(XComponentPeer.java:645) at java.awt.Component.dispatchEventImpl(Component.java:4044) at java.awt.Container.dispatchEventImpl(Container.java:2024) at java.awt.Window.dispatchEventImpl(Window.java:1778) at java.awt.Component.dispatchEvent(Component.java:3803) at java.awt.EventQueue.dispatchEvent(EventQueue.java:463) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Please let me know if you could find any reason for dead lock. Deadlock comes only when i switch between any window or minimize and maximize it. I think that it occurs when any GUI event occurs.
Thanks and Regards
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|