Skip to content

Commit

Permalink
Frame.cpp/h: Fix a bunch of wrong comments
Browse files Browse the repository at this point in the history
Best reason not to narrate the code in the comments: The code gets
changed, but the documentation doesn't.
  • Loading branch information
ferdnyc committed Aug 21, 2020
1 parent 3c2532b commit c14922d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
12 changes: 6 additions & 6 deletions include/Frame.h
Expand Up @@ -73,17 +73,17 @@ namespace openshot
* There are many ways to create an instance of an openshot::Frame:
* @code
*
* // Most basic: a blank frame (300x200 blank image, 48kHz audio silence)
* // Most basic: a blank frame (all default values)
* Frame();
*
* // Image only settings (48kHz audio silence)
* // Image only settings
* Frame(1, // Frame number
* 720, // Width of image
* 480, // Height of image
* "#000000" // HTML color code of background color
* );
*
* // Audio only (300x200 blank image)
* // Audio only
* Frame(number, // Frame number
* 44100, // Sample rate of audio stream
* 2 // Number of audio channels
Expand Down Expand Up @@ -131,13 +131,13 @@ namespace openshot
bool has_image_data; ///< This frame has been loaded with pixel data


/// Constructor - blank frame (300x200 blank image, 48kHz audio silence)
/// Constructor - blank frame
Frame();

/// Constructor - image only (48kHz audio silence)
/// Constructor - image only
Frame(int64_t number, int width, int height, std::string color);

/// Constructor - audio only (300x200 blank image)
/// Constructor - audio only
Frame(int64_t number, int samples, int channels);

/// Constructor - image & audio
Expand Down
22 changes: 7 additions & 15 deletions src/Frame.cpp
Expand Up @@ -33,41 +33,35 @@
using namespace std;
using namespace openshot;

// Constructor - blank frame (300x200 blank image, 48kHz audio silence)
// Constructor - blank frame
Frame::Frame() : number(1), pixel_ratio(1,1), channels(2), width(1), height(1), color("#000000"),
channel_layout(LAYOUT_STEREO), sample_rate(44100), qbuffer(NULL), has_audio_data(false), has_image_data(false),
max_audio_sample(0)
{
// Init the image magic and audio buffer
// Allocate and zero (fill with silence) the audio buffer
audio = std::make_shared<juce::AudioSampleBuffer>(channels, 0);

// initialize the audio samples to zero (silence)
audio->clear();
}

// Constructor - image only (48kHz audio silence)
// Constructor - image only
Frame::Frame(int64_t number, int width, int height, std::string color)
: number(number), pixel_ratio(1,1), channels(2), width(width), height(height), color(color),
channel_layout(LAYOUT_STEREO), sample_rate(44100), qbuffer(NULL), has_audio_data(false), has_image_data(false),
max_audio_sample(0)
{
// Init the image magic and audio buffer
// Allocate and zero (fill with silence) the audio buffer
audio = std::make_shared<juce::AudioSampleBuffer>(channels, 0);

// initialize the audio samples to zero (silence)
audio->clear();
}

// Constructor - audio only (300x200 blank image)
// Constructor - audio only
Frame::Frame(int64_t number, int samples, int channels) :
number(number), pixel_ratio(1,1), channels(channels), width(1), height(1), color("#000000"),
channel_layout(LAYOUT_STEREO), sample_rate(44100), qbuffer(NULL), has_audio_data(false), has_image_data(false),
max_audio_sample(0)
{
// Init the image magic and audio buffer
// Allocate and zero (fill with silence) the audio buffer
audio = std::make_shared<juce::AudioSampleBuffer>(channels, samples);

// initialize the audio samples to zero (silence)
audio->clear();
}

Expand All @@ -77,10 +71,8 @@ Frame::Frame(int64_t number, int width, int height, std::string color, int sampl
channel_layout(LAYOUT_STEREO), sample_rate(44100), qbuffer(NULL), has_audio_data(false), has_image_data(false),
max_audio_sample(0)
{
// Init the image magic and audio buffer
// Allocate and zero (fill with silence) the audio buffer
audio = std::make_shared<juce::AudioSampleBuffer>(channels, samples);

// initialize the audio samples to zero (silence)
audio->clear();
}

Expand Down

0 comments on commit c14922d

Please sign in to comment.