Q&A- Sound Player

QA1 How do you handle a "_handleMIDIMsg: no free voice" error?
QA2 Playing two sounds at the same time
QA3 What is the timing for changing AL_STOPPED etc.?
QA4 I want to send sound FX separately to L and R

Q1 Referring to the sample source "simple," I tried to build some sounds, but the following error messages were displayed. What caused them and how do I handle them?

0X...(0101): _handleMIDIMsg: nofree voice 
0X...(0103): _handleMIDIMsg: noteoff-couldn't find voice

A1 As it says in the top message, this is a warning that appears when there aren't enough voices (voice channels). Increase the value for Max_PVOICE.

If it still doesn't work well even if you increase the number of channels, check to see that there is a note-OFF for each and every note-ON in the sequence.

The bottom error occurs paired with the top error, and happens because a note for which reserving a physical voice failed has attempted to release the invalid physical voice when it encountered a note-OFF.


Q2 I am currently studying about sound playback (SE playback) using soundmonkey, but how do I get two sounds to be played at the same time?

What kind of resources are allocated to a sound by alSndpAllocate()?

A2 Execute alSndpAllocate twice for one sound. For details, please refer to Section 17.2, "Playing Back Sampled Sounds," in the N64 Online Programming Manual.

This may be redundant, but you probably shouldn't use soundmonkey to study sound-related programming. Since soundmonkey is equipped with no more than the minimum functions for making sounds, it would be difficult to use it to create an actual game. It is bly recommended that you use NuSystem as your development environment. If you can't use NuSystem because you have old resources, etc., nnsample is recommended because the relationship between general sampling and non-sound related programming is easier to understand.


Q3 What is the timing for changing the flags which indicate the status of a sound (AL_STOPPED, AL_STOPPING, AL_PLAYING)?

A3 The timing for changing these 3 flags (AL_STOPPED, AL_STOPPING, AL_PLAYING) is after the alAudioFrame() command has been called and executed.

Since alAudioFrame() generally is called at the end of a frame cycle, even if, e.g., the SE(Voice) called "banban" is registered with alSndpSetSound() and then alSndpPaly() is called, the flag will not change at that time. Typically, AL_STOPPED will be active during that frame. Similarly, even if alSndpStop() is issued, AL_PLAYING will remain active during that frame.

In other words, since the flag is changed after alAudioFrame() has been called, the change is effective in the next frame.


Q4 I want to send sound FX separately to L and R

A4 Sound effects cannot be sent in stereo. Display the source code and create them independently.