1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-04 04:50:22 +00:00

Fix comment typos

This commit is contained in:
Samuel Gomes 2023-12-29 15:27:27 +05:30
parent d8cb77e2d1
commit c2bdb61c4a
4 changed files with 35 additions and 37 deletions

View file

@ -77,7 +77,7 @@ bool filepath_has_extension(const char *path, const char *extension) {
}
/// @brief Changes the slashes in a file name / path to make it compatible with the OS
/// @param path The path to fix (this contents may be changed)
/// @param path The path to fix (contents may be changed)
/// @return Returns the C-string for convenience
const char *filepath_fix_directory(char *path) {
auto len = strlen(path);
@ -96,7 +96,7 @@ const char *filepath_fix_directory(char *path) {
}
/// @brief Changes the slashes in a file name / path to make it compatible with the OS
/// @param path The path to fix (this contents may be changed)
/// @param path The path to fix (contents may be changed)
/// @return Returns the C-string for convenience
const char *filepath_fix_directory(qbs *path) {
for (size_t i = 0; i < path->len; i++) {
@ -113,7 +113,7 @@ const char *filepath_fix_directory(qbs *path) {
}
/// @brief Changes the slashes in a file name / path to make it compatible with the OS
/// @param path The path to fix (this contents may be changed)
/// @param path The path to fix (contents may be changed)
/// @return Returns the C-string for convenience
const char *filepath_fix_directory(std::string &path) {
std::transform(path.begin(), path.end(), path.begin(), [](unsigned char c) {

View file

@ -85,7 +85,7 @@ struct RawStream {
libqb_mutex *m; // we'll use a mutex to give exclusive access to resources used by both threads
bool stop; // set this to true to stop supply of samples completely (including silent samples)
static const size_t DEFAULT_SIZE = 1024; // this is almost twice the amout what miniaudio actually asks for in frameCount
static const size_t DEFAULT_SIZE = 1024; // this is almost twice the amount what miniaudio actually asks for in frameCount
// Delete default, copy and move constructors and assignments
RawStream() = delete;
@ -116,7 +116,7 @@ struct RawStream {
libqb_mutex_guard lock(m); // lock the mutex before accessing the vectors
consumer->cursor = 0; // reset the cursor
consumer->data.clear(); // clear the consumer vector
std::swap(consumer, producer); // quicky swap the Buffer pointers
std::swap(consumer, producer); // quickly swap the Buffer pointers
}
/// @brief This pushes a sample frame at the end of the queue. This is mutex protected and called by the main thread
@ -253,7 +253,7 @@ static ma_data_source_vtable rawStreamDataSourceVtable = {
/// @brief This creates, initializes and sets up a raw stream for playback
/// @param pmaEngine This should come from the QBPE sound engine
/// @param pmaSound This should come from a QBPE sound handle
/// @return Returns a pointer to a data souce if successful, NULL otherwise
/// @return Returns a pointer to a data source if successful, NULL otherwise
static RawStream *RawStreamCreate(ma_engine *pmaEngine, ma_sound *pmaSound) {
if (!pmaEngine || !pmaSound) { // these should not be NULL
AUDIO_DEBUG_PRINT("Invalid arguments");
@ -285,7 +285,7 @@ static RawStream *RawStreamCreate(ma_engine *pmaEngine, ma_sound *pmaSound) {
result = ma_sound_init_from_data_source(pmaEngine, &pRawStream->maDataSource, MA_SOUND_FLAG_NO_PITCH | MA_SOUND_FLAG_NO_SPATIALIZATION, NULL,
pmaSound); // attach data source to the ma_sound
if (result != MA_SUCCESS) {
AUDIO_DEBUG_PRINT("Error %i: failed to initalize sound from data source", result);
AUDIO_DEBUG_PRINT("Error %i: failed to initialize sound from data source", result);
delete pRawStream;
@ -421,7 +421,7 @@ class BufferMap {
}
};
/// @brief This is a PSG class that handles all kinds of sound generatation for BEEP, SOUND and PLAY
/// @brief This is a PSG class that handles all kinds of sound generation for BEEP, SOUND and PLAY
class PSG {
public:
/// @brief Various types of waveform that can be generated
@ -494,7 +494,7 @@ class PSG {
auto neededFrames = (ma_uint64)(waveDuration * rawStream->sampleRate);
if (!neededFrames || maWaveform.config.frequency >= 20000 || mixCursor + neededFrames > waveBuffer.size()) {
AUDIO_DEBUG_PRINT("Not generating any wavefrom. Frames = %llu, frequency = %lf, cursor = %llu", neededFrames, maWaveform.config.frequency,
AUDIO_DEBUG_PRINT("Not generating any waveform. Frames = %llu, frequency = %lf, cursor = %llu", neededFrames, maWaveform.config.frequency,
mixCursor);
return; // nothing to do
}
@ -1534,7 +1534,7 @@ struct AudioEngine {
soundHandles[handle]->isUsed = false;
soundHandles[handle]->type = SoundHandle::Type::NONE;
// Save the free hanndle to lowestFreeHandle if it is lower than lowestFreeHandle
// Save the free handle to lowestFreeHandle if it is lower than lowestFreeHandle
if (handle < lowestFreeHandle)
lowestFreeHandle = handle;
@ -1652,7 +1652,7 @@ void sub_play(const qbs *str) {
/// <summary>
/// This returns the sample rate from ma engine if ma is initialized.
/// </summary>
/// <returns>miniaudio sample rtate</returns>
/// <returns>miniaudio sample rate</returns>
int32_t func__sndrate() { return audioEngine.sampleRate; }
/// @brief Creates a ma_decoder and ma_sound from a memory buffer for a valid sound handle
@ -1720,7 +1720,7 @@ int32_t func__sndopen(qbs *fileName, qbs *requirements, int32_t passed) {
if (!reqs)
reqs = qbs_new(0, 0);
// Alocate a sound handle
// Allocate a sound handle
int32_t handle = audioEngine.CreateHandle();
if (handle < 1) // We are not expected to open files with handle 0
return INVALID_SOUND_HANDLE;
@ -1732,7 +1732,7 @@ int32_t func__sndopen(qbs *fileName, qbs *requirements, int32_t passed) {
if (passed && requirements->len)
qbs_set(reqs, qbs_ucase(requirements)); // Convert tmp str to perm str
// Set the flags to specifiy how we want the audio file to be opened
// Set the flags to specify how we want the audio file to be opened
if (passed && requirements->len && func_instr(1, reqs, qbs_new_txt(REQUIREMENT_STRING_STREAM), 1)) {
audioEngine.soundHandles[handle]->maFlags |= MA_SOUND_FLAG_STREAM; // Check if the user wants to stream the file
AUDIO_DEBUG_PRINT("Sound will stream");
@ -1780,7 +1780,7 @@ void sub__sndclose(int32_t handle) {
if (audioEngine.isInitialized && IS_SOUND_HANDLE_VALID(handle)) {
// If we have a raw stream then force it to push all it's data to miniaudio
// Note that this will take care of checking if the handle is a raw steam and other stuff
// So it is completly safe to call it this way
// So it is completely safe to call it this way
sub__sndrawdone(handle, true);
if (audioEngine.soundHandles[handle]->type == SoundHandle::Type::RAW)
@ -1824,7 +1824,7 @@ int32_t func__sndcopy(int32_t src_handle) {
} else if (audioEngine.soundHandles[src_handle]->maDecoder) {
AUDIO_DEBUG_PRINT("Doing custom sound copy for ma_decoder");
dst_handle = audioEngine.CreateHandle(); // alocate a sound handle
dst_handle = audioEngine.CreateHandle(); // allocate a sound handle
if (dst_handle < 1)
return INVALID_SOUND_HANDLE;
@ -1845,7 +1845,7 @@ int32_t func__sndcopy(int32_t src_handle) {
} else {
AUDIO_DEBUG_PRINT("Doing regular miniaudio sound copy");
dst_handle = audioEngine.CreateHandle(); // alocate a sound handle
dst_handle = audioEngine.CreateHandle(); // allocate a sound handle
if (dst_handle < 1)
return INVALID_SOUND_HANDLE;
@ -2180,7 +2180,7 @@ int32_t func__sndopenraw() {
if (!audioEngine.isInitialized)
return INVALID_SOUND_HANDLE;
// Alocate a sound handle
// Allocate a sound handle
int32_t handle = audioEngine.CreateHandle();
if (handle < 1)
return INVALID_SOUND_HANDLE;
@ -2413,7 +2413,7 @@ mem_block func__memsound(int32_t handle, int32_t targetChannel, int32_t passed)
AUDIO_DEBUG_PRINT("Format = %u, channels = %u, frames = %llu", maFormat, channels, sampleFrames);
// Setup type: This was not done in the old code
// But we are doing it here. By examing the type the user can now figure out if they have to use FP32 or integers
// But we are doing it here. By examining the type the user can now figure out if they have to use FP32 or integers
switch (maFormat) {
case ma_format::ma_format_f32:
mb.type = 4 + 256; // FP32
@ -2495,7 +2495,7 @@ void snd_init() {
// Get and save the engine sample rate. We will let miniaudio choose the device sample rate for us
// This ensures we get the lowest latency
// Set the resource manager decorder sample rate to the device sample rate (miniaudio engine bug?)
// Set the resource manager decoder sample rate to the device sample rate (miniaudio engine bug?)
audioEngine.maResourceManager.config.decodedSampleRate = audioEngine.sampleRate = ma_engine_get_sample_rate(&audioEngine.maEngine);
// Set the initialized flag as true

View file

@ -189,13 +189,13 @@ struct FontManager {
FT_Face face; // FreeType face object
FT_Pos monospaceWidth; // the monospace width (if font was loaded as monospace, else zero)
FT_Pos defaultHeight; // default (max) pixel height the user wants
FT_Pos baseline; // font baeline in pixels
FT_Pos baseline; // font baseline in pixels
int32_t options; // fonts options that were passed by QB64 while loading the font
/// @brief Manages a single glyph in a font
struct Glyph {
// Usually the bitmap size & metrics returned by FT for mono and gray can be the same
// But it's a bad idea to assume that is the case everytime
// But it's a bad idea to assume that is the case every time
struct Bitmap {
uint8_t *data; // pointer to the raw pixels
FT_Vector size; // bitmap width & height in pixels
@ -205,7 +205,7 @@ struct FontManager {
FT_UInt index; // glyph index
Bitmap bmpMono; // monochrome bitmap in 8-bit format
Bitmap bmpGray; // anti-aliased bitamp in 8-bit format
Bitmap bmpGray; // anti-aliased bitmap in 8-bit format
Bitmap *bitmap; // pointer to the currently selected bitmap (mono / gray)
// Delete copy and move constructors and assignments
@ -435,7 +435,7 @@ struct FontManager {
auto newGlyph = new Glyph;
if (!newGlyph) {
FONT_DEBUG_PRINT("Failed to allocate mmemory");
FONT_DEBUG_PRINT("Failed to allocate memory");
return nullptr; // failed to allocate memory
}
@ -573,7 +573,7 @@ struct FontManager {
if (h >= vectorSize) {
// Scan through the entire vector and return a slot that is not being used
// Ideally this should execute in extremely few (if at all) senarios
// Ideally this should execute in extremely few (if at all) scenarios
// Also, this loop should not execute if size is 0
for (h = 0; h < vectorSize; h++) {
if (!fonts[h]->isUsed) {
@ -1025,7 +1025,7 @@ int32_t func__UFontHeight(int32_t qb64_fh, int32_t passed) {
qb64_fh = write_page->font; // else get the current write page font handle
}
// For buint-in fonts return the handle value (which is = font height)
// For built-in fonts return the handle value (which is = font height)
if (qb64_fh < 32)
return qb64_fh;
@ -1041,7 +1041,7 @@ int32_t func__UFontHeight(int32_t qb64_fh, int32_t passed) {
return fnt->defaultHeight;
}
/// @brief Returns the text widht in pixels
/// @brief Returns the text width in pixels
/// @param text The text to calculate the width for
/// @param utf_encoding The UTF encoding of the text (0 = ASCII, 8 = UTF-8, 16 - UTF-16, 32 = UTF-32)
/// @param qb64_fh A QB64 font handle (this can be a builtin font as well)
@ -1129,7 +1129,7 @@ int32_t func__ULineSpacing(int32_t qb64_fh, int32_t passed) {
qb64_fh = write_page->font; // else get the current write page font handle
}
// For buint-in fonts return the handle value (which is = font height)
// For built-in fonts return the handle value (which is = font height)
if (qb64_fh < 32)
return qb64_fh;
@ -1464,7 +1464,7 @@ void sub__UPrintString(int32_t start_x, int32_t start_y, const qbs *text, int32_
free(drawBuf);
}
/// @brief Calculate the starting pixel positions of each chancter to an array. First one being zero.
/// @brief Calculate the starting pixel positions of each codepoint to an array. First one being zero.
/// This also calculates the pixel position of the last + 1 character.
/// @param text Text for which the data needs to be calculated. This can be unicode encoded
/// @param arr A QB64 LONG array. This should be codepoints + 1 long. If the array is shorter additional calculated data is ignored

View file

@ -294,7 +294,7 @@ static uint32_t *image_qoi_load_from_memory(const uint8_t *buffer, size_t size,
return pixels;
}
/// @brief Decodes an image file freom a file using the dr_pcx & stb_image libraries.
/// @brief Decodes an image file from a file using the dr_pcx & stb_image libraries.
/// @param fileName A valid filename
/// @param xOut Out: width in pixels. This cannot be NULL
/// @param yOut Out: height in pixels. This cannot be NULL
@ -386,7 +386,7 @@ static inline uint8_t image_clamp_component(int32_t n) { return n < 0 ? 0 : n >
/// @brief This takes in a 32bpp (BGRA) image raw data and spits out an 8bpp raw image along with it's 256 color (BGRA) palette.
/// @param src32 The source raw image data. This must be in BGRA format and not NULL
/// @param w The widht of the image in pixels
/// @param w The width of the image in pixels
/// @param h The height of the image in pixels
/// @param paletteOut A 256 color palette if the operation was successful. This cannot be NULL
/// @return A pointer to a 8bpp raw image or NULL if operation failed
@ -448,7 +448,7 @@ static uint8_t *image_convert_8bpp(const uint32_t *src32, int32_t w, int32_t h,
/// If the number of unique colors in the 32bpp image > 256, then the functions returns a NULL.
/// Unlike image_convert_8bpp(), no 'real' conversion takes place.
/// @param src The source raw image data. This must be in BGRA format and not NULL
/// @param w The widht of the image in pixels
/// @param w The width of the image in pixels
/// @param h The height of the image in pixels
/// @param paletteOut A 256 color palette if the operation was successful. This cannot be NULL
/// @return A pointer to a 8bpp raw image or NULL if operation failed
@ -545,7 +545,7 @@ static inline uint32_t image_swap_red_blue(uint32_t clr) { return ((clr & 0xFF00
/// @brief This function loads an image into memory and returns valid LONG image handle values that are less than -1
/// @param qbsFileName The filename or memory buffer (see requirements below) of the image
/// @param bpp 32 = 32bpp, 33 = 32bpp (hardware acclerated), 256=8bpp or 257=8bpp (without palette remap)
/// @param bpp 32 = 32bpp, 33 = 32bpp (hardware accelerated), 256=8bpp or 257=8bpp (without palette remap)
/// @param qbsRequirements A qbs that can contain one or more of: hardware, memory, adaptive
/// @param passed How many parameters were passed?
/// @return Valid LONG image handle values that are less than -1 or -1 on failure
@ -594,8 +594,6 @@ int32_t func__loadimage(qbs *qbsFileName, int32_t bpp, qbs *qbsRequirements, int
IMAGE_DEBUG_PRINT("Parsing requirements string: %s", requirements.c_str());
// requirements.find(REQUIREMENT_STRING_MEMORY) != std::string::npos
if (requirements.find("HARDWARE") != std::string::npos && bpp == 32) {
isHardwareImage = true;
IMAGE_DEBUG_PRINT("Hardware image selected");
@ -718,7 +716,7 @@ int32_t func__loadimage(qbs *qbsFileName, int32_t bpp, qbs *qbsRequirements, int
/// @param qbsFileName The file path name to save to
/// @param imageHandle Optional: The image handle. If omitted, then this is _DISPLAY()
/// @param qbsRequirements Optional: Extra format and setting arguments
/// @param passed Argument bitmask
/// @param passed Optional parameters
void sub__saveimage(qbs *qbsFileName, int32_t imageHandle, qbs *qbsRequirements, int32_t passed) {
enum struct SaveFormat { PNG = 0, QOI, BMP, TGA, JPG, HDR };
static const char *formatName[] = {"png", "qoi", "bmp", "tga", "jpg", "hdr"};
@ -890,7 +888,7 @@ void sub__saveimage(qbs *qbsFileName, int32_t imageHandle, qbs *qbsRequirements,
pixels.resize(width * height);
if (img[imageHandle].bits_per_pixel == 32) { // BGRA pixels
IMAGE_DEBUG_PRINT("Coverting BGRA surface to RGBA");
IMAGE_DEBUG_PRINT("Converting BGRA surface to RGBA");
auto p = img[imageHandle].offset32;
@ -899,7 +897,7 @@ void sub__saveimage(qbs *qbsFileName, int32_t imageHandle, qbs *qbsRequirements,
++p;
}
} else { // indexed pixels
IMAGE_DEBUG_PRINT("Coverting BGRA indexed surface to RGBA");
IMAGE_DEBUG_PRINT("Converting BGRA indexed surface to RGBA");
auto p = img[imageHandle].offset;
for (size_t i = 0; i < pixels.size(); i++) {