# Access Programmer Instrument from EventInstance reference

**URL:** <https://qa.fmod.com/t/access-programmer-instrument-from-eventinstance-reference/21156>\
**Category:** Unity\
**Tags:** unity\
**Created:** [January 25, 2024, 2:23pm UTC](https://qa.fmod.com/t/access-programmer-instrument-from-eventinstance-reference/21156 "2024-01-25T14:23:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![spakment](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@spakment](https://qa.fmod.com/u/spakment)\
**Post date:** [January 25, 2024, 2:23pm UTC](https://qa.fmod.com/t/access-programmer-instrument-from-eventinstance-reference/21156/1 "2024-01-25T14:23:08Z")

</div>

Hey all,  
I have an event setup with 3 programmer instruments on it set to loop indefinitely.  
I have an audio table setup (there will be a hundred or so different audio clips).

 ![prog-loop](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/e/ef31ffde51c22602f4fc54a9b82a190a51c868c6.png)

When user’s perform certain things in Unity I’d like to be able to swap the audio clip which is playing in a specific programmer instrument and keeping the playback in sync with the other clips, not re-starting.

Firstly, is this (changing the programer sound while it’s playing in a loop) possible?  
and if it is, how do I access the individual programmer instrument from the EventInstance reference?

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [January 30, 2024, 12:27am UTC](https://qa.fmod.com/t/access-programmer-instrument-from-eventinstance-reference/21156/2 "2024-01-30T00:27:46Z")

</div>

Hi,

> [@spakment](#):
>
> Firstly, is this (changing the programer sound while it’s playing in a loop) possible?

Once a programmer sound has been started you can’t change its audio file. An option may be starting a second event with a programmer instrument so that you can fade in and out of the events.

> [@spakment](#):
>
> how do I access the individual programmer instrument from the EventInstance reference?

You can use [FMOD\_STUDIO\_PROGRAMMER\_SOUND\_PROPERTIES::name](https://fmod.com/docs/2.02/api/studio-api-eventinstance.html#fmod_studio_programmer_sound_properties) to access the individual programmer instruments. I used an `if()` statement to check the name of the instrument and then changed the file passed in from the audio file:

```auto
FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES* props = (FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES*)parameters;
std::string stringName = props->name;
if (stringName == "First")

```

Hope this helps!

---

<div class="post-metadata">

**Author:** ![spakment](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@spakment](https://qa.fmod.com/u/spakment)\
**Post date:** [January 30, 2024, 10:34am UTC](https://qa.fmod.com/t/access-programmer-instrument-from-eventinstance-reference/21156/3 "2024-01-30T10:34:29Z")

</div>

Thanks @Connor_FMOD I will look into an alternative solution
