Using the library

The Git repository that contains the SpatialSoundPlayer also contains a sample project. This is just the standard spinning cube sample; however, now, when you tap to position the cube, it will also make a noise, coming from that cube.

Let's investigate how this works.

Open the HoloSoundsMain.cs file. I have a new private member here:

private SpatialSound _spatialSound;

This is our component. In the SetHolographicSpace method, you see how I initialize it. I give it RoomType and a file it can process. Of course, the ping.wav file is part of the app as well:

_spatialSound = new SpatialSound();_spatialSound.SetRoomType(RoomType.Medium);_spatialSound.Initialize(@"Assets/Sounds/ping.wav");In the Dispose we clean up after ourselves: ...

Get Microsoft HoloLens Developer’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.