Пример #1
0
OPErr GM_UnloadSongInstruments(GM_Song *pSong)
{
    short int	count;
    OPErr		err;

    err = NO_ERR;
    if (pSong)
	{
	    for (count = 0; count < (MAX_INSTRUMENTS*MAX_BANKS); count++)
		{
		    if (pSong->instrumentData[count])
			{
			    err = GM_UnloadInstrument(pSong, count);
			    if (err == NO_ERR)
				{
				    pSong->instrumentData[count] = NULL;		// redundant, but clear
				}
			    else
				{
				    break;
				}
			}
		}
	}
    return err;
}
Пример #2
0
JNIEXPORT jboolean JNICALL
    Java_com_sun_media_sound_MixerSynth_nUnloadInstrument(JNIEnv* e, jobject thisObj, jlong id, jint instrumentId)  
{
    OPErr opErr;
	
    TRACE0("Java_com_sun_media_sound_MixerSynth_nUnloadInstrument\n");

    opErr = GM_UnloadInstrument((GM_Song *) (INT_PTR) id, (XLongResourceID)instrumentId);

    TRACE0("Java_com_sun_media_sound_MixerSynth_nUnloadInstrument completed\n");

    return ( (opErr == NO_ERR) ? TRUE : FALSE );
}
Пример #3
0
OPErr GM_UnloadSongInstrument(GM_Song *pSong, XLongResourceID instrument)
{
    register OPErr				theErr;

    theErr = BAD_INSTRUMENT;
    if ( pSong && (instrument >= 0) && (instrument < (MAX_INSTRUMENTS*MAX_BANKS)) )
	{
	    theErr = GM_UnloadInstrument(pSong, instrument);
	    if (theErr == NO_ERR)
		{
		    pSong->remapArray[instrument] = instrument;
		    pSong->instrumentRemap[instrument] = (XLongResourceID)-1;
		}
	}
    return theErr;
}
Пример #4
0
// Load an instrument based from a memory definition, and assign it to the instrument ID passed.
// This will unload the instrument if its already loaded.
OPErr GM_LoadInstrumentFromExternalData(GM_Song *pSong, XLongResourceID instrument,
					void *theX, UINT32 theXPatchSize)
{
    register GM_Instrument	*theI;
    register OPErr			theErr;

    theErr = MEMORY_ERR;
    if ( (instrument >= 0) && (instrument < (MAX_INSTRUMENTS*MAX_BANKS)) )
	{
	    if (pSong)
		{
		    theErr = NO_ERR;

		    theI = pSong->instrumentData[instrument];
		    if (theI)
			{
			    GM_UnloadInstrument(pSong, instrument);
			}
		    theI = PV_GetInstrument(instrument, theX, theXPatchSize);

		    if (theI)
			{
			    theI->usageReferenceCount++;		// increment reference count
			    pSong->instrumentData[instrument] = theI;
			    pSong->remapArray[instrument] = instrument;
			    pSong->instrumentRemap[instrument] = (XLongResourceID)-1;
			}
		    else
			{
			    theErr = BAD_INSTRUMENT;
			}
		}
	    else
		{
		    theErr = NOT_SETUP;
		}
	}
    else
	{
	    theErr = PARAM_ERR;
	}
    return theErr;
}
Пример #5
0
JNIEXPORT jboolean JNICALL
    Java_com_sun_media_sound_AbstractPlayer_nUnloadInstrument(JNIEnv* e, jobject thisObj, jlong id, jint instrumentId)
{
    GM_Song			*pSong = (GM_Song *) (INT_PTR) id;
    OPErr opErr = NOT_SETUP;

    TRACE0("Java_com_sun_media_sound_AbstractPlayer_nUnloadInstrument\n");

    if (pSong) {
	    opErr = GM_UnloadInstrument(pSong, (XLongResourceID)instrumentId);
	    if (opErr != NO_ERR) {
		    ERROR1("Java_com_sun_media_sound_AbstractPlayer_nUnloadInstrument: GM_UnloadInstrument returned an error: %d\n", opErr);
		}
	} else {
	    ERROR0("Java_com_sun_media_sound_AbstractPlayer_nUnloadInstrument: pSong is NULL\n");
	}

    TRACE0("Java_com_sun_media_sound_AbstractPlayer_nUnloadInstrument completed\n");
    return ( (opErr == NO_ERR) ? TRUE : FALSE );
}