Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: simple program

  1. #1

    simple program

    hi
    I have some questios:
    in the "OpenML Media Library Software Development Kit Programmerís Guide" i run the first simple example of this document; but there was 2 errors on it( i have compiled it with VC++6 ).
    1) 'mluFindPathToJack' : function does not take 2 parameters
    i have written it as you saw in this guide: mluFindPathToJack( jackID, &pathID );

    2)i don't know that how can i allocate a buffer in memory.
    ( MLpv msg[2];
    msg[0].param = ML_AUDIO_BUFFER_POINTER;
    msg[0].value.pByte = ourAudioBuffer;
    )
    what's the "ourAudioBuffer"?

    excuse me for my english.
    i'm looking forward to hear your suugestions.
    ehsan kamrani.

    [ June 29, 2004: Message edited by: ehsan2004 ]

  2. #2
    Member
    Join Date
    Jul 2003
    Location
    Montreal
    Posts
    75

    Re: simple program

    1) Yes, there are a few glitches in this manual. That is why we have produced an "errata" document, which is also in the "docs" directory of the OpenML distribution. This errata document lists all known errors of the manual -- and corrects them.

    In the case of mluFindPathToJack, there is a third parameter: 'memoryAlignment'. See the man page document (a PDF) in the docs directory for the full syntax, and the meaning of this third parameter.


    2) You allocate your buffer using your favourite memory allocation technique -- probably 'malloc' or 'new' depending on whether you're writing C or C++.

    I suggest you take a look at the example programs that are distributed with the SDK (in the examples/ML directory). They will help answer both your questions -- and many more.

  3. #3

    Re: simple program

    hi
    Thanks
    I created a buffer and filled it with a WAVE data. then i run that with different rates and the result was different.
    1)I think that this is the target for this program. is it true?
    2)i want to write from the audio device into this buffer( in this case i only allocate a memory for this buffer ). can i do that with this simple program?if it's not possible please suggest me.
    thanks

  4. #4
    Member
    Join Date
    Jul 2003
    Location
    Montreal
    Posts
    75

    Re: simple program

    I'm not sure I understand what you are describing... you filled the buffer with data from a WAVE file? In that case, there is a single sample rate that can be used to play that data correctly, play back at any other rate will produce different (and incorrect) results. You need to adjust the play-back rate on the ML path to match the rate of your data -- or convert your data (which is more work).

    Yes, you can also capture audio data into your buffer. Check out the 'audiotomem' sample program for an example of how to do this.

  5. #5

    Re: simple program

    hi
    thanks
    i have som equestions:
    1)When i run the mlquery.exe, it doesn't report about my system- but reports about my DEVICES.what's the problem? notice that i run it under windows 98.
    2)When i run the audiotomem.exe in the shell window and for example when i type some information, it reports that "File not found". what's the file and in which place i need to create it. what's the properties of this file?
    regards.

  6. #6
    Member
    Join Date
    Jul 2003
    Location
    Montreal
    Posts
    75

    Re: simple program

    mlquery reports the ML devices available on your system. You should see a list of devices, if any are installed.

    Note that OpenML does not support Windows 98 -- it may work, but there may be errors (in particular, in the demo Audio module).

    As for 'file not found', I don't think 'audiotomem' attempts to open a file ('audiotofile' does -- is that the one you're using?). So the file that isn't found is perhaps the executable itself? Check your PATH, or use "./" to start the executable.

    Note that these demo programs were tested using the cygwin environment (and in particular, a cygwin 'bash' or 'tcsh' shell). You mileage may vary if you are using the DOS command prompt.

  7. #7

    Re: simple program

    Dear Fabrice
    as you mentioned, i have run the "audiotofile.exe". but my mean was "audiotomem.exe"-a mistake!.
    now i want to run this program- notice that i have read the source file of this project.now i think that i need a microphone to send the audio samples to the memory. if that's true, plase tell me about giving the arguments. as an example, a davice name that i need to input after -d is the same name that mlquery reports? what's the minimum input for this program?
    ehsan kamrani
    regards

  8. #8
    Member
    Join Date
    Jul 2003
    Location
    Montreal
    Posts
    75

    Re: simple program

    If you run the demo programs without arguments (or with invalid arguments), they print a help message.

    Yes, the device name you use (the '-d' argument) is the name returned by the 'mlquery' program. Place the name in double-quotes if it includes spaces.

    So for instance, on my Windows machine, mlquery reports:
    DEVICES:
    nullXcode:0
    WAVE audio device:0

    So I can run 'audiotofile' like this:
    % ./audiotofile.exe -d "WAVE audio device" -n 100 test.wav

    This will use the 'WAVE audio device' (the sample module shipped with the OpenML SDK), will record 100 buffers and save them to the file 'test.wav'.

  9. #9

    Re: simple program

    Dear Fabrice
    I have some question about the mlquery.exe.
    under my operating system (or also you )why does it report "only" about the WAVE audio and nullXcode devices? we have other devices such as graphics devices; but the mlquery.exe doesn't report about them.

    2)also what's the nullXcode device? when i use from the name of this device in the audiotomem.exe, it repots me that "cannot find the suitable input jack".why?

    3)the intent of the audiotomem.exe is to fill the buffers with audio samples. but i don't know that how can i use from a device to do that. as an example, under my operating system, the mlquery.exe reports that i have 5 devices:

    WAVE audio device:0
    WAVE audio device:1
    WAVE audio device:2
    WAVE audio device:3
    nullXcode:0

    when i use the "WAVE audio device:0" in the audiotomem.exe with allocatiion of n buffers,it reports me in this order:

    Got buffer
    Got buffer
    !Warning - we dropped a buffer
    Got buffer
    Got buffer
    !Warning - we dropped a buffer
    ...
    and i know that when it reports a Warning message, we are in the 'ML_EVENT_AUDIO_SEQUENCE_LOST" state.why does it drop a buffer?

    or when i use the "WAVE audio device:1" it reports that:
    Cannot open path:ML_STATUS_INTERNAL_ERROR

    or when i use the "WAVE audio device:2"- and also 3 - it reports that:
    Cannot open path:ML_STATUS_DEVICE_ERROR

    4) and finally about the "audiotofile.exe" .I want to save the audio samples in a wave file. but how can i create a wave file?

    I'm looking forward to hear your suggestions...
    best regards
    ehsan kamrani

  10. #10
    Member
    Join Date
    Jul 2003
    Location
    Montreal
    Posts
    75

    Re: simple program

    Hello Ehsan,

    mlquery will only report the ML devices on your system. For an ML device to exist, there must be an ML 'module' installed. The SDK comes with the WAVE audio and the nullXcode sample modules, that's why those show up in mlquery. If you had an ML-compliant board with a driver, that would also show up in mlquery.

    For your graphics device to show up in mlquery, you would need to have an ML module for it installed. However, it isn't clear what sort of ML service a graphics device could provide (graphics boards don't generally deal with video or audio I/O).

    The nullXcode device is a sample trans-coder. See the ML spec and the developper's guide for a description of ML transcoders. Note that the nullXcode is a transcoder that does nothing (hence its name) -- it is just meant as a code sample.

    Hmmm, mlquery reports 5 WAVE devices on your system... you must have a fairly heavy-duty audio card in there, with many inputs and outputs. On my system, I only have a single in and a single out, so it shows up as a single WAVE device... what I'm saying here is that the sample module has only been tested and is only known to work for a single-device system. It may be that the problems you are seeing (INTERNAL_ERRORs and DEVICE_ERRORs) are simply bugs in the sample module...

    If you re-compile the SDK in debug mode, you can set the environment variable 'ML_DEBUG' to get some debugging output. You can also set the 'ADEBG' env. var to something larger than zero to get debugging output from the WAVE sample module. If you spot the bug, please let me know!

    As for getting sequence lost events... yeah, that can happen with the sample code -- since these aren't "real" modules (and in particular, since they aren't kernel-level drivers), they don't even attempt to be real-time. So if your system is busy doing something else, you can miss some buffers. That is something that is far less likely to happen with real ML modules, written for ML-compliant hardware.

    And finally, in audiotofile.exe, you simply give it the name of a WAVE file, and it will create it for you, with the samples captured from your audio hardware.

    cheers,

    ...Fabrice

Page 1 of 2 12 LastLast

Similar Threads

  1. hello! A simple question
    By yxyybbs in forum OpenSL ES - General
    Replies: 1
    Last Post: 07-19-2011, 08:03 AM
  2. simple js benchmark
    By lordghost in forum Developers Coding:Advanced
    Replies: 0
    Last Post: 02-03-2010, 02:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •