View Full Version : simple program
06-29-2004, 01:30 PM
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;
msg.param = ML_AUDIO_BUFFER_POINTER;
msg.value.pByte = ourAudioBuffer;
what's the "ourAudioBuffer"?
excuse me for my english.
i'm looking forward to hear your suugestions.
[ June 29, 2004: Message edited by: ehsan2004 ]
06-30-2004, 04:49 PM
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.
07-01-2004, 09:39 AM
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.
07-01-2004, 12:56 PM
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.
07-12-2004, 11:56 AM
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?
07-13-2004, 08:05 AM
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.
07-13-2004, 09:07 AM
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?
07-14-2004, 06:18 PM
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:
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'.
07-16-2004, 05:53 AM
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
when i use the "WAVE audio device:0" in the audiotomem.exe with allocatiion of n buffers,it reports me in this order:
!Warning - we dropped a 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...
07-17-2004, 04:11 PM
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.
07-23-2004, 01:36 PM
my problems solved. notice that the reason that i received 4 WAVE audio device in mlquery.exe was my operating system-windows98. now under XP it reports only 2 devices.
now the problem is about memtovid.exe. when i run it(after running the mldaemon) it isn't executed- i receive a run-time error.notice that i only have compiled it. no extra works i have done.
what do you think about this situation?
07-27-2004, 04:06 AM
I don't know what to think of this if you don't tell me what type of run-time error you get.
Note that you won't be able to run any of the video samples if you don't have a video device in your system. Does 'mlquery' report a video device? If not, I suspect your run-time error is something like 'no suitable device found'.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.