Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic Libraries (Linux)
#11
You could say this is a Linux alternative to WASAPI loopback. The library requires PulseAudio to work.
 
sudo apt update
sudo apt install -y build-essential pkg-config libpulse-dev pulseaudio-utils
sudo apt install -y pulseaudio-utils libpulse0 libasound2-plugins

Here's the situation: The laptop destined for the full Linux install is still copying data from the hard drive to the home cloud. But since that laptop is an ancient relic, it’ll probably finish sometime in the next millennium... or on February 31st... or maybe when the Sahara floods.

This project is developed in WSL and works fine there—unless Windows is just messing with me. As shown here, it records live audio (system output) and microphone input. Line-In should work too, though I haven't tested it yet. Both inputs are visualized. It stutters a lot under WSL, but that’s definitely just because of the emulation.

In ZIP file is C source code for SO library, SO library and BAS file. Since the source is open, feel free to fork it and convert it to a header-only implementation if that suits your needs better.  Tongue


Attached Files
.zip   Linux_Mic_Live_LineIn.zip (Size: 10.74 KB / Downloads: 9)


Reply
#12
I am happy to announce the addition of video playback support using VLC libraries. This is essentially the same implementation as recently released in the Windows Library thread, but with several adjustments specifically for Linux.

I have tested it both in a virtualized Linux environment (Ubuntu) and on bare metal (Linux Mint on a laptop). 
During testing, I discovered and fixed a critical bug in the SUB LoadVideo&, where:

It was incorrectly hardcoded as: 

' default audio/video params 
VLC_P(slot).AudioRate = 44100 
VLC_P(slot).AudioCh = 2

But the correct way (now fixed) must be: 

' default audio/video params 
VLC_P(slot).AudioRate = _SNDRATE
VLC_P(slot).AudioCh = 2

Otherwise, the audio crackles - as if some samples were missing.

Aside from this fix, it is identical to the Windows version. The main difference is that I don’t need to share 190 MB of libraries here, as Linux requires these libraries to be installed system-wide for the program to function.

To install the necessary libraries, run these commands:

sudo apt update
sudo apt install vlc libvlc-dev

If the libraries are installed correctly, the following command will return the version number:
pkg-config --modversion libvlc

The attached ZIP file contains the .SO library (the wrapper between QB64PE and VLC), the source code for the wrapper, and the .BI, .BAS, and .BM files.


Attached Files Thumbnail(s)
   

.zip   QB64PE_VLC_Play_LNX.zip (Size: 21.95 KB / Downloads: 7)


Reply
#13
I'll have to give this a try. This looks neat. Maybe I'll be able to make a GTK4 player that is like that thing I did for Windows.
The noticing will continue
Reply
#14
Yes, go ahead and write it, @SpriggsySpriggs. The only extra thing you'll need to do on Linux for this is disable the screen sleep mode. I've had it happen a few times where I was watching a movie on Linux and the system just went to sleep on me...

To make it easier for you, you can prevent the system from sleeping like this: (Shell)
Code: (Select All)
systemd-inhibit --what=idle:sleep --mode=block your_program_name /path/to/movie/movie_name.mkv


Reply
#15
ScreenImage for Linux

This feature isn't natively supported on all Linux systems. It works if you're using X11 display server, but unfortunately, it doesn't work on Wayland. Wayland is a newer display protocol that restricts screen capture for security reasons.

To find out which display server you're using, run

Code: (Select All)
echo $XDG_SESSION_TYPE


in your terminal. If it returns x11, you're good to go. If it returns wayland, the feature likely won't work as it hasn't been tested in that environment.

zip file contains: BAS source code, C source code for library, SO library and txt file (info what all it need and how compile own SO)


Attached Files
.zip   Linux ScreenImage for X11.zip (Size: 8.17 KB / Downloads: 7)


Reply
#16
I saw in the help file that _CapsLock, _NumLock, and _ScrollLock aren't supported on Linux.

Linux can be a bit hit-or-miss with these things. However, I have a program where NumLock and CapsLock work fine on my 64-bit Linux Mint (X11). Scroll Lock isn't mapped yet, so I’d appreciate it if other users could test it out and let me know how it goes. It probably won't work on Wayland, but it's worth a try.

You'll find the dependencies and compiler/linker parameters right at the top of the BAS code.

ZIP file contains H file and BAS file.


Attached Files
.zip   linux_locks.zip (Size: 1.73 KB / Downloads: 6)


Reply
#17
I’ve been going through the command list one by one to see where I can lend a hand. It seemed Linux was being 'deprived' of Drag-and-Drop support?

Well, not anymore—at least not on my Linux Mint X11 setup. I was grinding on this all day yesterday, finally called it a night at 3 AM, and jumped right back into it a few hours later.

Attached is a ZIP file containing the .BAS source, the C code, an .SO library, and a TXT file with a detailed technical breakdown of how it all works. Note: this is tested on native Linux Mint X11; don’t expect it to work in WSL.

My vacation is over, so the library releases might slow down a bit, but the work continues!  Big Grin


Attached Files
.zip   Linux_X11_drapdrop.zip (Size: 14.94 KB / Downloads: 6)


Reply
#18
 Alternative to _PrintImage for Linux and WSL
Hi everyone,

Since the _PrintImage statement isn't natively supported in Linux, I’ve developed an alternative for you to use. This program works seamlessly in both WSL and Linux Mint.

Key Features:

Set the number of pages and print area.

Support for duplex (double-sided) printing.

Toggle between color and grayscale.

Printer Selection: Unlike the native Windows _PrintImage statement which is limited to the default printer - this tool actually lets you choose which device you want to print to.

Feedback Needed: I only have a black-and-white printer available, so I would really appreciate it if you could test the color functionality and provide some feedback.

Technical Details: The dependencies and instructions for compiling the .so library are listed at the beginning of the BAS program code. The attached ZIP file includes:

 .so library, C source code for the library, BAS program.

The .BAS program handles the page generation itself, so you should find it very easy to customize to your needs.

One final tip: Always remember to use a white background in your designs to avoid unnecessary printing costs!

Looking forward to your feedback.


Attached Files Thumbnail(s)
       

.zip   Linux_PrintImage.zip (Size: 19.74 KB / Downloads: 6)


Reply
#19
This tool lets you move windows around your screen just like Windows' _ScreenMove. This feature has been missing in Linux for a long time... but that changes today.

Zip file contains BAS demo program, C program, SO library and informations in TXT file.

Big thanks to @ahenry3068, whose question inspired me to tackle the Linux side of things!


Attached Files
.zip   ScreenMove for Linux.zip (Size: 10.39 KB / Downloads: 4)


Reply
#20
A small modification of the previous program was enough and two missing functions of Linux compared to Windows can be added immediately: _ScreenX and _ScreenY. Grab the window by the edge and move it around the screen. The library will show you the X and Y position of the upper left corner of the window. Just like in Windows.

ZIP file: BAS/SO/C


Attached Files
.zip   screenXY.zip (Size: 6.91 KB / Downloads: 4)


Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Dynamic Libraries (Windows) Petr 50 3,309 02-24-2026, 06:38 PM
Last Post: Petr

Forum Jump:


Users browsing this thread: 1 Guest(s)