Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
1.6.0-bacon2
ProjectView Render item
When in project view, it's now possible to initiate rendering
Interpolate values in tables and phrases
R + B on single-column selection will fill values from lowest to highest

Expand Down
13 changes: 0 additions & 13 deletions docs/LittlePiggyTrackerConf.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
06. [Key and Button Mapping](#key-and-button-mapping)
07. [Auto Repeat](#auto-repeat)
08. [Path](#path)
09. [Rendering](#rendering)
10. [Volume](#volume)
11. [Audio Configuration](#audio-configuration)
12. [MIDI Configuration](#midi-configuration)
Expand Down Expand Up @@ -246,18 +245,6 @@ You can tweak two different path:
</CONFIG>
```

## Rendering

Additionally to playing the song, LittleGPTracker can be used to render the audio to file. To control file rendering, the variable `RENDER` can be set to either `FILE`,`FILESPLIT`,`FILERT`,`FILESPLITRT`. Note that there's a small issue with the speed when using `FILE`/`FILESPLIT` so the xxRT seem like the best choice at the moment
The xxRT options render in real time
The xSPLITx options render separate files for the channels (stems)

```xml
<CONFIG>
<RENDER value='FILERT' />
</CONFIG>
```

## Volume

For \[**GP2X**/**Dingoo**\] only
Expand Down
17 changes: 4 additions & 13 deletions docs/wiki/What-is-LittlePiggyTracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -591,20 +591,11 @@ RTRG 0101: does not do anything because after looping one tick, you move forward
# Rendering

Some people exploit the analog gap between their device's headphone output and whatever they are recording with. Alternately, you can start piggy in rendering mode so it will output 16bit, 44100Hz .WAV files.
Please note that RENDER mode is not intended to be functional on the GP2X Builds.
The following values can set for RENDER in the config.xml:
The following values can set for RENDER in the project view

- Standard mode: audio is played; no render.
- FILE: File rendering: Full speed (no audio) rendering of the stereo mixdown.
- FILESPLIT: File split rendering: Full speed (no audio) rendering of each channel separately.
- FILERT: Real Time file rendering: Renders the mixdown to file WHILE playing audio. This allow to render live mode tweaks directly.
- FILESPLITRT: Real Time file split: same except all channels are rendered separately.

Here is an example of the proper XML syntax: (See [The config.xml setup guide](../LittlePiggyTrackerConf.md))

```xml
<RENDER value = "FILERT" />
```
- Off: audio is played; no render.
- Stereo: Real Time file rendering: Renders the mixdown to file WHILE playing audio. This allow to render live mode tweaks directly.
- Stems: Real Time file split: same except all channels are rendered separately.

Remember, any of the config.xml parameters can be specified to lgpt on the command line in this fashion:

Expand Down
10 changes: 0 additions & 10 deletions docs/wiki/config_xml.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,6 @@ You can tweak two different path:
</CONFIG>
```

## Rendering

Additionally to playing the song, LittleGPTracker can be used to render the audio to file. To control file rendering, the variable RENDER can be set to either FILE,FILESPLIT,FILERT,FILESPLITRT. Note that there's a small issue with the speed when using FILE/FILESPLIT so the xxRT seem like the best choice at the moment

```xml
<CONFIG>
<RENDER value='FILERT'/>
</CONFIG>
```

## Volume

This setting is for GP2X and Dingoo only. It is used to set the volume of the hardware at startup. In decimal (base 10).
Expand Down
1 change: 0 additions & 1 deletion docs/wiki/ubuntu_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ Please remember:

##### Use Piggy as your Midi Sequencer

##### Script piggy to run in render mode from a simple xterm command
156 changes: 70 additions & 86 deletions sources/Application/Mixer/MixerService.cpp
Original file line number Diff line number Diff line change
@@ -1,52 +1,34 @@
#include "MixerService.h"
#include "Application/Audio/DummyAudioOut.h"
#include "Application/Model/Config.h"
#include "Application/Model/Mixer.h"
#include "Application/Model/Project.h"
#include "Services/Audio/Audio.h"
#include "Services/Audio/AudioDriver.h"
#include "Services/Midi/MidiService.h"
#include "System/Console/Trace.h"
#include "Application/Model/Config.h"
#include "Application/Audio/DummyAudioOut.h"
#include "Application/Model/Mixer.h"

MixerService::MixerService():
out_(0),
sync_(0)
{
mode_=MSM_AUDIO ;
const char *render=Config::GetInstance()->GetValue("RENDER") ;
if (render) {
if (!strcmp(render,"FILERT")) {
mode_=MSM_FILERT ;
} ;
if (!strcmp(render,"FILE")) {
mode_=MSM_FILE ;
} ;
if (!strcmp(render,"FILESPLIT")) {
mode_=MSM_FILESPLIT ;
} ;
if (!strcmp(render,"FILESPLITRT")) {
mode_=MSM_FILESPLITRT ;
} ;
} ;
} ;
MixerService::MixerService() : out_(0), sync_(0), isRendering_(false) {
mode_ = MSRM_PLAYBACK;
};

MixerService::~MixerService() {
} ;
MixerService::~MixerService(){};

/*
* initializes the mixer service, config changes depending if we're in sequencer or render mode
*/
bool MixerService::Init() {
// create the output depending on rendering mode
out_ = 0;
// create the output depending on rendering mode
out_ = 0;
switch (mode_) {
case MSM_FILE:
case MSM_FILESPLIT:
out_ = new DummyAudioOut();
break;
default:
Audio *audio = Audio::GetInstance();
out_ = audio->GetFirst();
break;
case MSRM_STEREO:
case MSRM_STEMS:
out_ = new DummyAudioOut();
break;
default:
Audio *audio = Audio::GetInstance();
out_ = audio->GetFirst();
break;
}

for (int i=0;i<MAX_BUS_COUNT;i++) {
Expand All @@ -60,23 +42,8 @@ bool MixerService::Init() {
out_->Insert(master_);
}

switch(mode_) {
case MSM_AUDIO:
break ;
case MSM_FILERT:
case MSM_FILE:
out_->SetFileRenderer("project:mixdown.wav");
break;
case MSM_FILESPLITRT:
case MSM_FILESPLIT:
for (int i=0;i<SONG_CHANNEL_COUNT;i++) {
char buffer[1024] ;
sprintf(buffer,"project:channel%d.wav",i);
bus_[i].SetFileRenderer(buffer);
}
break;
}
out_->AddObserver(*MidiService::GetInstance());
initRendering(mode_);
out_->AddObserver(*MidiService::GetInstance());
}

sync_=SDL_CreateMutex();
Expand All @@ -90,6 +57,23 @@ bool MixerService::Init() {
return (result);
};

void MixerService::initRendering(MixerServiceRenderMode mode) {
switch(mode) {
case MSRM_PLAYBACK:
break;
case MSRM_STEREO:
out_->SetFileRenderer("project:mixdown.wav");
break;
case MSRM_STEMS:
for (int i = 0; i < SONG_CHANNEL_COUNT; i++) {
char buffer[1024];
sprintf(buffer, "project:channel%d.wav", i);
bus_[i].SetFileRenderer(buffer);
}
break;
}
}

void MixerService::Close() {
if (out_) {
out_->RemoveObserver(*MidiService::GetInstance());
Expand All @@ -98,21 +82,13 @@ void MixerService::Close() {
master_.Empty() ;

switch(mode_) {
case MSM_FILE:
case MSM_FILESPLIT:
SAFE_DELETE(out_) ;
break;
default:
break ;
}
switch(mode_) {
case MSM_FILESPLITRT:
case MSM_FILESPLIT:
break;
default:
break ;
}
}
case MSRM_STEMS:
case MSRM_STEREO:
break;
default:
break;
}
}
for (int i=0;i<MAX_BUS_COUNT;i++) {
bus_[i].Empty() ;
}
Expand All @@ -121,11 +97,17 @@ void MixerService::Close() {
sync_=0 ;
} ;

void MixerService::SetRenderMode(int mode) {
mode_ = MixerServiceRenderMode(mode);
}

bool MixerService::IsRendering() { return isRendering_; }

bool MixerService::Start() {
MidiService::GetInstance()->Start() ;
if (out_) {
out_->AddObserver(*this) ;
out_->Start() ;
MidiService::GetInstance()->Start();
if (out_) {
out_->AddObserver(*this);
out_->Start();
}
return true ;
} ;
Expand Down Expand Up @@ -181,20 +163,22 @@ int MixerService::GetPlayedBufferPercentage() {
}

void MixerService::toggleRendering(bool enable) {
switch(mode_) {
case MSM_AUDIO:
break ;
case MSM_FILERT:
case MSM_FILE:
out_->EnableRendering(enable) ;
break ;
case MSM_FILESPLITRT:
case MSM_FILESPLIT:
for (int i=0;i<SONG_CHANNEL_COUNT;i++) {
bus_[i].EnableRendering(enable) ;
} ;
break ;
}
isRendering_ = enable;
switch (mode_) {
case MSRM_PLAYBACK:
initRendering(MSRM_PLAYBACK);
break;
case MSRM_STEREO:
initRendering(MSRM_STEREO);
out_->EnableRendering(enable);
break;
case MSRM_STEMS:
initRendering(MSRM_STEMS);
for (int i = 0; i < SONG_CHANNEL_COUNT; i++) {
bus_[i].EnableRendering(enable);
};
break;
}
}

void MixerService::OnPlayerStart() {
Expand Down
27 changes: 14 additions & 13 deletions sources/Application/Mixer/MixerService.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
#include "Services/Audio/AudioOut.h"
#include "MixBus.h"

enum MixerServiceMode {
MSM_AUDIO,
MSM_FILE,
MSM_FILESPLIT,
MSM_FILERT,
MSM_FILESPLITRT
} ;
enum MixerServiceRenderMode {
MSRM_PLAYBACK,
MSRM_STEREO,
MSRM_STEMS,
};

#define MAX_BUS_COUNT 10

Expand Down Expand Up @@ -51,6 +49,8 @@ class MixerService:
void SetPregain(int);
void SetSoftclip(int, int);
void SetMasterVolume(int);
void SetRenderMode(int);
bool IsRendering();
int GetPlayedBufferPercentage() ;

virtual void Execute(FourCC id,float value) ;
Expand All @@ -63,11 +63,12 @@ class MixerService:
protected:
void toggleRendering(bool enable) ;
private:
AudioOut *out_ ;
MixBus master_ ;
MixBus bus_[MAX_BUS_COUNT] ;
MixerServiceMode mode_ ;
SDL_mutex *sync_ ;

void initRendering(MixerServiceRenderMode);
AudioOut *out_;
MixBus master_;
MixBus bus_[MAX_BUS_COUNT];
MixerServiceRenderMode mode_;
SDL_mutex *sync_;
bool isRendering_;
} ;
#endif
9 changes: 9 additions & 0 deletions sources/Application/Model/Project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ tempoNudge_(0)
new Variable("scale", VAR_SCALE, scaleNames, scaleCount, 0);
this->Insert(scale);
scale->SetInt(0);
Variable *renderMode =
new Variable("renderMode", VAR_RENDER, renderModes, MAX_RENDER_MODE, 0);
this->Insert(renderMode);

// Reload the midi device list

Expand Down Expand Up @@ -110,6 +113,12 @@ int Project::GetPregain() {
return v->GetInt();
}

int Project::GetRenderMode() {
Variable *v = FindVariable(VAR_RENDER);
NAssert(v);
return v->GetInt();
}

void Project::NudgeTempo(int value) {
if((GetTempo() + tempoNudge_) > 0)
tempoNudge_ += value;
Expand Down
9 changes: 6 additions & 3 deletions sources/Application/Model/Project.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define VAR_SOFTCLIP_GAIN MAKE_FOURCC('S', 'F', 'G', 'N')
#define VAR_PREGAIN MAKE_FOURCC('P', 'R', 'G', 'N')
#define VAR_SCALE MAKE_FOURCC('S', 'C', 'A', 'L')
#define VAR_RENDER MAKE_FOURCC('R', 'N', 'D', 'R')

#define PROJECT_NUMBER "1"
#define PROJECT_RELEASE "6"
Expand All @@ -43,9 +44,10 @@ class Project: public Persistent,public VariableContainer,I_Observer {
int GetSoftclip();
int GetSoftclipGain();
int GetPregain();

int GetRenderMode();
void Trigger();

static const unsigned int MAX_RENDER_MODE = 3;
// I_Observer
virtual void Update(Observable &o, I_ObservableData *d);

Expand All @@ -56,14 +58,15 @@ class Project: public Persistent,public VariableContainer,I_Observer {
void LoadFirstGen(const char *root);

protected:
void buildMidiDeviceList() ;
void buildMidiDeviceList();

private:
InstrumentBank *instrumentBank_ ;
char **midiDeviceList_ ;
int midiDeviceListSize_ ;
int tempoNudge_ ;
unsigned long lastTap_[MAX_TAP] ;
unsigned int tempoTapCount_;
} ;
};

#endif
Loading