Difference between revisions of "Using Scream over Shared Memory"

From Looking Glass
Jump to navigation Jump to search
(Created page with "== Introduction == As of a recent windows 10 update (Time of writing: 20th oct 2019), all programs that utilize audio will hang when the output is set to an ICH6 or ICH9 devic...")
 
m
Line 6: Line 6:
 
A link to the official tutorial this guide is based on can be found [https://github.com/duncanthrax/scream#using-ivshmem-between-windows-guest-and-linux-host on the official Scream GitHub repository]! Below is a step-by step instruction for modifying your existing Looking Glass machine.
 
A link to the official tutorial this guide is based on can be found [https://github.com/duncanthrax/scream#using-ivshmem-between-windows-guest-and-linux-host on the official Scream GitHub repository]! Below is a step-by step instruction for modifying your existing Looking Glass machine.
  
There's some special sauce at the bottom that is not in the official guide, but i highly recommend doing. See: [[#Linking Looking Glass with Scream for the perfect experience|Linking Looking Glass with Scream for the perfect experience]]
+
There's some special sauce at the bottom that is not in the official guide, but is highly recommended. See: [[#Linking Looking Glass with Scream for the perfect experience|Linking Looking Glass with Scream for the perfect experience]]
  
 
== Steps to install [https://github.com/duncanthrax/scream Scream] ==
 
== Steps to install [https://github.com/duncanthrax/scream Scream] ==

Revision as of 05:14, 24 October 2019

Introduction

As of a recent windows 10 update (Time of writing: 20th oct 2019), all programs that utilize audio will hang when the output is set to an ICH6 or ICH9 device. AC97 drivers are quite old, and setup is quite tedious. As a workaround, you can use Scream. It's primarily developed by duncanthrax and provides an alternate way to send sound to the host. Scream is relatively painless to set up.

Assuming you already finished setting up Looking Glass in your virtual machine, you already have the IVSHMEM drivers installed. You can skip this part in the official guide for setting up Scream. In this guide, an example for Pulseaudio is provided. But scream supports ALSA as well.

A link to the official tutorial this guide is based on can be found on the official Scream GitHub repository! Below is a step-by step instruction for modifying your existing Looking Glass machine.

There's some special sauce at the bottom that is not in the official guide, but is highly recommended. See: Linking Looking Glass with Scream for the perfect experience

Steps to install Scream

At the time of writing, version v3.4 was used.

Configuring the windows VM

  • Download the latest Scream release from the GitHub repository.
    • Choose the non-source .zip file
  • Inside that file, there's a directory called Install. Move it into your Windows 10 virtual machine
  • Execute install.bat as administrator
  • Open registry editor and navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Scream\Options
    • If the Options key doesn't exists, create it.
  • Create a DWORD value called UseIVSHMEM and set it to 2.
Scream regedit layout.png
Scream regedit dword.png
  • Shut down the VM, and use virsh edit <vm-name> and insert this snippet in the XML file.
    • Please notice that the size must match the number entered in the DWORD value as configured in windows.
    • If you get complaints like: "Attempted double use of PCI Address", change the slot number to something else and try again.
   <shmem name='scream-ivshmem'>
      <model type='ivshmem-plain'/>
      <size unit='M'>2</size>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
    </shmem>
  • Configuring the windows machine is now complete.

Setting up the Linux host

The Linux host will use a 'receiver' to play sound. Instructions straight from the guide:

Linux/Pulseaudio: Not included in the installer package. Just type ‘make’ to build it. You might need to install build tools and Pulseaudio development packages.

Linux/ALSA: Originally contributed by ivan. Not included in the installer package. Just type ‘make’ to build it. You might need to install build tools and ALSA development packages.

  • Download the source code .zip for the same version of Scream you downloaded at the beginning.
  • Extract the following directory: Scream-X.X/Receivers/pulseaudio-ivshmem
  • Open a terminal inside the extracted directory containing a file named: Makefile
    • In the terminal, run: make
    • You might need some dependencies, for those, see the quote above.
  • You are left with a file called: scream-ivshmem-pulse. Move it to a location of your choosing. (Your Looking Glass folder is a good choice.)

Testing functionality

  • Start the windows VM
  • Check if you have read-access to the /dev/shm/scream-ivshmem file.
  • Execute the following command in the directory you have moved the compiled program to: ./scream-ivshmem-pulse /dev/shm/scream-ivshmem
  • Play some test tunes in the windows VM. Make sure to set the audio output to scream.
  • You should hear sound at this point. If you don't, something went wrong. (Maybe look at the official guide?)

Linking Looking Glass with Scream for the perfect experience

We will use some bash magic to make sure Scream only runs for as long as Looking Glass is open. Therefore, we never run Looking Glass directly, but use bash to run it for us. Create a file with a name of your choosing. This file will be used to start and stop Scream simultaneously with Looking Glass. Read the comments inside the snippet for further instructions and change the VM name and paths accordingly.

#!/bin/bash

virsh start Windows_10_VM # Optional line, this will simply start the VM if it isn't running. You can delete this if you wish. Make sure to change the name to your VM name.
/path/to/looking-glass-client >/dev/null 2>&1 & # Starts Looking Glass, and ignores all output (We aren't watching anyways)
/path/to/scream-ivshmem-pulse /dev/shm/scream-ivshmem & # Starts Scream

wait -n # We wait for any of these processes to exit. (Like closing the Looking Glass window, in our case)
pkill -P $$ # We kill the remaining processes (In our case, scream)

Make sure the file is executable, and you should be good to go!