File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -109,19 +109,24 @@ int SoundEmojiSynthesizer::play(ManagedBuffer sound)
109109 MicroBitAudio::requestActivation ();
110110
111111 // Validate inputs
112- if (sound.length () < (int ) sizeof (SoundEffect))
112+ SoundEffect *fx = (SoundEffect *) &sound[0 ];
113+ if (sound.length () < (int ) sizeof (SoundEffect) || fx->frequency < 0 )
113114 return DEVICE_INVALID_PARAMETER;
114115
115116 // If a playout is already in progress, block until it has been scheduled.
116117 lock.wait ();
117118
119+ target_disable_irq ();
120+
118121 // Store the requested sequence of sound effects.
119122 effectBuffer = sound;
120123
121124 // Scheduled this sound effect for playout.
122125 // Generation will start the next time a pull() operation is called from downstream.
123126 nextSoundEffect ();
124127
128+ target_enable_irq ();
129+
125130 // Perform on demand activiation if this is the first time this compoennt has been used.
126131 // Simply issue a pull request to start the process.
127132 if (!(status & EMOJI_SYNTHESIZER_STATUS_ACTIVE))
You can’t perform that action at this time.
0 commit comments