Exemplo n.º 1
0
void Imuse::setVolume(const char *soundName, int volume) {
	Common::StackLock lock(_mutex);
	Track *changeTrack;

	changeTrack = findTrack(soundName);
	if (changeTrack == NULL) {
		warning("Unable to find track '%s' to change volume", soundName);
		return;
	}
	changeTrack->vol = volume * 1000;
}
Exemplo n.º 2
0
void Imuse::setHookId(const char *soundName, int hookId) {
	Common::StackLock lock(_mutex);
	Track *changeTrack;

	changeTrack = findTrack(soundName);
	if (changeTrack == nullptr) {
		warning("Unable to find track '%s' to change hook id", soundName);
		return;
	}
	changeTrack->curHookId = hookId;
}
Exemplo n.º 3
0
int Imuse::getVolume(const char *soundName) {
	Common::StackLock lock(_mutex);
	Track *getTrack;

	getTrack = findTrack(soundName);
	if (getTrack == nullptr) {
		warning("Unable to find track '%s' to get volume", soundName);
		return 0;
	}
	return getTrack->vol / 1000;
}
Exemplo n.º 4
0
void Imuse::setPan(const char *soundName, int pan) {
	Common::StackLock lock(_mutex);
	Track *changeTrack;

	changeTrack = findTrack(soundName);
	if (changeTrack == nullptr) {
		warning("Unable to find track '%s' to change pan", soundName);
		return;
	}
	changeTrack->pan = pan * 1000;
}
Exemplo n.º 5
0
void Imuse::setPriority(const char *soundName, int priority) {
	Common::StackLock lock(_mutex);
	Track *changeTrack = NULL;
	assert ((priority >= 0) && (priority <= 127));

	changeTrack = findTrack(soundName);
	// Check to make sure we found the track
	if (changeTrack == NULL) {
		warning("Unable to find track '%s' to change priority", soundName);
		return;
	}
	changeTrack->priority = priority;
}
Exemplo n.º 6
0
void Imuse::setFadePan(const char *soundName, int destPan, int duration) {
	Common::StackLock lock(_mutex);
	Track *changeTrack;

	changeTrack = findTrack(soundName);
	if (changeTrack == NULL) {
		warning("Unable to find track '%s' to change fade pan", soundName);
		return;
	}
	changeTrack->panFadeDelay = duration;
	changeTrack->panFadeDest = destPan * 1000;
	changeTrack->panFadeStep = (changeTrack->panFadeDest - changeTrack->pan) * 60 * (1000 / _callbackFps) / (1000 * duration);
	changeTrack->panFadeUsed = true;
}
Exemplo n.º 7
0
void Imuse::setFadeVolume(const char *soundName, int destVolume, int duration) {
	Common::StackLock lock(_mutex);
	Track *changeTrack;

	changeTrack = findTrack(soundName);
	if (changeTrack == nullptr) {
		warning("Unable to find track '%s' to change fade volume", soundName);
		return;
	}
	changeTrack->volFadeDelay = duration;
	changeTrack->volFadeDest = destVolume * 1000;
	changeTrack->volFadeStep = (changeTrack->volFadeDest - changeTrack->vol) * 60 * (1000 / _callbackFps) / (1000 * duration);
	changeTrack->volFadeUsed = true;
}
Exemplo n.º 8
0
void Imuse::stopSound(const char *soundName) {
    Common::StackLock lock(_mutex);
    if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
        printf("Imuse::stopSound(): SoundName %s\n", soundName);
    Track *removeTrack = NULL;

    removeTrack = findTrack(soundName);
    // Warn the user if the track was not found
    if (removeTrack == NULL) {
        if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
            warning("Sound track '%s' could not be found to stop", soundName);
        return;
    }
    flushTrack(removeTrack);
}
Exemplo n.º 9
0
int32 Imuse::getPosIn60HzTicks(const char *soundName) {
    Common::StackLock lock(_mutex);
    Track *getTrack = NULL;

    getTrack = findTrack(soundName);
    // Warn the user if the track was not found
    if (getTrack == NULL) {
        if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
            warning("Sound '%s' could not be found to get ticks", soundName);
        return false;
    }

    int32 pos = (5 * (getTrack->dataOffset + getTrack->regionOffset)) / (getTrack->feedSize / 12);
    return pos;
}
Exemplo n.º 10
0
void Imuse::selectVolumeGroup(const char *soundName, int volGroupId) {
	Common::StackLock lock(_mutex);
	Track *changeTrack;
	assert((volGroupId >= 1) && (volGroupId <= 4));

	if (volGroupId == 4)
		volGroupId = 3;

	changeTrack = findTrack(soundName);
	if (changeTrack == NULL) {
		warning("Unable to find track '%s' to change volume group id", soundName);
		return;
	}
	changeTrack->volGroupId = volGroupId;
}
Exemplo n.º 11
0
void PlaylistModel::shuffle()
{
    if (m_tracks.count() < 2)
    {
        return;
    }

    const KUrl url = m_tracks.value(m_currentTrack);

    KRandomSequence().randomize(m_tracks);

    setCurrentTrack(findTrack(url));

    emit tracksChanged();
    emit modified();
}
Exemplo n.º 12
0
void RemoteConnection_sendDeleteKeyCommand(const char* trackName, int row)
{
	uint32_t track;
	unsigned char cmd = DELETE_KEY;
	int track_id = findTrack(trackName);

	if (!RemoteConnection_connected() || track_id == -1)
		return;

	track = htonl((uint32_t)track_id);
	row = htonl(row);

	RemoteConnection_send((char *)&cmd, 1, 0);
	RemoteConnection_send((char *)&track, sizeof(int), 0);
	RemoteConnection_send((char *)&row,   sizeof(int), 0);
}
Exemplo n.º 13
0
bool Imuse::getSoundStatus(const char *soundName) {
    Common::StackLock lock(_mutex);
    Track *track = NULL;

    // If there's no name then don't try to get the status!
    if (strlen(soundName) == 0)
        return false;

    track = findTrack(soundName);
    // Warn the user if the track was not found
    if (track == NULL || !g_system->getMixer()->isSoundHandleActive(track->handle)) {
        // This debug warning should be "light" since this function gets called
        // on occassion to see if a sound has stopped yet
        if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL)
            printf("Sound '%s' could not be found to get status, assume inactive.\n", soundName);
        return false;
    }
    return true;
}