« first day (1598 days earlier)      last day (1255 days later) » 

6:41 AM
@nwp That's possible in ANTLR3 and below I think. ANTLR4 has removed direct AST generation feature.
 
 
3 hours later…
user12698128
9:38 AM
hello, if I am not mistaken, here are very good game developers and maybe you can give me a tip. I wrote a program that uses XSound2. At the start of the program a certain number of wav files are preloaded and they last 1 second each. When I press a key on the keyboard, I call a function and send the buffer containing the wav to XSound.
Example:
I press the A key
MyFunction (bufffer [0]);
I press the S key
MyFunction (bufffer [1]);
I press the D key
MyFunction (bufffer [2]);
The problem is that if I keep a key pressed continuously the reproduced sound is not continuous because I keep callin
 
nwp
11:16 AM
@mark_c There is a gamedev room, but that doesn't seem like a gamedev issue. The solution is to remember which sound you are playing and to not restart the sound if the sound is already playing. Also you might want to have a transition effect between sounds to avoid clicking noises.
 
user12698128
11:39 AM
thanks @nwp, I'm actually writing software for musicians and it seemed to me that mine was a similar problem to game developers, it was just my idea. Maybe I understand your idea, but my sounds have a duration of 1 second and if I hold down a key for 5 seconds and call up the function 5 times, in addition to the click, you can also hear a small gap between one call and another.
 
nwp
11:58 AM
You need to fill the buffer before it runs out, not after. Maybe if the button is pressed and there are only x ms left to play on the old sound it attaches another 1 second of sound behind it. x should be barely big enough that the gap is gone.
 
user12698128
12:11 PM
@nwp
I propose this pseudo code to understand better. Here's what I do.


// start program
int loadwav()
{
//load wav files (0,1,2, ....) into buffers
buffer[0]......;
buffer[1]......;
buffer[2]......;
}

int keypressed()
{
if('A')
MyFunct(buffer[0]);
if('S')
MyFunct(buffer[1]);
if('D')
MyFunct(buffer[1]);
}

void MyFunct(char *buffer)
{
// initialization code
//..............
//..............

XAUDIO2_BUFFER buffer = {0};

buffer.pAudioData = (unsigned char *)buffer;
buffer.AudioBytes = MyBufferLength;
 
nwp
1:34 PM
@mark_c One thing you can do is to append the data to the previous buffer and increase the length if you're allowed to do that. Alternatively check if there is some sort of "After you're done playing continue playing this buffer"-function.
 
user12698128
2:10 PM
sorry, XAudio2 not XSound2
 

« first day (1598 days earlier)      last day (1255 days later) »