.RecordFor( to memory stream

Last post 09-08-2006 7:34 by Anonymous. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 09-07-2004 0:40

    .RecordFor( to memory stream

    Hi,

    I am developing a voice-over-IP application, using OpenNETCF recording. There are no problems when I record to a filestream, but for some reason something stuffs up when I record to a memory stream. I try to get access to the data stored in the memory by using a binary reader, which works great with a filestream. Has anyone ever done this? Code is as follows:

    MemoryStream mem = new MemoryStream();
    m_Recorder = new OpenNETCF.Multimedia.Audio.Recorder();
    m_Recorder.RecordFor(mem, 2, SoundFormats.Mono8bit11kHz);
    // so far so good! The data is stored in memory

    BinaryReader b = new BinaryReader(mem) ;
    // this gives an argument exception error, but works fine with a filestream

    Any obvious mistakes here?

    A.
  • 10-26-2004 11:12 In reply to

    Re: .RecordFor( to memory stream

    I have the same problem. When I use a MemoryStream, I get an exception ObjectDisposed when ever I try to access the stream. But it works fine for FileStreams.
  • 10-28-2004 10:06 In reply to

    Re: .RecordFor( to memory stream

    Ok, one possible solution is to stop the OpenNetCF library from closing the stream. This requires rebuilding the OpenNETCF namespace.

    I changed the followign code.

    line 366 in Recorder.cs:


    m_streamRecord.Close();


    to:


    if(!(m_streamRecord is MemoryStream))
    m_streamRecord.Close();


    Not sure if this has any other adverse effects. It works well for me. Hope this helps.

  • 10-30-2004 21:19 In reply to

    Re: .RecordFor( to memory stream

    Great stuff, you might have made my day! I've changed the code as you suggested but when I include the "new" OpenNETCF DLL it tells me the following:

    An unhandled exception of type 'System.MissingMethodException' occurred in Unknown Module

    (This is when my own application is about to run after successfully being compiled and built).

    There is something strange here too.. the .DLL-file installed in the Program Files/MS.NET etc../OpenNETCF.dll file is 287kb, while the one in the source code directory under Program Files/OpenNETCF/Smartdevice Framework/Source/OpenNETCF/bin/debug is 308kb. Seems like the source code file is bigger than the one installed in the Compact Framework "library" directory.. I watched and made sure no files were there to start with, so they were both part of the installation.

    I am using the Smart Device Framework 1.2.. How did you manage to recompile the .DLL-file and use the new version? I rebuilt the solution, and tried to both overwrite the .DLL-file in the Compact Framework-directory and refer to the .DLL in the Source-directory of Smart Device Framework with no luck!

    Time is running out here, hope you can help!

    Andreas
  • 10-30-2004 22:00 In reply to

    Re: .RecordFor( to memory stream

    OK, sorted it out!

    For others that have the same problem - I uninstalled the entire Smart Device Framework and just worked on the source code. After rebuilding it, I just referred to the .DLL-file in the Debug directory under OpenNETCF og voila!

    Thanks bjaminn! This was exactly what I needed!

    Andreas
  • 11-04-2004 14:49 In reply to

    Re: .RecordFor( to memory stream

    Andreas,

    I'm getting started on the exact same thing you are doing....creating a VOIP app based on the OpenNetCF. I've had no choice but to do this because of the limited availability of WM2003 VOIP SDK's out there. Can you give me any help or direction?

    Thanks,

    Ryan
  • 09-14-2005 3:36 In reply to

    Re: .RecordFor( to memory stream

    i am working on similar project Voice over IP , can u help me.
    thanks in advance
  • 10-12-2005 15:31 In reply to

    Re: .RecordFor( to memory stream

    Hi!

    After editing and rebuilding the OpenNETCF namespace like "bjaminn" suggested above, it seems as if Audio.Player.Play() also closes the MemoryStream.

    I temporarily use this workaround until it find out what to change in OpenNETCF.dll:

    Dim stMemTemp As New MemoryStream(Me.stMem.GetBuffer)
    stMemTemp.Position = 0
    plrWave.Play(stMemTemp)
    stMemTemp.Close()

    ...where "stMem" is the original MemoryStream recorded wirh Recorder.RecordFor().
    This way there is the possibility to not just replay the recorded audio one time and then loose it.

    Hope this helps if someone runs into the same problems...


    Danyel Meyer
    -------------------------------------------
    dialog-it GmbH
    Röllinghäuser Strasse 55a
    31061 Alfeld/Leine

    Tel +49 (0) 5181 900 814
    Fax +49 (0) 5181 900 815
    E-Mail danyel.meyer@dialog-it.de
  • 06-11-2006 12:21 In reply to

    Re: .RecordFor( to memory stream

    Hi,

    Im starting a VOIP application between an IPAQ & a PC, writting the code using c# (the IPAQ side) & C++ (the PC side).
    I was wondering if anyone can send me information / examples - this would be really appriciated.

    Thanks,
    Shai Amiel
    shaiamiel@gmail.com
  • 09-08-2006 7:34 In reply to

    Re: .RecordFor( to memory stream

    Hi
    I have solved this problem by inheriting the MemoryStream class,adding Closeable property and overriding Close sub.

    Public Overrides Sub Close()
    If Closeable Then
    MyBase.Close()
    End If
    End Sub
Page 1 of 1 (10 items)