0
0

Hi all,

I’m just starting with this thing, but already found my limits :(

My problem is easy:

Similar to the Recordtodisc-Sample (actually I just modified it) I want to lock within the timer_tick the sound, but won’t write it to the disc.
Instead I would like to play it at once. So in the end I would hear (with a little bit of latency) "live" what Im’ saying into my micro through my speakers.

My code (which is C#, but isn’t working):

Lock the sound to get access to the raw data.
                */
                sound.@lock(lastrecordpos * 4, (uint)blocklength * 4, ref ptr1, ref ptr2, ref len1, ref len2); /* *4 = stereo 16bit.  1 sample = 4 bytes. */

                /*
                    Write it to disk.
                */
                if (ptr1 != IntPtr.Zero && len1 > 0)
                {
                    byte[] buf = new byte[len1];

                    Marshal.Copy(ptr1, buf, 0, (int)len1);

                    datalength += (int)len1;

                         result = sound.setMode(FMOD.MODE.LOOP_OFF);

                         ERRCHECK(result);

                         result = system.playSound(FMOD.CHANNELINDEX.FREE, sound, false, ref channel);
                         ERRCHECK(result);

Perhaps you could give me a sample on how I would manage to Playback the bit I recoreded between the time_ticks.
Btw, I manage to playback the recorded sound afterwards the record-buffer is dilled (like 10 Seconds), but I don’t manage to playback it live.

Any help is very welcome!

Thank you!
Chris.

  • You must to post comments
0
0

Hmm, what I would like to know more exactly is, how I can PLAY the byte[] instead of writing it to disc, so:

fs.Write(buf, 0, (int)len1); –> This is the routine for writing this snappet to a filestream.

I would like, instead of writing this to filestream, to play it via playsound.

Is this possible ?

Greetings,
Chris.

  • You must to post comments
0
0

Yah, tx Brett, I understood that.
But i’m one step further already again and now I do not want to playback my micro-input, but playback the byte[] buffer I receive from a socket-stream. And that for I would need to know, how i can play a byte[] object as it’s arriving – i do NOT mean a classical ripping from some online source, but sound-data by micro transferred via tcp sockets.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.