コード例 #1
0
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
#ifdef FPLAY_ARM
	checkNeonMode();
#endif
	initializeOpenSL();
	initializeEffects();
	initializeMediaCodec();

	JNINativeMethod methodTable[] = {
		{"getProcessorFeatures", "()I", (void*)getProcessorFeatures},
		{"resetFiltersAndWritePosition", "(I)V", (void*)resetFiltersAndWritePosition},
		{"getCurrentAutomaticEffectsGainInMB", "()I", (void*)getCurrentAutomaticEffectsGainInMB},
		{"enableAutomaticEffectsGain", "(I)V", (void*)enableAutomaticEffectsGain},
		{"isAutomaticEffectsGainEnabled", "()I", (void*)isAutomaticEffectsGainEnabled},
		{"enableEqualizer", "(I)V", (void*)enableEqualizer},
		{"isEqualizerEnabled", "()I", (void*)isEqualizerEnabled},
		{"setEqualizerBandLevel", "(II)V", (void*)setEqualizerBandLevel},
		{"setEqualizerBandLevels", "([S)V", (void*)setEqualizerBandLevels},
		{"enableBassBoost", "(I)V", (void*)enableBassBoost},
		{"isBassBoostEnabled", "()I", (void*)isBassBoostEnabled},
		{"setBassBoostStrength", "(I)V", (void*)setBassBoostStrength},
		{"getBassBoostRoundedStrength", "()I", (void*)getBassBoostRoundedStrength},
		{"enableVirtualizer", "(I)V", (void*)enableVirtualizer},
		{"isVirtualizerEnabled", "()I", (void*)isVirtualizerEnabled},
		{"setVirtualizerStrength", "(I)V", (void*)setVirtualizerStrength},
		{"getVirtualizerRoundedStrength", "()I", (void*)getVirtualizerRoundedStrength},
		{"mediaCodecPrepare", "(IJ[J)I", (void*)mediaCodecPrepare},
		{"mediaCodecNextOutputBuffer", "(J)I", (void*)mediaCodecNextOutputBuffer},
		{"mediaCodecSeek", "(JI)J", (void*)mediaCodecSeek},
		{"mediaCodecReleaseOutputBuffer", "(J)V", (void*)mediaCodecReleaseOutputBuffer},
		{"mediaCodecRelease", "(J)V", (void*)mediaCodecRelease},
		{"mediaCodecLoadExternalLibrary", "()I", (void*)mediaCodecLoadExternalLibrary},
		{"openSLInitialize", "()I", (void*)openSLInitialize},
		{"openSLCreate", "(II)I", (void*)openSLCreate},
		{"openSLPlay", "()I", (void*)openSLPlay},
		{"openSLPause", "()I", (void*)openSLPause},
		{"openSLStopAndFlush", "()I", (void*)openSLStopAndFlush},
		{"openSLRelease", "()V", (void*)openSLRelease},
		{"openSLTerminate", "()V", (void*)openSLTerminate},
		{"openSLSetVolumeInMillibels", "(I)V", (void*)openSLSetVolumeInMillibels},
		{"openSLGetHeadPositionInFrames", "()I", (void*)openSLGetHeadPositionInFrames},
		{"openSLCopyVisualizerData", "(J)V", (void*)openSLCopyVisualizerData},
		{"openSLWriteNative", "(JII)I", (void*)openSLWriteNative},
		{"openSLWriteDirect", "(Ljava/nio/ByteBuffer;III)I", (void*)openSLWriteDirect},
		{"openSLWriteArray", "([BIII)I", (void*)openSLWriteArray}
	};
	JNIEnv* env;
	if (vm->GetEnv((void**)&env, JNI_VERSION_1_6) != JNI_OK)
		return -1;
	jclass clazz = env->FindClass("br/com/carlosrafaelgn/fplay/playback/context/MediaContext");
	if (!clazz)
		return -1;
	env->RegisterNatives(clazz, methodTable, sizeof(methodTable) / sizeof(methodTable[0]));
	return JNI_VERSION_1_6;
}
コード例 #2
0
ファイル: vplayer.cpp プロジェクト: manushanga/vrok
void VPlayer::setEffectsList(std::vector<VPEffectPlugin *> list)
{

    control.lock();
	bool wasPlaying = isPlaying();
	float pos = getPosition();
    stop();

    for (int i=0;i<eff_count;i++) {
        effects[i].eff->finit();
        effects[i].active=false;
    }

    if (list.size() > VP_MAX_EFFECTS) {
        DBG("Too much effects!");
        eff_count=0;
        return;
    }

    eff_count=list.size();
    for (int i=0;i<eff_count;i++) {
        effects[i].eff = list[i];
        effects[i].active = true;
    }

    control.unlock();
    // we initialize DSP, this might be reinitialized if the srate and chans
    // are different in the new track, for this function this never happens
    if (currentResource.getURL().size() > 0) {
        initializeEffects();

        VPResource res=currentResource;
        open(res);
		
		pause();
		setPosition(pos);
		
		if (wasPlaying) {
			play();
		}
    }

}
コード例 #3
0
ファイル: effects.c プロジェクト: nventuro/pi-rack
void loadEffectsFromHost(void)
{
	initializeEffects();
	
	uartInit();
	
	char received[500];
	for (int i = 0; i < 500; ++i)
	{
		received[i] = '\0';
	}
	
		
	int write = 0;
	bool done = _FALSE;
	while ((!done) && (write < 500))
	{
		while (!uartIsDataReady())
			;
		
		received[write] = uartRead();
		if (received[write] == ESCAPE_MESSAGE_END)
		{
			done = _TRUE;
		}
		
		write++;
	}
	
	if (write > 500) 
	{
		error("Received message is over 500 characters and contains no ESCAPE_MESSAGE_END character.");
	}

	int read = 0;
	int effect_idx = 0;
	while ((read < write) && (received[read] != ESCAPE_MESSAGE_END))
	{
		// First comes the effect's name
		effects[effect_idx].in_use = _TRUE;
		
		asciiToString(received, &read, effects[effect_idx].name, EFFECT_NAME_LENGTH);
		
		// We're now at the parameters
		
		int param_idx = 0;
		
		while (received[read] != ESCAPE_EFFECT_END)
		{
			// Parameter name
			asciiToString(received, &read, effects[effect_idx].params[param_idx].name, PARAM_NAME_LENGTH);

			// Parameter values, in order: min - regular - max
			effects[effect_idx].params[param_idx].min = asciiToInt2d(received, &read);
			effects[effect_idx].params[param_idx].regular = asciiToInt2d(received, &read);
			effects[effect_idx].params[param_idx].max = asciiToInt2d(received, &read);
			
			// Each parameters starts set at the regular value
			effects[effect_idx].params[param_idx].current = effects[effect_idx].params[param_idx].regular;
			
			effects[effect_idx].params[param_idx].in_use = _TRUE;
			param_idx++;
			
			// We're now at the next parameter (or next effect, or message ending)
		}
		
		effect_idx++;
		
		read++; // Advance to the next effect (or message ending)
	}
	
	numLoadedEffects = effect_idx;
}