Beispiel #1
0
void CSoundDoc::SetChannelMask(SoundResource::DeviceType device, WORD wMask)
{
    WORD wMaskOld = GetSoundResource()->GetChannelMask(device);
    if (wMaskOld != wMask)
    {
        SoundResource *pNewSound = new SoundResource(*GetSoundResource());
        pNewSound->SetChannelMask(device, wMask);
        AddNewResourceToUndo(pNewSound);
        SetModifiedFlag(TRUE);
        UpdateAllViewsAndNonViews(NULL, VIEWUPDATEHINT_SOUNDCHANGED);
    }
}
Beispiel #2
0
bool CSound::LoadSong (ESong Song, int ResourceID)
{
    SDL_RWops *rwSong;

    // Check if the song slot is free
    ASSERT (m_CurrentSong == NULL);

    LPVOID pData;
    DWORD DataSize;

    // If we could not get the sound resource information
    if (!GetSoundResource (ResourceID, pData, DataSize))
    {
        // Get out
        return false;
    }
    
    // Convert pData to SDL_RWops
    rwSong = SDL_RWFromMem(pData, DataSize);
  
    // Open Sample
    m_CurrentSong = Mix_LoadMUS_RW(rwSong);
    SDL_FreeRW(rwSong);
	
    if (!m_CurrentSong) {
        // Log failure
        theLog.WriteLine ("Sound           => !!! Could not load song %d because %s.", ResourceID, Mix_GetError());
        
        // Get out
        return false;
    }
		
    // Everything went right
    return true;
}
Beispiel #3
0
void CSoundDoc::SetCue(size_t index, SoundResource::CuePoint cue)
{
    SoundResource *pNewSound = new SoundResource(*GetSoundResource());
    pNewSound->SetCue(index, cue);
    AddNewResourceToUndo(pNewSound);
    SetModifiedFlag(TRUE);
    UpdateAllViewsAndNonViews(NULL, VIEWUPDATEHINT_SOUNDCUECHANGED);
}
Beispiel #4
0
void CSoundDoc::SetLoopPoint(DWORD dwTicks)
{
    SoundResource *pNewSound = new SoundResource(*GetSoundResource());
    pNewSound->SetLoopPoint(dwTicks);
    AddNewResourceToUndo(pNewSound);
    SetModifiedFlag(TRUE);
    UpdateAllViewsAndNonViews(NULL, VIEWUPDATEHINT_SOUNDCUECHANGED);
}
Beispiel #5
0
void CSoundDoc::SetTempo(WORD wTempo)
{
    if (_wTempo != wTempo)
    {
        _wTempo = wTempo;
        // Special case for tempo - don't make a new sound.  The tempo will change many times a second
        // when the user is sliding the tempo slider.
        SoundResource *pSound = const_cast<SoundResource*>(GetSoundResource());
        pSound->SetTempo(wTempo);
    }
}
Beispiel #6
0
bool CSound::LoadSample (ESample Sample, int ResourceID)
{
    SDL_RWops *rwSample;

    // Check if the sample slot is free
    ASSERT (m_Samples[Sample] == NULL);

    LPVOID pData;
    DWORD DataSize;

    // If we could not get the sound resource information
    if (!GetSoundResource (ResourceID, pData, DataSize))
    {
        // Get out
        return false;
    }
    
    // Convert pData to SDL_RWops
    rwSample = SDL_RWFromMem(pData, DataSize);
  
    // Open Sample
    m_Samples[Sample] = Mix_LoadWAV_RW(rwSample, 0);
    SDL_FreeRW(rwSample);
	
    if (!m_Samples[Sample])
    {
        // Log failure
        theLog.WriteLine ("Sound           => !!! Could not open sample %d because %s", ResourceID, Mix_GetError());
			
        // Get out
        return false;
    }
	
    // Everything went right
    return true;
}
Beispiel #7
0
WORD CSoundDoc::GetChannelMask(SoundResource::DeviceType device) const
{
    return GetSoundResource()->GetChannelMask(device);
}