Recent

Author Topic: alsa beep - linux only  (Read 5201 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 1822
Re: alsa beep - linux only
« Reply #75 on: November 07, 2020, 03:38:31 pm »
OK, I'll try to work on a MIDI example to go with it (definitely won't be today). But it might need manual entry of the device selection numbers.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

MarkMLl

  • Hero Member
  • *****
  • Posts: 1822
Re: alsa beep - linux only
« Reply #76 on: November 11, 2020, 07:44:16 pm »
Here's an extension of the example to also handle MIDI output. I warn you that it's idiosyncratic, it's basically something that I wrote 20 years ago on Windows which has been hacked about recently to use ALSA on Linux.

I'm not saying it's the best way to do it, I'm not even saying it's a right way to do it (i.e. I'm sure that ALSA MIDI experts would shoot me down). Most of the complexity is in the code that looks at available devices, and works out which of them are useful soundcards etc.

However, I think that the significant thing in my example is the way that I've recycled somebody else's idea to wrap the DLL/so module. I think the only bit I'd claim to be my own is the way that I've organised things so that "AsoundSeq" etc. can be either a unit or an object, which appear identical from the POV of application code.

This stuff gets far more interesting when you write your own dynamically-loadable module (e.g. some sort of plugin), and export entry points from the main program for it to use. However the last time I tried that it was problematic... I don't know if that was because I'd got 64-bit code rather than the 32-bit code I'd used in the past, or if there was something in there specific to a given version of FPC code generation.

MarkMLl


Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

 

TinyPortal © 2005-2018