Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Saving progress
Browse files Browse the repository at this point in the history
  • Loading branch information
adct-the-experimenter committed Jul 4, 2019
1 parent 739c50d commit 784a6e0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
2 changes: 2 additions & 0 deletions include/soundproducer-track.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class SoundProducerTrack : public Track

wxComboBox* GetReferenceToComboBox();

//audio track related functions
void SetupAxisForAudio(double& start, double& end,double& resolution, int& numTick);
void SetReferenceToPlaybackControls(PlaybackControls* controls);

//Double Track related functions
void SetupAxisForVariable(double& start, double& end, double& resolution, int& numTick);
Expand Down
3 changes: 2 additions & 1 deletion include/soundproducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class SoundProducer
void setBuffer(ALuint& thisSource);
ALuint* getBuffer();

void CreateSourceFromBuffer(); //function to use openal soft audio engine to create source from buffer
//function to use openal soft audio engine to create source from buffer
void CreateSource();

void setSource(ALuint& thisBuffer);
ALuint* getSource();
Expand Down
2 changes: 2 additions & 0 deletions src/osgViewerWX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ MainFrame::MainFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
wxButton* browseButton = new wxButton(timeFrame->GetTimelineWindow(), wxID_ANY, wxT("Browse"), wxDefaultPosition, wxSize(70, 30) );
m_soundproducer_track_vec[0]->GetReferenceToStereoAudioTrack()->SetReferenceToBrowseButton(browseButton);
m_soundproducer_track_vec[0]->GetReferenceToStereoAudioTrack()->InitTrack(timeFrame->GetTimelineWindow(),nullptr);
m_soundproducer_track_vec.at(0)->SetReferenceToPlaybackControls(timeFrame->GetPlaybackControlsReference());

//initialize double tracks
m_soundproducer_track_vec[0]->SetupAxisForVariable(start,end,resolution,numTicks); //setup bounds for vertical axes
Expand Down Expand Up @@ -510,6 +511,7 @@ void MainFrame::CreateNewSoundProducerTrack()

//initialize sound producer track stuff
m_soundproducer_track_vec.at(m_soundproducer_track_vec.size()-1)->InitTrack(timeFrame->GetTimelineWindow(),nullptr);
m_soundproducer_track_vec.at(m_soundproducer_track_vec.size()-1)->SetReferenceToPlaybackControls(timeFrame->GetPlaybackControlsReference());

//initialize audio track
wxButton* browseButton = new wxButton(timeFrame->GetTimelineWindow(), wxID_ANY, wxT("Browse"), wxDefaultPosition, wxSize(70, 30) );
Expand Down
7 changes: 6 additions & 1 deletion src/soundproducer-track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void SoundProducerTrack::FunctionToCallInNullState()
{
if(soundProducerToManipulatePtr != nullptr)
{
if(*(soundProducerToManipulatePtr->getSource()) != 0)
if(soundProducerToManipulatePtr->getSource() != nullptr)
{
audioTrack->FunctionToCallInNullState();
}
Expand Down Expand Up @@ -160,6 +160,11 @@ void SoundProducerTrack::SetupAxisForAudio(double& start, double& end,double& re
audioTrack->SetupAxisForVariable(start,end,resolution,numTick);
}

void SoundProducerTrack::SetReferenceToPlaybackControls(PlaybackControls* controls)
{
audioTrack->SetReferenceToPlaybackControls(controls);
}

void SoundProducerTrack::OnPaint(wxPaintEvent& event)
{
wxPaintDC dc(this);
Expand Down
18 changes: 11 additions & 7 deletions src/soundproducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@

SoundProducer::SoundProducer()
{
//intialize source
SoundProducer::CreateSource();

//initialize buffer as empty
m_buffer = 0;
m_source = 0;

//initialize position vector
producer_position_vector.resize(3);
producer_position_vector[POSITION_INDEX::X] = 0;
producer_position_vector[POSITION_INDEX::Y] = 0;
producer_position_vector[POSITION_INDEX::Z] = 0;


}

SoundProducer::~SoundProducer()
Expand Down Expand Up @@ -44,8 +48,10 @@ void SoundProducer::InitSoundProducer(std::string& thisName,std::string& filepat
name = thisName;
m_filepath = filepath;

m_buffer = buffer;
SoundProducer::CreateSourceFromBuffer();
if(buffer != 0)
{
SoundProducer::setBuffer(buffer);
}

//set position
producer_position_vector[POSITION_INDEX::X] = x;
Expand Down Expand Up @@ -147,14 +153,12 @@ void SoundProducer::setBuffer(ALuint& thisBuffer)
}
ALuint* SoundProducer::getBuffer(){return &m_buffer;}

void SoundProducer::CreateSourceFromBuffer()
void SoundProducer::CreateSource()
{
alGenSources(1, &m_source);
alSourcei(m_source, AL_SOURCE_RELATIVE, AL_TRUE);
alSourcei(m_source, AL_BUFFER, m_buffer);
assert(alGetError()==AL_NO_ERROR && "Failed to setup sound source.");

moveSource(); //move source to proper location based on current position vector
}

void SoundProducer::setSource(ALuint& thisSource){m_source = thisSource;}
Expand Down
2 changes: 1 addition & 1 deletion src/timeline-track-editor/src/openalsoft-player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ int OpenALSoftPlayer::StartPlayer(ALuint* source, double& current_time)
//std::cout << "In start player!\n";

size_t i;

/* Rewind the source position and clear the buffer queue */
alSourceRewind(*source);
alSourcei(*source, AL_BUFFER, 0);
Expand Down

0 comments on commit 784a6e0

Please sign in to comment.