Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (734)
Games in Android Showcase (223)
games submitted by our members
Games in WIP (811)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 ... 52
1  Game Development / Newbie & Debugging Questions / Re: Polygons are not moving... on: 2017-08-22 15:35:32
If you want to give JavaFX a try, JGO has a tutorial that will take you through the basics. There are a couple gotcha's, like the fact that there was an earlier version that was discarded, and some of those tutorials are still floating around, confusing people. Once you see the basic setup in action, it is pretty straightforward to learn and use.

http://www.java-gaming.org/topics/getting-started-with-javafx-game-programming-for-java-programmers/37201/view.html
2  Game Development / Newbie & Debugging Questions / Re: Polygons are not moving... on: 2017-08-22 02:01:39
I think you have to add to each vertices' point data. In other words, each point in the x[] has to have the amount added to it for a horizontal movement.

Sometimes it makes sense to make a wrapper class that has the location that you can just give the X and Y movement amounts in a "normal" fashion, and have this class call the methods needed to handle updating the polygon point arrays.

(Reminding me why I'm glad I switched to JavaFX.)
(Been a while since I fussed with polygons--I hope I'm not totally off base.)
3  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-08-18 18:29:25
Congratulations ra4king!

This week I settled on trying to polish the FM Theremin I wrote a while back, to get it up to a quality where I might post it on itch.io. So far, have made improvements to the GUI, including making panels resizable (giving more "playing" room when the control panel is not needed), and an easier-understand checkbox for whether the "expression" attribute controlled by a slider is a fixed value (independent of Y-axis location) or ranges with the mouse Y position.

I've been slowed down a bit with implementing a decision to eliminate Nyquist aliasing. Am working out a way to automatically scale back the amplitude of the modulator (source of overtones in FM) that takes into consideration the frequency and the degree of modulator feedback. Had to spend time manually listening and charting the frequencies where aliasing kicks in for various modulator Index and Feedback settings, and then on working out good equations/algorithms to fit the data points. It is close to working--last attempt covers the endpoints well but "sags" in the middle. I suspect fixing it is a matter of changing the point at which I reference the data which can be either linear or exponential depending on the stage of the calculation. (E.g., midi notes, piano notes are linear, but the Hz value doubles every 12 steps--do we calculate using the Hz or the midi values?)

Am reminded how important it is as a programmer to learn math for sequences, series and curve-fitting polynomials, as having this handier in memory would have made this much easier to do.
4  Game Development / Newbie & Debugging Questions / Re: prevent a clip get closed on: 2017-08-11 22:37:34
Your first play method is opening a new Clip every time you want to play a sound, even if it's the same file?  You're also never closing the Clips after playback.  Basically, this code is all wrong, and you'll eventually run out of resources on any platform, just much quicker on the Pi.

When I saw that the start method call that is at the end of the play method in the code was commented out, I forgot that there was still a start method call embedded in with the load and open sections. So nsigma is right and I blew it by saying "the code looks fine." Combining a Clip load, open and start in one code block is likely always the wrong way to do things.

If you only need 8 different sounds, load and open each and hold them as ready to go as instance variables or something. Then you can use the start() method call on an as-needed basis and the sound will play with a minimum of latency.

A clip does not close when it reaches the end of a playback. You can take that same clip, and replay it by setting the framePosition to 0 and then calling start again.

Garbage collection for Line (Clip extends Line) is different than other classes. "Resources" obtained by the line need to be closed before the instance is garbage-collected. If you are done with a Clip, it is important to close it. Stopping and Closing are not the same!

The Sound Tutorial that Oracle provides is not very clear at all on demonstrating simple use cases. Lots of people get messed up and discouraged trying to make sound work as a result.
5  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-08-10 23:53:05
I finally reconnected to the git project SiVi, yesterday. Haven't done an update since 2014! Today, was playing around with "fixing" a couple things--wanted to have the channel outputs and master on the mixer display numbers that were easier to use/more informative. While changing that (have yet to upload changes back to the project), I took a little time to play with the "gif making" tool. This one is about 44MB.
Click to Play


Also, played a bit with Glitch and A-Frame, and loaded SiVi-generated png graphics to see if they would work as textures:


I'm hiding the border lines (rotated away). I *think* I can use a variant of the algorithm similar to what is being used to "wrap" the gifs into smooth loops to make the edges of the texture graphics meet up smoothly. Looking forward to having time to test that out.
6  Game Development / Newbie & Debugging Questions / Re: prevent a clip get closed on: 2017-08-10 23:20:54
Thanks for the ping!

The code looks fine, so I'm guessing you ran into the 8-output-line limit on PI. You might try closing any sound that is not being used. (Close both the AudioInputStream and the Clip.)

TinySound is a good solution. This library mixes all sounds into a single output line.

The code I wrote is called AudioCue. It has a smaller footprint than TinySound, and you can do some extra things, like real-time pitch variation, volume fading and panning. You'll probably only be able to load 8 AudioCues at one time, but the way the class is made, you can play as many instances of those sounds (with pitch variations) as your cpu can handle. In other words, 5 gunshot bullets made and heard at the same time 9rapid succession) will only count as a single output.

I'm working on (and off) on figuring out how to create an option for mixing AudioCue's together, letting them share an output line. It is a little tricky. I could hack something out in a day, but I'm trying to get the API to make sense rather than have it be kind of cloojy. Juggling a lot of things at the moment and might not figure it out for a while.
7  Game Development / Shared Code / Re: Mp3 Player with Jlayer on: 2017-08-08 17:22:49
Is it okay to put a related wish-list item here?

I'd like to see OGG and MP3 decoders that give us the decompressed file back and let us handle the SourceDataLine for the final playback step. By doing just one less thing, it would allow us to get at the data for all sorts of effects, including varying the speed of playback or echo/chorus/distortion/filtering.
8  Discussions / Miscellaneous Topics / Good Game Patterns book: Game programming Patterns, Robert Nystrom on: 2017-08-04 05:36:07
Every now and then I come across a book that I makes me want to stop programming and read it as fast as possible because there is so much to learn and incorporate.

http://gameprogrammingpatterns.com

Game Programming Patterns by Robert Nystrom

Examples are in C++, not Java, unfortunately. But otherwise this book is really promising, so far. I've read up through FlyWeight on my first sitting. I came across it via a reference to the Component chapter of the Decoupling section earlier in the day -- something quite relevant to the AFrame/JavaScript stuff I'm learning/cramming.

Part of why I like it: for every recommendation there is also an acknowledgement of the downsides. No panaceas or cure-alls. It's balanced. (Though, he does seem to have a significant antipathy to Singleton.)

Maybe I shouldn't recommend something until I've read more. But I am wondering if others have seen it or read it.

[EDIT: another oops for me. Should have done a search first. This post is a duplicate of yet another. Lots of good comments in the original discussion.]
9  Game Development / Game Mechanics / Re: SimpleXnoise Translation. on: 2017-08-03 23:58:41
By the way, I never tested that particular noise generation algorithm, and it might be breaking down for certain input values.

If I understand it correctly, it is designed to always produce the same relationship between the overlays, where each higher (faster varying) octave has half the weight of the previous.

I think it is useful to specify scalings and weights to individual overlays of the noise, and to use as few overlays as necessary to make the desired effect, as each "octave" adds significantly to cpu expense. For example, a graphic with "octaves" of 1, 2, 4, 8 might also work with "octaves" of 1, 3, 8, costing 25% less.
10  Game Development / Game Mechanics / Re: SimpleXnoise Translation. on: 2017-08-03 23:33:09
First off, I apologize for not reading your question more closely. I didn't notice that you want the chunks to be contiguous. I also didn't notice that you had consulted SiVi!  Roll Eyes  I need to slow down.

Maybe get rid of the roughness calculation? Or make roughness = 1. I think this is complicating things in an unhelpful way.

So, your first solution was correct.
 
1  
totalNoise[x][y] += (float) SimplexNoise.noise((x + xTrans) * layerFrequency,(y + yTrans) * layerFrequency) * layerWeight;


When calling the generatedOctavedSimplexNoise function, the xTrans argument should equal a multiple of width, and yTrans should equal a multiple of height. The multiple would correspond to the number of chunks distance from the original chunk where xTrans and yTrans are both 0.

What does it mean when you say the chunks are "empty"? Are they drawing black? white? Is there literally no data in the returned array? Is it all 0? Is there data > 1 or < -1?


11  Game Development / Game Mechanics / Re: Loading audio in LWJGL2 with OpenAL? on: 2017-08-03 19:05:14
I don't have the time to watch videos right now. Can you post something closer to a simple example of the problem?

Sometimes, when trying to figure out where the default file locations are, I make a file and use .createNewFile(), then do a search with File Explorer or the equivalent on Mac.



12  Game Development / Game Mechanics / Re: SimpleXnoise Translation. on: 2017-08-03 18:31:01
[EDIT: Basically this post was quite off base, so the simplest thing is to just delete it.]


13  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-08-02 16:42:10
The last couple of days, I've mostly been doing non-Java stuff: I worked through the A-Frame School tutorial for web VR/AR. It looks like I might get a chance (paid) to write code for a gallery of 360-degree photos that allows a virtual tour of a local battleship. Will learn more about that gig on Thursday. Meanwhile, will continue brushing up on JavaScript and work through more of the "Guides" provided at the site.

A-Frame reminds me a lot more of how JavaFX works than Swing, that's for sure. I'm glad I took time to get more acquainted with JavaFX.

If the contract is landed, I will stop accepting Java tutorial students through the online tutorial service I signed up with. Turns out it is possible to teach online and make a bit of side money. The competition is kind of steep though, as there are hotshots from all over also teaching. (One profile I saw: EE/CS "Cum Laude" graduate from Duke. And here I am with a Music Bachelors.) But they can't all teach at the same time, and student requests sometimes come in clumps. So I've managed to accumulate about 25 hours of work over the last 6 weeks. Every little bit helps. (All my ratings have been 5-stars, so that helps!)

I can't recall if I posted about finding a book "Digital Audio with Java" (Lindley) from 2000, at Half-Price Books. Over half the book is devoted to creating graphical interfaces PRE-Swing! But the algorithms that handle the actual processing are decent, and good starting points for rewrites. I made a Schroeder reverb a few weeks ago. The Lindley book references a truly standout book for learning about digital audio: Charles Dodge's "Computer Music, Synthesis, Composition, and Performance" from 1997. This book does the best job of any that I've seen of teaching about digital audio.

Having the Schroeder reverb (similar to the Freeberb implemented by @nsigma, but configured slightly differently) has me working a bit (on and off) once again on real-time mixing of music from live synths and samples. This reverb is decent sounding if you don't push it, but definitely has weaknesses for things like snare hits (can get a little "metallic") or when mixed high (one can hear ringing). I'm reading elsewhere about a later development with another layer of feedback (term for it escapes me at the moment) that should be codeable when the time comes.
14  Game Development / Newbie & Debugging Questions / Re: javafx canvas like swing on: 2017-07-28 04:19:05
I'm not sure I understand the question.

With JavaFX games, usually the best choice is to have an AnimationTimer class handle the update and render. Except, many render steps needed in Swing occur behind the scenes with JavaFX. You just change properties of the objects that have been loaded to the root group node.
15  Discussions / General Discussions / RuneScape going mobil on: 2017-07-19 19:06:35
RuneScape_is_going_multiplatform_as_a_mobile_MMORPG

Any word on the tech they are using? The original RuneScape was Java-based.
16  Game Development / Newbie & Debugging Questions / Re: JavaFX Resizing Undecorated Window on: 2017-07-18 21:27:08
It seems like the error has a 2:1 relationship of some sort (width and height are changed half as much as the mouse is moved).

Is there some sort of scaling going on for the display of either the resizeButton or the editorWindow?

dx and dy are constant during the mouse drag, yes?
17  Game Development / Game Play & Game Design / Re: Patchy/Non-Smooth Perlin Noise? on: 2017-07-06 04:27:21
I can't tell if the functions you have are generating gradient noise or not. You are over my head, in terms of writing your own implementation. I've always used the Gustafson implementation. We also have an implementation available on JGO, which should be searchable or in the wiki area.

I have some suggestions, just based on what I am seeing.

It seems to me you might be doing some sort of "clamping" to the data, to keep it within bounds. Yes, I see it on line 73-78.

I think you will get a more rounded look if the values that you generate are set up so that they never need clamping. Whenever you clamp, you are going to get plateau effects.

Secondly, the target image looks very much to me like something generated with a single octave of Perlin Simplex noise. You are using six octaves of whatever it is you have implemented, as far as I can tell. The higher octaves are going to add a lot of business and jitter to the images.
18  Game Development / Game Play & Game Design / Re: Patchy/Non-Smooth Perlin Noise? on: 2017-07-05 02:32:20
There are a number of ways the problem could be coming up. Can you tell us more about what Perlin function you are using and what parameters you are giving this function?

The target diagram looks to me like a single octave using the "smooth" scaling algorithm. Perlin functions usually return values from -1 to 1. This output has to be turned into a color or greyscale value. Color functions take values that range from 0 to 1 (or 0 to 255 if ints). Perlin called the following scaling "smooth" noise:

1  
2  
3  
4  
5  
6  
7  
8  
    // I am making up the Perlin functions here, to get a value (ranges from -1 to 1) 
    pValue = PerlinFunction.getNoise(x, y);

    // "smooth" scaling (obtaining resulting range of 0..1)
    colorValue = (pVal + 1) / 2;

    // use color value as argument to color -- if using 0 to 255, then multiple colorValue by 255 first
    pixelColor = new Color(colorValue, colorValue, colorValue);


He also calls a function that uses an ABS value "turbulent" noise:
1  
2  
3  
4  
5  
    // I am making up the Perlin functions here, to get a value (ranges from -1 to 1) 
    pValue = PerlinFunction.getNoise(x, y);

    // "smooth" scaling
    colorValue = Math.abs(pVal);

19  Java Game APIs & Engines / Java Sound & OpenAL / Re: AudioCue, an alternative to Clip, for 2D games on: 2017-07-04 20:58:23
Having a master single output at the static level might eliminate the need for some dynamism for polyphony or buffer size at the cue level (one can add/remove additional cues to achieve this rather than change the buffer or polyphony of individual AudioCues), but having a master also reduces some flexibility in that everything will have to use the same buffer size. I'll have to do some thinking and testing. Unclear if I can make this work if different cues use different buffers (or if even having different buffers is relevant to the situation).

The major OS implementations, I think, are able to handle multiple outputs pretty efficiently. There are some Linux systems, and Raspberry PI that have limits that cause problems. One can manage a large bank of AudioCues and just be sure that a maximum of 8 are open at once (for Raspberry) via the open and close methods. For a system that only has one output line allowed (not many of them around any more, AFAIK), something like TinySound does become mandatory.
20  Java Game APIs & Engines / Java Sound & OpenAL / Re: AudioCue, an alternative to Clip, for 2D games on: 2017-07-04 19:32:44
I would again highly recommend this to anybody who wants a better alternative to TinySound.

If this isn't mixing down to a single line, it's not a better alternative to TinySound!  @philfrei how easy in your architecture would it be for you support that?

I agree that 'better' is not exactly accurate. There are tradeoffs. AudioCue reduces the number of output lines required (compared to making a unique Clip for each concurrent instance), but there are still many output lines being run at once.

Actually, it would be fairly straightforward to make a static master loop which iterates through all AudioCue's and their individual instances. As I mentioned in an earlier post, handling requests to add/remove additional AudioCue's could occur at the head of the master mixer run method's outer loop.

One aspect which I do NOT know the answer to: how are multiple output lines being handled by the Java implementation that merges SourceDataLines? It could be that what is underlying is already quite efficient. If that is the case, implementing this would be redundant except for situations where there are a limited number of lines allowed, for example, with Raspberry PI (I think FabulousFellini mentioned running across a limit of 8 audio lines in that case.)
21  Java Game APIs & Engines / Java Sound & OpenAL / Re: AudioCue, an alternative to Clip, for 2D games on: 2017-07-04 19:19:47
I will ponder this.

There is hardly any cost at all to having a high polyphony when few instances are running. (Only cursor/pointer objects are generated per instance--and they are very small, and only require processing when they are actually running.)

So for most situations, it should be okay to configure a highest-use-case scenario and use that throughout. The main thing is to figure out how big the buffer has to be to play the maximum polyphony and not have dropouts, and then see if the latency that goes with that buffer is acceptable for the lower use cases. If that works, you should be good to go.

One way to code this to be more dynamic would be to allow change requests to the buffer size or the polyphony to be processed at the start of the outer loop of the AudioCuePlayer.run method. When done this way, the granularity of changes would be limited to once per buffer iteration.
22  Java Game APIs & Engines / Java Sound & OpenAL / Re: AudioCue, an alternative to Clip, for 2D games on: 2017-07-04 03:14:09
Are you planning to post a copy on JGO? I'm really curious! Showcase it or put on WIP if it is not done yet.

Also, I want to have a page at my home site that lists games that use AudioCue. Please let me know if yours is ever being made available (commercial or free, either way).

Thanks for giving it a try and posting the positive feedback!
 Cool
23  Java Game APIs & Engines / Java Sound & OpenAL / Re: AudioCue, an alternative to Clip, for 2D games on: 2017-07-04 02:58:22
@cygnus - Cool! Let me know if you have any questions or if I can help in any way.
24  Discussions / Miscellaneous Topics / Re: Passion Projects and Life: Spreading Yourself Too Thin? on: 2017-07-01 02:44:06
I think the single biggest reason for my not having done better in terms of career has been how long it has taken to learn how to successfully say "no". I'm still not great at it, but I think I'm a little better than I was. Maybe.

For example, in the 1980's I had a game programming job. Worked there 2.5 years. It was a sleep-under-the-desk environment, we worked around the clock, lots of deadline pressure. Most of us who left that job left because we burned out. Some of us stayed burned out longer than others. It took me about 10 years before tiptoeing back and  learning how to do some application-level database work (Paradox, then MS Access), and another 10 after that to allow my interest in game programming to reassert itself and take up Java.

Saying "no" is complicated (though it is also possible to go full warrior and crush all enemies regardless of consequences). There are other people's feelings and needs. There's financial issues. There's learning about how to find win-wins and figure out diplomatic ways to let people know that you are not rejecting them personally when you set aside some time for yourself. There's also learning how to tell if the fear or hurt another person shows you when you say "no" is something that you genuinely need to take care of or not. Sometimes it isn't.
25  Java Game APIs & Engines / Java Sound & OpenAL / AudioCue, an alternative to Clip, for 2D games on: 2017-06-29 23:00:20
Source code, demo code, API link, and more description for AudioCue can be found here: AudioCue

AudioCue was written for Java 2D game programmers. Its purpose is to make it easier to create soundscapes and to handle common sound needs/desires that arise in 2D games. The code consists of one largish class: AudioCue, and a supporting class and interface, both of which are used to support line listening. The classes are provided verbatim and can be pretty much dropped into your project. All the code is core Java--no external libraries are used. The code is free and carries a BSD license.

For 2D game programmers, the main option for sound effects has been to use the core Java Clip. Clip has some distinct limitations:

I. Does not support concurrent playback
A Clip cannot be played concurrently with itself. The are two basic options if, for example, you want to have a rapid fire "bang bang bang" where a new shot is triggered before the sound effect has finished playing:
1) stop the cue midway and move the "play head" back to the beginning and restart the cue;
2) create and manage many Clips of the same sound.

With AudioCue, it remains possible to start, reposition, and stop the "play head" just as you can with a Clip, but you can also fire-and-forget the cue as often as you like (up to a configured maximum) and the playing instances will all be mixed down to a single output line.

II. Spotty real-time volume fading
A Clip requires the use of a Control class for managing volume changes. The availability of these classes is somewhat machine dependent. Also, the changes only take affect between buffer loop iterations, leading to problems with discontinuity-generated clicks when the setting is asked to vary too quickly.

With AudioCue, there is no reliance on machine-specific Control lines. The changes are processed internally, on a per-sample-frame basis. The change requests are received asynchronously via a setter that lies outside the audio processing loop, and can take affect at any point during the buffer loop iteration. Also, a smoothing algorithm eliminates discontinuities by spreading out change requests over individual sample frames. The result is a fast, responsive, and smooth volume fade.

As a bonus, the same mechanism is used for real-time panning and pitch changes! (See the SlidersTest.jar below for an example.)

FROG POND (soundscape example)
The following jar is an example of a soundscape: frogpond.jar.
You can also hear what this jar does by listening to this wav file: frogpond.wav.

The jar generates a background audio that suggests many frogs croaking in a nearby pond. It runs for 15 seconds. Very little code, and a single asset, is all that is required to create a fairly complex, and ever-varying sound effect.

The jar includes source. Here is the most revelant code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
    URL url = this.getClass().getResource("res/frog.wav");  // 1
    AudioCue cue = AudioCue.makeStereoCue(url, 4);          // 2
    cue.open();                                             // 3  
    Thread.sleep(100);                                      // 4
   
    // Play for 15 seconds.
    long futureStop = System.currentTimeMillis() + 15_000;
   
    while (System.currentTimeMillis() < futureStop)
    {
        cue.play(0.3 + (Math.random() * 0.5),              // 5
            1 - Math.random() * 2,                         // 6
            1.02 - Math.random() * 0.08,                   // 7
            0);                                            // 8
        Thread.sleep((int)(Math.random() * 750) + 50);     // 9
    }
   
    Thread.sleep(1000);
    cue.close();                                           // 10


1) You assign a resource in the same way as is done with a Clip or SourceDataLine. Only URL's are supported, though, as they can identify files packed within jars, unlike the File object.

2) A static "make" method is used, rather than a constructor. This was based on suggestions coming from Joshua Bloch in an article he wrote about API's (and a desire to make it easy to add, down the road, an additional method for a mono, delay-based panned sound effect). The number "4" in the argument, here, is the maximum number of instances that can be played at one time.

3) This code opens an underlying SourceDataLine for output, and starts sending blank audio. It is possible to change the size of the buffer, to select a specific Mixer output, or specify the thread priority at this stage by using a more complex form of the method:
1  
2  
    void open(javax.sound.sampled.Mixer mixer,
            int bufferFrames, int threadPriority)

A larger buffer size may be needed as higher numbers of concurrent instances are allowed, in order to prevent drop outs. But a larger buffer can also impact latency. Making this a configurable parameter allows you to balance these needs.

4) I'm not clear if this pause is truly needed, or how much of a pause. I mostly wanted to ensure that the open method has a chance to complete before executing play commands. [TODO: a detail to figure out]

5) Here we set the volume parameter. Permitted range (clamped by AudioCue) is from 0 to 1. For soundscape purposes, the different volumes suggest different distances from the listener to the virtual frog that emits a given croak.

6) Setting the panning. Permitted range (also clamped) is from -1 (100% left) to 1 (100% right) using a volume-based algorithm. Actually, there are currently three different volume based algorithms available--best to consult the API about their specifics and how to select one.

7) Setting the pitch. A slight amount of speed up or slow down of the playback rate helps give the impression that these are many different frogs, some larger, some smaller. The setting is used as a factor. The setting 0.5, for example, halves the playback speed, and 2 doubles it. The permitted values range from 0.125 to 8.

Cool This is the loop parameter. Since we only want each croak to play only once and end, we leave it set to zero.

9) A random time interval is generated to space out the occurrence of the croaks.

10) The close method releases the underlying SourceDataLine.

REAL-TIME FADING (example program)
The following jar holds a demonstration of real-time fading: SlidersTest.jar

In this program, three instances from a single AudioCue can be sounded at the same time, and sliders affect pitch, volume and panning for each individual instance, in real time. The bottom has a button that plays the same wav file as a Clip, for comparison. I invite you to compare clarity and latency.



In the source code, you will be able to see how the three instances are managed via int handles.

*******************

A couple considerations I should not omit:

One way in which Clip is superior to AudioCue is that it can handle a broad range of audio formats. AudioCue has only had the standard "CD Quality" format enabled.

Why didn't I support more formats?

A couple of reasons. One is that I have yet to figure out a way to implement this that doesn't impact the latency or add to processing demands or create considerable additional coding complexity. Another is that it is a straightforward task to use a tool such as Audacity to convert audio files to this format.

As for supporting compression, I didn't want to involve any external libraries. But for those who do use compression, there is this path. When decompressing your asset, bring it to a state where the data is organized as stereo floats with values ranging from -1 to 1. This is a common form for PCM data. AudioCue can use a float array as a parameter in place of a URL.

I do not know if the libraries that decompress audio assets allow the option of leaving the data as a PCM floats array. AFAIK, Jorbis (Ogg/vorbis compression) converts audio bytes into PCM floats prior to the compression step. For my own purposes, I made a small modification to the source provided for Jorbis (Ogg/Vorbis compression) to intercept the generated buffer of decompressed floats before they are converted back to bytes and output via a SourceDataLine. There may already be a class or method that accomplishes this that is publically available.  

I should point out there is another good option for makers of 2D games: the TinySound library. I haven't taken the time to work out the comparisons. AudioCue is more about the capabilities of individual cues, TinySound mixes all cues down to a single output line, is easy to use, and there are lots of features like support for Ogg/Vorbis and concurrent playback. Definitely worth checking out as an option.

*****

This code is to a large extent a way I hope to give back to Java-gaming.org, for all the help this community has provided me over the years! I hope it proves useful, especially for new game programmers trying out Java.

I'll do my best to answer questions and make corrections to the code, when the many typos and questionable design and coding choices are pointed out.
26  Discussions / Business and Project Management Discussions / Re: Licensing overwhelm, asking for advice on: 2017-06-29 15:31:44
This code does not aim so high as to be an audio engine or anything like that.
It's just another version of Clip, maybe a little easier to use (except for limited audio formats), and a little easier to make soundscapes with than Clip.
Aimed for people trying to stay within core Java.
27  Discussions / Business and Project Management Discussions / Re: Licensing overwhelm, asking for advice on: 2017-06-29 05:37:43
Ok. I have it all posted, using BSD. All the links seem to work.
Will sleep on it, and post on the audio thread tomorrow.
There was a shit-ton of documentation and proofing.
Probably all sorts of dubious choices made.
It is going to go up anyway.

28  Discussions / Business and Project Management Discussions / Re: Licensing overwhelm, asking for advice on: 2017-06-27 21:19:40
Thanks for the really interesting links and discussion, @Catharsis!

It has me on the fence again, though. The suggestion of putting a more restrictive license (after making the initial version BSD-type) on a later version is plausible. I am seriously wanting to add cross-fading to loop ends when looping, as well as a random-macro-granule-streaming option. This could be the higher value version.

Here is a thought: Suppose I just retain the copyright for now, but let folks on Java-Gaming.org know that I will grant permission to members to try it out and to use it on a given game. All they have to do is ask me, via PM.

Maybe this is a little overly cautious or control-freaky. But this would perhaps let us know if the code is even worth worrying about, if there is even a problem it solves that matters to Java game makers. (For anyone using LWJGL-derived or JOGL, it won't be relevant.)

I will make some effort today towards getting a jar posted that can be tried out, and will post it on the Audio thread when I have it set up.
29  Discussions / Business and Project Management Discussions / Re: Licensing overwhelm, asking for advice on: 2017-06-26 15:04:07
Having three solid endorsements--takes a big load off of my mind.
Thanks!
30  Discussions / Business and Project Management Discussions / Re: Licensing overwhelm, asking for advice on: 2017-06-26 06:03:29
Interesting option. I was kind of shocked to see the following listed as one of the three clauses in the BSD-3-Clause

Quote
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

Do people do that sort of thing?
Is it legal to do that? I mean, maybe the clause isn't needed if it is illegal for someone to say you endorse something without your permission.
Jeez.

The main thing I'm hoping is that some game programmers find the code useful, using it as a kind of souped-up Clip class. But I'd like some credit as the developer and certainly don't want to find myself in any sort of situation where I am prevented from using my own code.
Pages: [1] 2 3 ... 52
 
cybrmynd (45 views)
2017-08-02 12:28:51

cybrmynd (60 views)
2017-08-02 12:19:43

cybrmynd (68 views)
2017-08-02 12:18:09

Sralse (83 views)
2017-07-25 17:13:48

Archive (511 views)
2017-04-27 17:45:51

buddyBro (653 views)
2017-04-05 03:38:00

CopyableCougar4 (1143 views)
2017-03-24 15:39:42

theagentd (1147 views)
2017-03-24 15:32:08

Rule (1118 views)
2017-03-19 12:43:22

Rule (1093 views)
2017-03-19 12:42:17
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
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!