Date: prev next · Thread: first prev next last
2017 Archives by date, by thread · List index


seems to me is you were using linux this should be almost automatic /dev/device.. <


 18.1 Device Files

UNIX has a beautifully consistent method of allowing programs to access hardware. Under UNIX, every piece of hardware is a file. To demonstrate this novelty, try viewing the file /dev/hda (you will have to be root to run this command):

||
        |less -f /dev/hda|

/dev/hda is not really a file at all. When you read from it, you are actually reading directly from the first physical hard disk of your machine. /dev/hda is known as a device file, and all of them are stored under the /dev directory.

Device files allow access to hardware. If you have a sound card installed and configured, you can try:

||
        |cat /dev/dsp > my_recording|

Say something into your microphone and then type:

||
        |cat my_recording > /dev/dsp|

The system will play out the sound through your speakers (note that this d\n always work, since the recording volume or the recording speed may not be set correctly.)

If no programs are currently using your mouse, you can also try:

||
        |cat /dev/mouse|

If you now move the mouse, the mouse protocol commands will be written directly to your screen (it will look like garbage). This is an easy way to see if your mouse is working, and is especially useful for testing serial port. Occasionally this test doesn't work because some command has previously configured the serial port in some odd way. In that case, also try:

||
        |cu -s 1200 -l /dev/mouse|

At a lower level, programs that access device files do so in two basic ways:

 * They read and write to the device to send and retrieve bulk data
   (much like less and cat above).
 * They use the *C* ioctl (/IO Control/) function to configure the
   device. (In the case of the sound card, this might set mono versus
   stereo, recording speed or other parameters.)

Because every kind of device that one can think of (except for network cards) can be twisted to fit these two modes of operation, UNIX's scheme has endured since its inception and is the universal method of accessing hardware.

I think the interest to use Libre Office maybe to get the port data to be captured into a spreadsheet.. ?


On 08/28/2017 04:24 AM, Cley Faye wrote:
2017-08-27 15:47 GMT+02:00 Marion & Noel Lodge <lodgemn@gmail.com>:

I have a Studio Logic MIDI music keyboard which I have plugged into my PC
via a USB cable.  Windows has automatically installed the appropriate
driver/s.  I am attempting to read the MIDI input from the keyboard as I
want to see if I can use ahttps://www.hhdsoftware.com/device-monitoring-studio  Macro to modify the 
sound before it goes to the
speaker.   (Actually I want to try to programmatically mix sine waves like
a Hammond Organ does - it may not be possible, but I'd like to give it a
try!)

I installed a trial version of Device Monitoring Studio,   see
https://www.hhdsoftware.com/device-monitoring-studio    which enables me
to
trap the raw data from the keyboard, and I'm able to identify which keys
are pressed or released, and also the keyboard sliders' movements and
slider positions.  For my purposes, that is all I need to extract from the
MIDI stream.

I then went on the Web to see if I could find examples of Macro code that
would enable my program to emulate what I had been able to do with Device
Monitoring Studio.  It turns out that USB coding is very complex and the
only examples I could find were in C, C++ or Visual Basic, none of which I
have, or have ever worked with.

I then had a look at LibreOffice 5.3 SDK API.  I believe that is the API
that Base uses, and over several years I have developed a number of
databases using macros that make calls to the API. One API service I foundUsing Python with libusb 
could work, if you're looking for something quick
to implement and don't want to dwelve in compiled languages.

was,  com.sun.star.io.pipe,  which looks as though it might be what I need,
but I don't know if it would work with a USB port, and I could not find any
macro code examples that might point me in the right direction.

So my questions are -
1.  Does anyone know if it is possible to read from a USB port using a
LibreOffice macro utilising the API?  If so can you point me to some
example code (preferably in Basic)?
2.  Failing that, is there a simple application on the market that can read
a USB MIDI stream into a buffer or file?  I think Device Monitoring Studio
can do that, but it is expensive and has far more features than I'll ever
need.


​Maybe I misunderstood something, but I don't see how this is related to
LibreOffice in any way. While it is true that it is possible to write
applications with LibreOffice to some extent, what you're describing would
be better done using anything else​.

Using Python with libusb could work, if you're looking for something quick
to implement and don't want to dwelve in compiled languages.



--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.