From d94e85e26ee8b2f86102ee468c26b6fc78c72b00 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Tue, 17 Sep 2024 22:11:32 -0700 Subject: [PATCH] Sound pause/unpause Magic API functions... ...plus documenting them. ...plus using them in new "Comic Dots" Magic tool. --- Makefile | 4 +-- docs/CHANGES.txt | 8 +++++ docs/en/MAGIC-API.txt | 50 +++++++++++++++++++++++---- docs/en/README.txt | 8 ++++- docs/en/html/MAGIC-API.html | 51 +++++++++++++++++++++++----- docs/en/html/README.html | 3 ++ docs/es_ES.UTF-8/MAGIC-API.txt | 50 +++++++++++++++++++++++---- docs/es_ES.UTF-8/README.txt | 8 ++++- docs/es_ES.UTF-8/html/MAGIC-API.html | 51 +++++++++++++++++++++++----- docs/es_ES.UTF-8/html/README.html | 3 ++ docs/fr_FR.UTF-8/MAGIC-API.txt | 50 +++++++++++++++++++++++---- docs/fr_FR.UTF-8/README.txt | 8 ++++- docs/fr_FR.UTF-8/html/MAGIC-API.html | 51 +++++++++++++++++++++++----- docs/fr_FR.UTF-8/html/README.html | 3 ++ docs/gl_ES.UTF-8/MAGIC-API.txt | 50 +++++++++++++++++++++++---- docs/gl_ES.UTF-8/README.txt | 8 ++++- docs/gl_ES.UTF-8/html/MAGIC-API.html | 51 +++++++++++++++++++++++----- docs/gl_ES.UTF-8/html/README.html | 3 ++ docs/is_IS.UTF-8/MAGIC-API.txt | 50 +++++++++++++++++++++++---- docs/is_IS.UTF-8/README.txt | 8 ++++- docs/is_IS.UTF-8/html/MAGIC-API.html | 51 +++++++++++++++++++++++----- docs/is_IS.UTF-8/html/README.html | 3 ++ docs/ja_JP.UTF-8/MAGIC-API.txt | 50 +++++++++++++++++++++++---- docs/ja_JP.UTF-8/README.txt | 8 ++++- docs/ja_JP.UTF-8/html/MAGIC-API.html | 51 +++++++++++++++++++++++----- docs/ja_JP.UTF-8/html/README.html | 3 ++ docs/sq_AL.UTF-8/MAGIC-API.txt | 50 +++++++++++++++++++++++---- docs/sq_AL.UTF-8/README.txt | 8 ++++- docs/sq_AL.UTF-8/html/MAGIC-API.html | 51 +++++++++++++++++++++++----- docs/sq_AL.UTF-8/html/README.html | 3 ++ magic/src/comicdot.c | 17 +++++----- src/tp_magic_api.h.in | 10 ++++++ src/tuxpaint.c | 29 ++++++++++++++++ 33 files changed, 723 insertions(+), 129 deletions(-) diff --git a/Makefile b/Makefile index da2a347c2..6c51e1387 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ # Various contributors (see AUTHORS.txt) # https://tuxpaint.org/ -# June 14, 2002 - September 16, 2024 +# June 14, 2002 - September 17, 2024 # The version number, for release: @@ -26,7 +26,7 @@ else VER_DATE=$(shell date "+%Y-%m-%d") endif -MAGIC_API_VERSION:=0x0000000A +MAGIC_API_VERSION:=0x0000000B # Need to know the OS SYSNAME:=$(shell uname -s) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 32031b366..047c70029 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -18,6 +18,14 @@ https://tuxpaint.org/ - TODO needs icon Closes https://sourceforge.net/p/tuxpaint/feature-requests/257/ + * Magic Tool Improvements: + ------------------------ + * Sound pause/resume functions added to API + (`playingsound()`, `pausesound()`, and `unpausesound()`). + + Used by new "Comic Docs" magic tool. + + Note: `TP_MAGIC_API_VERSION` bumped to 0x0000000B. + + Bill Kendrick + * Improvements to Fill tool: -------------------------- * New "Eraser" flood fill mode, to expose the background diff --git a/docs/en/MAGIC-API.txt b/docs/en/MAGIC-API.txt index 6ba3a4e75..526a8d2f2 100644 --- a/docs/en/MAGIC-API.txt +++ b/docs/en/MAGIC-API.txt @@ -6,7 +6,7 @@ Copyright © 2007-2024 by various contributors; see AUTHORS.txt. https://tuxpaint.org/ - June 1, 2024 + September 17, 2024 +--------------------------------------------------+ | Table of Contents | @@ -22,6 +22,7 @@ | o Pixel Manipulations | | o Helper Functions | | o Informational | +| o Sound Functions | | o Tux Paint System Calls | | o Color Conversions | | + Helper Macros in "tp_magic_api.h" | @@ -640,12 +641,7 @@ char * data_directory -Tux Paint System Calls - -void update_progress_bar(void) - Asks Tux Paint to animate and draw one frame of its progress bar (at the - bottom of the screen). Useful for routines that may take a long time, to - provide feedback to the user that Tux Paint has not crashed or frozen. +Sound Functions void playsound(Mix_Chunk * snd, int pan, int dist) @@ -670,6 +666,46 @@ void stopsound(void) silence effects when the user stops using the tool (in your 'release' function). +int playingsound(void) + + Call this function to determine whether a magic tool sound effect is still + currently playing. Can be used by magic tools that pause and unpause their + sounds (see below) to determine whether it's time to start a new sound — + call playsound() instead of unpausesound(). A '1' is returned if a sound is + playing; '0' otherwise. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + +void pausesound(void) + + Pauses the magic tool sound effect; it may be unpaused to resume playing. + Useful when a magic tool sound is very long; avoid repeatedly playing just + a short clip of the beginning when the user draws small strokes by starting + (playsound()) and stopping (stopsound()) the sound. Use playingsound() to + determine whether you can unpause or must play from the start. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + +void unpausesound(void) + + Resumes a paused magic tool sound effect, if one was playing. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + + +Tux Paint System Calls + +void update_progress_bar(void) + Asks Tux Paint to animate and draw one frame of its progress bar (at the + bottom of the screen). Useful for routines that may take a long time, to + provide feedback to the user that Tux Paint has not crashed or frozen. + void special_notify(int flag) This function notifies Tux Paint of special events. Various values defined in "tp_magic_api.h" can be 'or'ed together (using C's boolean 'or': "|") diff --git a/docs/en/README.txt b/docs/en/README.txt index 534245513..c28e81871 100644 --- a/docs/en/README.txt +++ b/docs/en/README.txt @@ -6,7 +6,7 @@ Copyright © 2002-2024 by various contributors; see AUTHORS.txt. https://tuxpaint.org/ - September 16, 2024 + September 17, 2024 +-------------------------------------------------+ | Table of Contents | @@ -105,6 +105,12 @@ D. What's New in Tux Paint version 0.9.34? New brushes New brushes for the Paint and Lines tools: Fluff (gradient). +New Magic tool: Comic dots + Draws a repeating dot pattern, simulating the "Ben Day process" used in + early comic books. + +Magic API Updates + Sound pause and resume functions added. See CHANGES.txt for the complete list of changes. diff --git a/docs/en/html/MAGIC-API.html b/docs/en/html/MAGIC-API.html index b12089423..f32044480 100644 --- a/docs/en/html/MAGIC-API.html +++ b/docs/en/html/MAGIC-API.html @@ -102,7 +102,7 @@

- June 1, 2024

+ September 17, 2024

@@ -128,7 +128,7 @@
  • Tux Paint Functions and Data +
  • Pixel Manipulations
  • Helper Functions
  • Informational
  • Sound Functions
  • Tux Paint System Calls
  • Color Conversions
  • Helper Macros in "tp_magic_api.h"
  • Constant Definitions in "tp_magic_api.h"
  • @@ -636,17 +636,13 @@ -
    +
    -

    - Tux Paint System Calls

    +

    + Sound Functions

    -
    void update_progress_bar(void)
    -
    - Asks Tux Paint to animate and draw one frame of its progress bar (at the bottom of the screen). Useful for routines that may take a long time, to provide feedback to the user that Tux Paint has not crashed or frozen.
    -
    void playsound(Mix_Chunk * snd, int pan, int dist)

    @@ -663,6 +659,43 @@

    This function stops playing a sound played by playsound(). It is useful to silence effects when the user stops using the tool (in your 'release' function).
    +
    int playingsound(void)
    +
    +

    + Call this function to determine whether a magic tool sound effect is still currently playing. Can be used by magic tools that pause and unpause their sounds (see below) to determine whether it's time to start a new sound — call playsound() instead of unpausesound(). A '1' is returned if a sound is playing; '0' otherwise.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    + +
    void pausesound(void)
    +
    +

    + Pauses the magic tool sound effect; it may be unpaused to resume playing. Useful when a magic tool sound is very long; avoid repeatedly playing just a short clip of the beginning when the user draws small strokes by starting (playsound()) and stopping (stopsound()) the sound. Use playingsound() to determine whether you can unpause or must play from the start.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    + +
    void unpausesound(void)
    +
    +

    + Resumes a paused magic tool sound effect, if one was playing.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    +
    +
    + +
    +
    +

    + Tux Paint System Calls

    +
    + +
    +
    void update_progress_bar(void)
    +
    + Asks Tux Paint to animate and draw one frame of its progress bar (at the bottom of the screen). Useful for routines that may take a long time, to provide feedback to the user that Tux Paint has not crashed or frozen.
    +
    void special_notify(int flag)
    This function notifies Tux Paint of special events. Various values defined in "tp_magic_api.h" can be 'or'ed together (using C's boolean 'or': "|") and sent to this function.
    diff --git a/docs/en/html/README.html b/docs/en/html/README.html index 133816dc2..c88d5c91d 100644 --- a/docs/en/html/README.html +++ b/docs/en/html/README.html @@ -236,6 +236,9 @@
    New Magic tool: Comic dots
    Draws a repeating dot pattern, simulating the "Ben Day process" used in early comic books.
    + +
    Magic API Updates
    +
    Sound pause and resume functions added.

    diff --git a/docs/es_ES.UTF-8/MAGIC-API.txt b/docs/es_ES.UTF-8/MAGIC-API.txt index c30fa0562..b08eb7c24 100644 --- a/docs/es_ES.UTF-8/MAGIC-API.txt +++ b/docs/es_ES.UTF-8/MAGIC-API.txt @@ -6,7 +6,7 @@ Copyright © 2007-2024 by various contributors; see AUTHORS.txt. https://tuxpaint.org/ - junio 1, 2024 + septiembre 17, 2024 +--------------------------------------------------+ | Table of Contents | @@ -22,6 +22,7 @@ | o Pixel Manipulations | | o Helper Functions | | o Informational | +| o Sound Functions | | o Tux Paint System Calls | | o Color Conversions | | + Helper Macros in "tp_magic_api.h" | @@ -640,12 +641,7 @@ char * data_directory -Tux Paint System Calls - -void update_progress_bar(void) - Asks Tux Paint to animate and draw one frame of its progress bar (at the - bottom of the screen). Useful for routines that may take a long time, to - provide feedback to the user that Tux Paint has not crashed or frozen. +Sound Functions void playsound(Mix_Chunk * snd, int pan, int dist) @@ -670,6 +666,46 @@ void stopsound(void) silence effects when the user stops using the tool (in your 'release' function). +int playingsound(void) + + Call this function to determine whether a magic tool sound effect is still + currently playing. Can be used by magic tools that pause and unpause their + sounds (see below) to determine whether it's time to start a new sound — + call playsound() instead of unpausesound(). A '1' is returned if a sound is + playing; '0' otherwise. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + +void pausesound(void) + + Pauses the magic tool sound effect; it may be unpaused to resume playing. + Useful when a magic tool sound is very long; avoid repeatedly playing just + a short clip of the beginning when the user draws small strokes by starting + (playsound()) and stopping (stopsound()) the sound. Use playingsound() to + determine whether you can unpause or must play from the start. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + +void unpausesound(void) + + Resumes a paused magic tool sound effect, if one was playing. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + + +Tux Paint System Calls + +void update_progress_bar(void) + Asks Tux Paint to animate and draw one frame of its progress bar (at the + bottom of the screen). Useful for routines that may take a long time, to + provide feedback to the user that Tux Paint has not crashed or frozen. + void special_notify(int flag) This function notifies Tux Paint of special events. Various values defined in "tp_magic_api.h" can be 'or'ed together (using C's boolean 'or': "|") diff --git a/docs/es_ES.UTF-8/README.txt b/docs/es_ES.UTF-8/README.txt index 578a27bde..2ca2f069e 100644 --- a/docs/es_ES.UTF-8/README.txt +++ b/docs/es_ES.UTF-8/README.txt @@ -6,7 +6,7 @@ Copyright © 2002-2024 by various contributors; see AUTHORS.txt. https://tuxpaint.org/ - septiembre 16, 2024 + septiembre 17, 2024 +-------------------------------------------------+ | Table of Contents | @@ -105,6 +105,12 @@ D. What's New in Tux Paint version 0.9.34? New brushes New brushes for the Paint and Lines tools: Fluff (gradient). +New Magic tool: Comic dots + Draws a repeating dot pattern, simulating the "Ben Day process" used in + early comic books. + +Magic API Updates + Sound pause and resume functions added. See CHANGES.txt for the complete list of changes. diff --git a/docs/es_ES.UTF-8/html/MAGIC-API.html b/docs/es_ES.UTF-8/html/MAGIC-API.html index 0376f5a78..17f9edac6 100644 --- a/docs/es_ES.UTF-8/html/MAGIC-API.html +++ b/docs/es_ES.UTF-8/html/MAGIC-API.html @@ -102,7 +102,7 @@

    - junio 1, 2024

    + septiembre 17, 2024

    @@ -128,7 +128,7 @@
  • Tux Paint Functions and Data +
  • Pixel Manipulations
  • Helper Functions
  • Informational
  • Sound Functions
  • Tux Paint System Calls
  • Color Conversions
  • Helper Macros in "tp_magic_api.h"
  • Constant Definitions in "tp_magic_api.h"
  • @@ -636,17 +636,13 @@
    -
    +
    -

    - Tux Paint System Calls

    +

    + Sound Functions

    -
    void update_progress_bar(void)
    -
    - Asks Tux Paint to animate and draw one frame of its progress bar (at the bottom of the screen). Useful for routines that may take a long time, to provide feedback to the user that Tux Paint has not crashed or frozen.
    -
    void playsound(Mix_Chunk * snd, int pan, int dist)

    @@ -663,6 +659,43 @@

    This function stops playing a sound played by playsound(). It is useful to silence effects when the user stops using the tool (in your 'release' function).
    +
    int playingsound(void)
    +
    +

    + Call this function to determine whether a magic tool sound effect is still currently playing. Can be used by magic tools that pause and unpause their sounds (see below) to determine whether it's time to start a new sound — call playsound() instead of unpausesound(). A '1' is returned if a sound is playing; '0' otherwise.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    + +
    void pausesound(void)
    +
    +

    + Pauses the magic tool sound effect; it may be unpaused to resume playing. Useful when a magic tool sound is very long; avoid repeatedly playing just a short clip of the beginning when the user draws small strokes by starting (playsound()) and stopping (stopsound()) the sound. Use playingsound() to determine whether you can unpause or must play from the start.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    + +
    void unpausesound(void)
    +
    +

    + Resumes a paused magic tool sound effect, if one was playing.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    +
    +
    + +
    +
    +

    + Tux Paint System Calls

    +
    + +
    +
    void update_progress_bar(void)
    +
    + Asks Tux Paint to animate and draw one frame of its progress bar (at the bottom of the screen). Useful for routines that may take a long time, to provide feedback to the user that Tux Paint has not crashed or frozen.
    +
    void special_notify(int flag)
    This function notifies Tux Paint of special events. Various values defined in "tp_magic_api.h" can be 'or'ed together (using C's boolean 'or': "|") and sent to this function.
    diff --git a/docs/es_ES.UTF-8/html/README.html b/docs/es_ES.UTF-8/html/README.html index f85e0df2c..3a2740e4f 100644 --- a/docs/es_ES.UTF-8/html/README.html +++ b/docs/es_ES.UTF-8/html/README.html @@ -236,6 +236,9 @@
    New Magic tool: Comic dots
    Draws a repeating dot pattern, simulating the "Ben Day process" used in early comic books.
    + +
    Magic API Updates
    +
    Sound pause and resume functions added.

    diff --git a/docs/fr_FR.UTF-8/MAGIC-API.txt b/docs/fr_FR.UTF-8/MAGIC-API.txt index 8d903f34f..06032cdf1 100644 --- a/docs/fr_FR.UTF-8/MAGIC-API.txt +++ b/docs/fr_FR.UTF-8/MAGIC-API.txt @@ -6,7 +6,7 @@ Copyright © 2007-2024 by various contributors; see AUTHORS.txt. https://tuxpaint.org/ - juin 1, 2024 + septembre 17, 2024 +--------------------------------------------------+ | Table of Contents | @@ -22,6 +22,7 @@ | o Pixel Manipulations | | o Helper Functions | | o Informational | +| o Sound Functions | | o Tux Paint System Calls | | o Color Conversions | | + Helper Macros in "tp_magic_api.h" | @@ -640,12 +641,7 @@ char * data_directory -Tux Paint System Calls - -void update_progress_bar(void) - Asks Tux Paint to animate and draw one frame of its progress bar (at the - bottom of the screen). Useful for routines that may take a long time, to - provide feedback to the user that Tux Paint has not crashed or frozen. +Sound Functions void playsound(Mix_Chunk * snd, int pan, int dist) @@ -670,6 +666,46 @@ void stopsound(void) silence effects when the user stops using the tool (in your 'release' function). +int playingsound(void) + + Call this function to determine whether a magic tool sound effect is still + currently playing. Can be used by magic tools that pause and unpause their + sounds (see below) to determine whether it's time to start a new sound — + call playsound() instead of unpausesound(). A '1' is returned if a sound is + playing; '0' otherwise. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + +void pausesound(void) + + Pauses the magic tool sound effect; it may be unpaused to resume playing. + Useful when a magic tool sound is very long; avoid repeatedly playing just + a short clip of the beginning when the user draws small strokes by starting + (playsound()) and stopping (stopsound()) the sound. Use playingsound() to + determine whether you can unpause or must play from the start. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + +void unpausesound(void) + + Resumes a paused magic tool sound effect, if one was playing. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + + +Tux Paint System Calls + +void update_progress_bar(void) + Asks Tux Paint to animate and draw one frame of its progress bar (at the + bottom of the screen). Useful for routines that may take a long time, to + provide feedback to the user that Tux Paint has not crashed or frozen. + void special_notify(int flag) This function notifies Tux Paint of special events. Various values defined in "tp_magic_api.h" can be 'or'ed together (using C's boolean 'or': "|") diff --git a/docs/fr_FR.UTF-8/README.txt b/docs/fr_FR.UTF-8/README.txt index 1cd2a3602..002891849 100644 --- a/docs/fr_FR.UTF-8/README.txt +++ b/docs/fr_FR.UTF-8/README.txt @@ -6,7 +6,7 @@ Copyright © 2002-2024 by divers contributeurs; voir AUTHORS.txt. https://tuxpaint.org/ - septembre 16, 2024 + septembre 17, 2024 +-------------------------------------------------------+ | Table des matières | @@ -110,6 +110,12 @@ D. Qu'y a-t-il de neuf dans la version 0.9.34 de Tux Paint ? New brushes New brushes for the Paint and Lines tools: Fluff (gradient). +New Magic tool: Comic dots + Draws a repeating dot pattern, simulating the "Ben Day process" used in + early comic books. + +Magic API Updates + Sound pause and resume functions added. Voir CHANGES.txt pour la liste complète des changements. diff --git a/docs/fr_FR.UTF-8/html/MAGIC-API.html b/docs/fr_FR.UTF-8/html/MAGIC-API.html index 53744412b..da2ebd34b 100644 --- a/docs/fr_FR.UTF-8/html/MAGIC-API.html +++ b/docs/fr_FR.UTF-8/html/MAGIC-API.html @@ -102,7 +102,7 @@

    - juin 1, 2024

    + septembre 17, 2024

    @@ -128,7 +128,7 @@
  • Tux Paint Functions and Data +
  • Pixel Manipulations
  • Helper Functions
  • Informational
  • Sound Functions
  • Tux Paint System Calls
  • Color Conversions
  • Helper Macros in "tp_magic_api.h"
  • Constant Definitions in "tp_magic_api.h"
  • @@ -636,17 +636,13 @@
    -
    +
    -

    - Tux Paint System Calls

    +

    + Sound Functions

    -
    void update_progress_bar(void)
    -
    - Asks Tux Paint to animate and draw one frame of its progress bar (at the bottom of the screen). Useful for routines that may take a long time, to provide feedback to the user that Tux Paint has not crashed or frozen.
    -
    void playsound(Mix_Chunk * snd, int pan, int dist)

    @@ -663,6 +659,43 @@

    This function stops playing a sound played by playsound(). It is useful to silence effects when the user stops using the tool (in your 'release' function).
    +
    int playingsound(void)
    +
    +

    + Call this function to determine whether a magic tool sound effect is still currently playing. Can be used by magic tools that pause and unpause their sounds (see below) to determine whether it's time to start a new sound — call playsound() instead of unpausesound(). A '1' is returned if a sound is playing; '0' otherwise.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    + +
    void pausesound(void)
    +
    +

    + Pauses the magic tool sound effect; it may be unpaused to resume playing. Useful when a magic tool sound is very long; avoid repeatedly playing just a short clip of the beginning when the user draws small strokes by starting (playsound()) and stopping (stopsound()) the sound. Use playingsound() to determine whether you can unpause or must play from the start.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    + +
    void unpausesound(void)
    +
    +

    + Resumes a paused magic tool sound effect, if one was playing.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    +
    +
    + +
    +
    +

    + Tux Paint System Calls

    +
    + +
    +
    void update_progress_bar(void)
    +
    + Asks Tux Paint to animate and draw one frame of its progress bar (at the bottom of the screen). Useful for routines that may take a long time, to provide feedback to the user that Tux Paint has not crashed or frozen.
    +
    void special_notify(int flag)
    This function notifies Tux Paint of special events. Various values defined in "tp_magic_api.h" can be 'or'ed together (using C's boolean 'or': "|") and sent to this function.
    diff --git a/docs/fr_FR.UTF-8/html/README.html b/docs/fr_FR.UTF-8/html/README.html index f44711dd6..22768af13 100644 --- a/docs/fr_FR.UTF-8/html/README.html +++ b/docs/fr_FR.UTF-8/html/README.html @@ -236,6 +236,9 @@
    New Magic tool: Comic dots
    Draws a repeating dot pattern, simulating the "Ben Day process" used in early comic books.
    + +
    Magic API Updates
    +
    Sound pause and resume functions added.

    diff --git a/docs/gl_ES.UTF-8/MAGIC-API.txt b/docs/gl_ES.UTF-8/MAGIC-API.txt index ac0cf7a5d..4473f8b72 100644 --- a/docs/gl_ES.UTF-8/MAGIC-API.txt +++ b/docs/gl_ES.UTF-8/MAGIC-API.txt @@ -6,7 +6,7 @@ Copyright © 2007-2024 by various contributors; see AUTHORS.txt. https://tuxpaint.org/ - Xuño 1, 2024 + Setembro 17, 2024 +--------------------------------------------------+ | Table of Contents | @@ -22,6 +22,7 @@ | o Pixel Manipulations | | o Helper Functions | | o Informational | +| o Sound Functions | | o Tux Paint System Calls | | o Color Conversions | | + Helper Macros in "tp_magic_api.h" | @@ -640,12 +641,7 @@ char * data_directory -Tux Paint System Calls - -void update_progress_bar(void) - Asks Tux Paint to animate and draw one frame of its progress bar (at the - bottom of the screen). Useful for routines that may take a long time, to - provide feedback to the user that Tux Paint has not crashed or frozen. +Sound Functions void playsound(Mix_Chunk * snd, int pan, int dist) @@ -670,6 +666,46 @@ void stopsound(void) silence effects when the user stops using the tool (in your 'release' function). +int playingsound(void) + + Call this function to determine whether a magic tool sound effect is still + currently playing. Can be used by magic tools that pause and unpause their + sounds (see below) to determine whether it's time to start a new sound — + call playsound() instead of unpausesound(). A '1' is returned if a sound is + playing; '0' otherwise. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + +void pausesound(void) + + Pauses the magic tool sound effect; it may be unpaused to resume playing. + Useful when a magic tool sound is very long; avoid repeatedly playing just + a short clip of the beginning when the user draws small strokes by starting + (playsound()) and stopping (stopsound()) the sound. Use playingsound() to + determine whether you can unpause or must play from the start. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + +void unpausesound(void) + + Resumes a paused magic tool sound effect, if one was playing. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + + +Tux Paint System Calls + +void update_progress_bar(void) + Asks Tux Paint to animate and draw one frame of its progress bar (at the + bottom of the screen). Useful for routines that may take a long time, to + provide feedback to the user that Tux Paint has not crashed or frozen. + void special_notify(int flag) This function notifies Tux Paint of special events. Various values defined in "tp_magic_api.h" can be 'or'ed together (using C's boolean 'or': "|") diff --git a/docs/gl_ES.UTF-8/README.txt b/docs/gl_ES.UTF-8/README.txt index 10febfa44..182fee12f 100644 --- a/docs/gl_ES.UTF-8/README.txt +++ b/docs/gl_ES.UTF-8/README.txt @@ -6,7 +6,7 @@ Copyright © 2002-2024 by varios colaboradores; see AUTHORS.txt. https://tuxpaint.org/ - 16 de Setembro de 2024 + 17 de Setembro de 2024 +--------------------------------------------------------+ | Índice | @@ -106,6 +106,12 @@ D. What's New in Tux Paint version 0.9.34? New brushes New brushes for the Paint and Lines tools: Fluff (gradient). +New Magic tool: Comic dots + Draws a repeating dot pattern, simulating the "Ben Day process" used in + early comic books. + +Magic API Updates + Sound pause and resume functions added. See CHANGES.txt for the complete list of changes. diff --git a/docs/gl_ES.UTF-8/html/MAGIC-API.html b/docs/gl_ES.UTF-8/html/MAGIC-API.html index 4c1fdceeb..f9948f192 100644 --- a/docs/gl_ES.UTF-8/html/MAGIC-API.html +++ b/docs/gl_ES.UTF-8/html/MAGIC-API.html @@ -102,7 +102,7 @@

    - Xuño 1, 2024

    + Setembro 17, 2024

    @@ -128,7 +128,7 @@
  • Tux Paint Functions and Data +
  • Pixel Manipulations
  • Helper Functions
  • Informational
  • Sound Functions
  • Tux Paint System Calls
  • Color Conversions
  • Helper Macros in "tp_magic_api.h"
  • Constant Definitions in "tp_magic_api.h"
  • @@ -636,17 +636,13 @@
    -
    +
    -

    - Tux Paint System Calls

    +

    + Sound Functions

    -
    void update_progress_bar(void)
    -
    - Asks Tux Paint to animate and draw one frame of its progress bar (at the bottom of the screen). Useful for routines that may take a long time, to provide feedback to the user that Tux Paint has not crashed or frozen.
    -
    void playsound(Mix_Chunk * snd, int pan, int dist)

    @@ -663,6 +659,43 @@

    This function stops playing a sound played by playsound(). It is useful to silence effects when the user stops using the tool (in your 'release' function).
    +
    int playingsound(void)
    +
    +

    + Call this function to determine whether a magic tool sound effect is still currently playing. Can be used by magic tools that pause and unpause their sounds (see below) to determine whether it's time to start a new sound — call playsound() instead of unpausesound(). A '1' is returned if a sound is playing; '0' otherwise.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    + +
    void pausesound(void)
    +
    +

    + Pauses the magic tool sound effect; it may be unpaused to resume playing. Useful when a magic tool sound is very long; avoid repeatedly playing just a short clip of the beginning when the user draws small strokes by starting (playsound()) and stopping (stopsound()) the sound. Use playingsound() to determine whether you can unpause or must play from the start.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    + +
    void unpausesound(void)
    +
    +

    + Resumes a paused magic tool sound effect, if one was playing.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    +
    +
    + +
    +
    +

    + Tux Paint System Calls

    +
    + +
    +
    void update_progress_bar(void)
    +
    + Asks Tux Paint to animate and draw one frame of its progress bar (at the bottom of the screen). Useful for routines that may take a long time, to provide feedback to the user that Tux Paint has not crashed or frozen.
    +
    void special_notify(int flag)
    This function notifies Tux Paint of special events. Various values defined in "tp_magic_api.h" can be 'or'ed together (using C's boolean 'or': "|") and sent to this function.
    diff --git a/docs/gl_ES.UTF-8/html/README.html b/docs/gl_ES.UTF-8/html/README.html index 61041f659..cb7e84059 100644 --- a/docs/gl_ES.UTF-8/html/README.html +++ b/docs/gl_ES.UTF-8/html/README.html @@ -236,6 +236,9 @@
    New Magic tool: Comic dots
    Draws a repeating dot pattern, simulating the "Ben Day process" used in early comic books.
    + +
    Magic API Updates
    +
    Sound pause and resume functions added.

    diff --git a/docs/is_IS.UTF-8/MAGIC-API.txt b/docs/is_IS.UTF-8/MAGIC-API.txt index e5dc21859..ce83515f7 100644 --- a/docs/is_IS.UTF-8/MAGIC-API.txt +++ b/docs/is_IS.UTF-8/MAGIC-API.txt @@ -6,7 +6,7 @@ Höfundarréttur © 2007-2024 eftir various contributors; sjá AUTHORS-skrá. https://tuxpaint.org/ - 1. júní 2024 + 17. september 2024 +--------------------------------------------------+ | Efnisyfirlit | @@ -22,6 +22,7 @@ | o Pixel Manipulations | | o Helper Functions | | o Til upplýsingar | +| o Sound Functions | | o Tux Paint System Calls | | o Color Conversions | | + Helper Macros in "tp_magic_api.h" | @@ -640,12 +641,7 @@ char * data_directory -Tux Paint System Calls - -void update_progress_bar(void) - Asks Tux Paint to animate and draw one frame of its progress bar (at the - bottom of the screen). Useful for routines that may take a long time, to - provide feedback to the user that Tux Paint has not crashed or frozen. +Sound Functions void playsound(Mix_Chunk * snd, int pan, int dist) @@ -670,6 +666,46 @@ void stopsound(void) silence effects when the user stops using the tool (in your 'release' function). +int playingsound(void) + + Call this function to determine whether a magic tool sound effect is still + currently playing. Can be used by magic tools that pause and unpause their + sounds (see below) to determine whether it's time to start a new sound — + call playsound() instead of unpausesound(). A '1' is returned if a sound is + playing; '0' otherwise. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + +void pausesound(void) + + Pauses the magic tool sound effect; it may be unpaused to resume playing. + Useful when a magic tool sound is very long; avoid repeatedly playing just + a short clip of the beginning when the user draws small strokes by starting + (playsound()) and stopping (stopsound()) the sound. Use playingsound() to + determine whether you can unpause or must play from the start. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + +void unpausesound(void) + + Resumes a paused magic tool sound effect, if one was playing. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + + +Tux Paint System Calls + +void update_progress_bar(void) + Asks Tux Paint to animate and draw one frame of its progress bar (at the + bottom of the screen). Useful for routines that may take a long time, to + provide feedback to the user that Tux Paint has not crashed or frozen. + void special_notify(int flag) This function notifies Tux Paint of special events. Various values defined in "tp_magic_api.h" can be 'or'ed together (using C's boolean 'or': "|") diff --git a/docs/is_IS.UTF-8/README.txt b/docs/is_IS.UTF-8/README.txt index fce9d9c19..8400d307e 100644 --- a/docs/is_IS.UTF-8/README.txt +++ b/docs/is_IS.UTF-8/README.txt @@ -6,7 +6,7 @@ Copyright © 2002-2024 by various contributors; see AUTHORS.txt. https://tuxpaint.org/ - september 16, 2024 + september 17, 2024 +-------------------------------------------------+ | Table of Contents | @@ -105,6 +105,12 @@ D. What's New in Tux Paint version 0.9.34? New brushes New brushes for the Paint and Lines tools: Fluff (gradient). +New Magic tool: Comic dots + Draws a repeating dot pattern, simulating the "Ben Day process" used in + early comic books. + +Magic API Updates + Sound pause and resume functions added. See CHANGES.txt for the complete list of changes. diff --git a/docs/is_IS.UTF-8/html/MAGIC-API.html b/docs/is_IS.UTF-8/html/MAGIC-API.html index 26944c282..ce12bf59e 100644 --- a/docs/is_IS.UTF-8/html/MAGIC-API.html +++ b/docs/is_IS.UTF-8/html/MAGIC-API.html @@ -102,7 +102,7 @@

    - 1. júní 2024

    + 17. september 2024

    @@ -128,7 +128,7 @@
  • Tux Paint Functions and Data +
  • Pixel Manipulations
  • Helper Functions
  • Til upplýsingar
  • Sound Functions
  • Tux Paint System Calls
  • Color Conversions
  • Helper Macros in "tp_magic_api.h"
  • Constant Definitions in "tp_magic_api.h"
  • @@ -636,17 +636,13 @@
    -
    +
    -

    - Tux Paint System Calls

    +

    + Sound Functions

    -
    void update_progress_bar(void)
    -
    - Asks Tux Paint to animate and draw one frame of its progress bar (at the bottom of the screen). Useful for routines that may take a long time, to provide feedback to the user that Tux Paint has not crashed or frozen.
    -
    void playsound(Mix_Chunk * snd, int pan, int dist)

    @@ -663,6 +659,43 @@

    This function stops playing a sound played by playsound(). It is useful to silence effects when the user stops using the tool (in your 'release' function).
    +
    int playingsound(void)
    +
    +

    + Call this function to determine whether a magic tool sound effect is still currently playing. Can be used by magic tools that pause and unpause their sounds (see below) to determine whether it's time to start a new sound — call playsound() instead of unpausesound(). A '1' is returned if a sound is playing; '0' otherwise.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    + +
    void pausesound(void)
    +
    +

    + Pauses the magic tool sound effect; it may be unpaused to resume playing. Useful when a magic tool sound is very long; avoid repeatedly playing just a short clip of the beginning when the user draws small strokes by starting (playsound()) and stopping (stopsound()) the sound. Use playingsound() to determine whether you can unpause or must play from the start.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    + +
    void unpausesound(void)
    +
    +

    + Resumes a paused magic tool sound effect, if one was playing.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    +
    +
    + +
    +
    +

    + Tux Paint System Calls

    +
    + +
    +
    void update_progress_bar(void)
    +
    + Asks Tux Paint to animate and draw one frame of its progress bar (at the bottom of the screen). Useful for routines that may take a long time, to provide feedback to the user that Tux Paint has not crashed or frozen.
    +
    void special_notify(int flag)
    This function notifies Tux Paint of special events. Various values defined in "tp_magic_api.h" can be 'or'ed together (using C's boolean 'or': "|") and sent to this function.
    diff --git a/docs/is_IS.UTF-8/html/README.html b/docs/is_IS.UTF-8/html/README.html index 04e8628d0..3c9236f75 100644 --- a/docs/is_IS.UTF-8/html/README.html +++ b/docs/is_IS.UTF-8/html/README.html @@ -236,6 +236,9 @@
    New Magic tool: Comic dots
    Draws a repeating dot pattern, simulating the "Ben Day process" used in early comic books.
    + +
    Magic API Updates
    +
    Sound pause and resume functions added.

    diff --git a/docs/ja_JP.UTF-8/MAGIC-API.txt b/docs/ja_JP.UTF-8/MAGIC-API.txt index a5d5c81ed..6a2f9781f 100644 --- a/docs/ja_JP.UTF-8/MAGIC-API.txt +++ b/docs/ja_JP.UTF-8/MAGIC-API.txt @@ -6,7 +6,7 @@ Copyright © 2007-2024 by various contributors; see AUTHORS.txt. https://tuxpaint.org/ - 6月 1, 2024 + 9月 17, 2024 +--------------------------------------------------+ | Table of Contents | @@ -22,6 +22,7 @@ | o Pixel Manipulations | | o Helper Functions | | o Informational | +| o Sound Functions | | o Tux Paint System Calls | | o Color Conversions | | + Helper Macros in "tp_magic_api.h" | @@ -640,12 +641,7 @@ char * data_directory -Tux Paint System Calls - -void update_progress_bar(void) - Asks Tux Paint to animate and draw one frame of its progress bar (at the - bottom of the screen). Useful for routines that may take a long time, to - provide feedback to the user that Tux Paint has not crashed or frozen. +Sound Functions void playsound(Mix_Chunk * snd, int pan, int dist) @@ -670,6 +666,46 @@ void stopsound(void) silence effects when the user stops using the tool (in your 'release' function). +int playingsound(void) + + Call this function to determine whether a magic tool sound effect is still + currently playing. Can be used by magic tools that pause and unpause their + sounds (see below) to determine whether it's time to start a new sound — + call playsound() instead of unpausesound(). A '1' is returned if a sound is + playing; '0' otherwise. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + +void pausesound(void) + + Pauses the magic tool sound effect; it may be unpaused to resume playing. + Useful when a magic tool sound is very long; avoid repeatedly playing just + a short clip of the beginning when the user draws small strokes by starting + (playsound()) and stopping (stopsound()) the sound. Use playingsound() to + determine whether you can unpause or must play from the start. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + +void unpausesound(void) + + Resumes a paused magic tool sound effect, if one was playing. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + + +Tux Paint System Calls + +void update_progress_bar(void) + Asks Tux Paint to animate and draw one frame of its progress bar (at the + bottom of the screen). Useful for routines that may take a long time, to + provide feedback to the user that Tux Paint has not crashed or frozen. + void special_notify(int flag) This function notifies Tux Paint of special events. Various values defined in "tp_magic_api.h" can be 'or'ed together (using C's boolean 'or': "|") diff --git a/docs/ja_JP.UTF-8/README.txt b/docs/ja_JP.UTF-8/README.txt index 6ced42dc4..cb72de215 100644 --- a/docs/ja_JP.UTF-8/README.txt +++ b/docs/ja_JP.UTF-8/README.txt @@ -6,7 +6,7 @@ Copyright © 2002-2024 by various contributors; AUTHORS.txt 参照. https://tuxpaint.org/ - 2024年9月16日 + 2024年9月17日 +--------------------------------------------------+ | 目次 | @@ -103,6 +103,12 @@ D. Tux Paint バージョン 0.9.34 での変更点 ブラシの追加 New brushes for the Paint and Lines tools: Fluff (gradient). +New Magic tool: Comic dots + Draws a repeating dot pattern, simulating the "Ben Day process" used in + early comic books. + +Magic API Updates + Sound pause and resume functions added. 全ての変更点については、CHANGES.txt をお読みください。 diff --git a/docs/ja_JP.UTF-8/html/MAGIC-API.html b/docs/ja_JP.UTF-8/html/MAGIC-API.html index 375d79c46..fe3ce1b03 100644 --- a/docs/ja_JP.UTF-8/html/MAGIC-API.html +++ b/docs/ja_JP.UTF-8/html/MAGIC-API.html @@ -102,7 +102,7 @@

    - 6月 1, 2024

    + 9月 17, 2024

    @@ -128,7 +128,7 @@
  • Tux Paint Functions and Data +
  • Pixel Manipulations
  • Helper Functions
  • Informational
  • Sound Functions
  • Tux Paint System Calls
  • Color Conversions
  • Helper Macros in "tp_magic_api.h"
  • Constant Definitions in "tp_magic_api.h"
  • @@ -636,17 +636,13 @@
    -
    +
    -

    - Tux Paint System Calls

    +

    + Sound Functions

    -
    void update_progress_bar(void)
    -
    - Asks Tux Paint to animate and draw one frame of its progress bar (at the bottom of the screen). Useful for routines that may take a long time, to provide feedback to the user that Tux Paint has not crashed or frozen.
    -
    void playsound(Mix_Chunk * snd, int pan, int dist)

    @@ -663,6 +659,43 @@

    This function stops playing a sound played by playsound(). It is useful to silence effects when the user stops using the tool (in your 'release' function).
    +
    int playingsound(void)
    +
    +

    + Call this function to determine whether a magic tool sound effect is still currently playing. Can be used by magic tools that pause and unpause their sounds (see below) to determine whether it's time to start a new sound — call playsound() instead of unpausesound(). A '1' is returned if a sound is playing; '0' otherwise.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    + +
    void pausesound(void)
    +
    +

    + Pauses the magic tool sound effect; it may be unpaused to resume playing. Useful when a magic tool sound is very long; avoid repeatedly playing just a short clip of the beginning when the user draws small strokes by starting (playsound()) and stopping (stopsound()) the sound. Use playingsound() to determine whether you can unpause or must play from the start.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    + +
    void unpausesound(void)
    +
    +

    + Resumes a paused magic tool sound effect, if one was playing.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    +
    +
    + +
    +
    +

    + Tux Paint System Calls

    +
    + +
    +
    void update_progress_bar(void)
    +
    + Asks Tux Paint to animate and draw one frame of its progress bar (at the bottom of the screen). Useful for routines that may take a long time, to provide feedback to the user that Tux Paint has not crashed or frozen.
    +
    void special_notify(int flag)
    This function notifies Tux Paint of special events. Various values defined in "tp_magic_api.h" can be 'or'ed together (using C's boolean 'or': "|") and sent to this function.
    diff --git a/docs/ja_JP.UTF-8/html/README.html b/docs/ja_JP.UTF-8/html/README.html index c0b4d3829..bb638e188 100644 --- a/docs/ja_JP.UTF-8/html/README.html +++ b/docs/ja_JP.UTF-8/html/README.html @@ -236,6 +236,9 @@
    New Magic tool: Comic dots
    Draws a repeating dot pattern, simulating the "Ben Day process" used in early comic books.
    + +
    Magic API Updates
    +
    Sound pause and resume functions added.

    diff --git a/docs/sq_AL.UTF-8/MAGIC-API.txt b/docs/sq_AL.UTF-8/MAGIC-API.txt index 229985b68..25e7c9561 100644 --- a/docs/sq_AL.UTF-8/MAGIC-API.txt +++ b/docs/sq_AL.UTF-8/MAGIC-API.txt @@ -6,7 +6,7 @@ Copyright © 2007-2024 by various contributors; see AUTHORS.txt. https://tuxpaint.org/ - qershor 1, 2024 + shtator 17, 2024 +--------------------------------------------------+ | Table of Contents | @@ -22,6 +22,7 @@ | o Pixel Manipulations | | o Helper Functions | | o Informational | +| o Sound Functions | | o Tux Paint System Calls | | o Color Conversions | | + Helper Macros in "tp_magic_api.h" | @@ -640,12 +641,7 @@ char * data_directory -Tux Paint System Calls - -void update_progress_bar(void) - Asks Tux Paint to animate and draw one frame of its progress bar (at the - bottom of the screen). Useful for routines that may take a long time, to - provide feedback to the user that Tux Paint has not crashed or frozen. +Sound Functions void playsound(Mix_Chunk * snd, int pan, int dist) @@ -670,6 +666,46 @@ void stopsound(void) silence effects when the user stops using the tool (in your 'release' function). +int playingsound(void) + + Call this function to determine whether a magic tool sound effect is still + currently playing. Can be used by magic tools that pause and unpause their + sounds (see below) to determine whether it's time to start a new sound — + call playsound() instead of unpausesound(). A '1' is returned if a sound is + playing; '0' otherwise. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + +void pausesound(void) + + Pauses the magic tool sound effect; it may be unpaused to resume playing. + Useful when a magic tool sound is very long; avoid repeatedly playing just + a short clip of the beginning when the user draws small strokes by starting + (playsound()) and stopping (stopsound()) the sound. Use playingsound() to + determine whether you can unpause or must play from the start. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + +void unpausesound(void) + + Resumes a paused magic tool sound effect, if one was playing. + + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B. + + + + +Tux Paint System Calls + +void update_progress_bar(void) + Asks Tux Paint to animate and draw one frame of its progress bar (at the + bottom of the screen). Useful for routines that may take a long time, to + provide feedback to the user that Tux Paint has not crashed or frozen. + void special_notify(int flag) This function notifies Tux Paint of special events. Various values defined in "tp_magic_api.h" can be 'or'ed together (using C's boolean 'or': "|") diff --git a/docs/sq_AL.UTF-8/README.txt b/docs/sq_AL.UTF-8/README.txt index 9d760f094..b6efaaf98 100644 --- a/docs/sq_AL.UTF-8/README.txt +++ b/docs/sq_AL.UTF-8/README.txt @@ -6,7 +6,7 @@ Të drejta kopjimi © 2002-2024 nga kontribues të ndryshëm; shihni AUTHORS.txt. https://tuxpaint.org/ - 16 shtator 2024 + 17 shtator 2024 +---------------------------------------------------+ | Pasqyrë e Lëndës | @@ -105,6 +105,12 @@ D. What's New in Tux Paint version 0.9.34? New brushes New brushes for the Paint and Lines tools: Fluff (gradient). +New Magic tool: Comic dots + Draws a repeating dot pattern, simulating the "Ben Day process" used in + early comic books. + +Magic API Updates + Sound pause and resume functions added. Për listën e plotë të ndryshimeve, shihni CHANGES.txt. diff --git a/docs/sq_AL.UTF-8/html/MAGIC-API.html b/docs/sq_AL.UTF-8/html/MAGIC-API.html index 9b09f92ed..1e2895231 100644 --- a/docs/sq_AL.UTF-8/html/MAGIC-API.html +++ b/docs/sq_AL.UTF-8/html/MAGIC-API.html @@ -102,7 +102,7 @@

    - qershor 1, 2024

    + shtator 17, 2024

    @@ -128,7 +128,7 @@
  • Tux Paint Functions and Data +
  • Pixel Manipulations
  • Helper Functions
  • Informational
  • Sound Functions
  • Tux Paint System Calls
  • Color Conversions
  • Helper Macros in "tp_magic_api.h"
  • Constant Definitions in "tp_magic_api.h"
  • @@ -636,17 +636,13 @@
    -
    +
    -

    - Tux Paint System Calls

    +

    + Sound Functions

    -
    void update_progress_bar(void)
    -
    - Asks Tux Paint to animate and draw one frame of its progress bar (at the bottom of the screen). Useful for routines that may take a long time, to provide feedback to the user that Tux Paint has not crashed or frozen.
    -
    void playsound(Mix_Chunk * snd, int pan, int dist)

    @@ -663,6 +659,43 @@

    This function stops playing a sound played by playsound(). It is useful to silence effects when the user stops using the tool (in your 'release' function).
    +
    int playingsound(void)
    +
    +

    + Call this function to determine whether a magic tool sound effect is still currently playing. Can be used by magic tools that pause and unpause their sounds (see below) to determine whether it's time to start a new sound — call playsound() instead of unpausesound(). A '1' is returned if a sound is playing; '0' otherwise.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    + +
    void pausesound(void)
    +
    +

    + Pauses the magic tool sound effect; it may be unpaused to resume playing. Useful when a magic tool sound is very long; avoid repeatedly playing just a short clip of the beginning when the user draws small strokes by starting (playsound()) and stopping (stopsound()) the sound. Use playingsound() to determine whether you can unpause or must play from the start.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    + +
    void unpausesound(void)
    +
    +

    + Resumes a paused magic tool sound effect, if one was playing.

    +

    + Note: Added to Tux Paint 0.9.34; Magic API version 0x0000000B.

    +
    +
    +
    + +
    +
    +

    + Tux Paint System Calls

    +
    + +
    +
    void update_progress_bar(void)
    +
    + Asks Tux Paint to animate and draw one frame of its progress bar (at the bottom of the screen). Useful for routines that may take a long time, to provide feedback to the user that Tux Paint has not crashed or frozen.
    +
    void special_notify(int flag)
    This function notifies Tux Paint of special events. Various values defined in "tp_magic_api.h" can be 'or'ed together (using C's boolean 'or': "|") and sent to this function.
    diff --git a/docs/sq_AL.UTF-8/html/README.html b/docs/sq_AL.UTF-8/html/README.html index 32d490a70..366c1ee6a 100644 --- a/docs/sq_AL.UTF-8/html/README.html +++ b/docs/sq_AL.UTF-8/html/README.html @@ -236,6 +236,9 @@
    New Magic tool: Comic dots
    Draws a repeating dot pattern, simulating the "Ben Day process" used in early comic books.
    + +
    Magic API Updates
    +
    Sound pause and resume functions added.

    diff --git a/magic/src/comicdot.c b/magic/src/comicdot.c index 27edc1d2f..405f8f6a5 100644 --- a/magic/src/comicdot.c +++ b/magic/src/comicdot.c @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Last updated: September 16, 2024 + Last updated: September 17, 2024 */ #include @@ -222,7 +222,10 @@ void comicdot_drag(magic_api * api, int which, SDL_Surface * canvas, update_rect->w = (x + comicdot_radius) - update_rect->x; update_rect->h = (y + comicdot_radius) - update_rect->y; - api->playsound(comicdot_snd, 64 + ((x * 127) / canvas->w), 255); + if (api->playingsound()) + api->unpausesound(); + else + api->playsound(comicdot_snd, 64 + ((x * 127) / canvas->w), 255); } void comicdot_click(magic_api * api, int which, int mode, @@ -251,18 +254,15 @@ void comicdot_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUS SDL_Surface * last ATTRIBUTE_UNUSED, int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED) { - /* FIXME: Would be nice to be able to ask Tux Paint to pause - the sound (`Mix_Pause()`), and then resume (`Mix_Resume()`) - (or start new (`Mix_PlayChannel()`) if nothing is currently playing) - on click/drag. That way the sound won't start over every time - you make small stroke. */ - api->stopsound(); + api->pausesound(); } void comicdot_shutdown(magic_api * api ATTRIBUTE_UNUSED) { int i; + api->stopsound(); + if (comicdot_snd != NULL) Mix_FreeChunk(comicdot_snd); @@ -298,6 +298,7 @@ void comicdot_switchin(magic_api * api ATTRIBUTE_UNUSED, void comicdot_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED) { + api->stopsound(); } int comicdot_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) diff --git a/src/tp_magic_api.h.in b/src/tp_magic_api.h.in index 953d55795..c2e731971 100644 --- a/src/tp_magic_api.h.in +++ b/src/tp_magic_api.h.in @@ -127,6 +127,16 @@ typedef struct magic_api_t { loudest) */ void (*playsound)(Mix_Chunk *, int, int); + /* Asks Tux Paint whether a sound is currently being played (by 'playsound()') */ + int (*playingsound)(void); + + /* Asks Tux Paint to pause the sound being played by 'playsound()' */ + void (*pausesound)(void); + + /* Asks Tux Paint to resume (unpause) the sound being played by + 'playsound()' (if any) */ + void (*unpausesound)(void); + /* Asks Tux Paint to stop playing the sound played by 'playsound()' */ void (*stopsound)(void); diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 2c631bdf4..3f287c983 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -2295,6 +2295,9 @@ static int magic_sort(const void *a, const void *b); Mix_Chunk *magic_current_snd_ptr; static void magic_playsound(Mix_Chunk * snd, int left_right, int up_down); +static int magic_playingsound(void); +static void magic_pausesound(void); +static void magic_unpausesound(void); static void magic_stopsound(void); static void magic_line_func(void *mapi, int which, SDL_Surface * canvas, @@ -21729,6 +21732,9 @@ static void load_magic_plugins(void) magic_api_struct->xorpixel = magic_xorpixel; magic_api_struct->line = magic_line_func; magic_api_struct->playsound = magic_playsound; + magic_api_struct->playingsound = magic_playingsound; + magic_api_struct->pausesound = magic_pausesound; + magic_api_struct->unpausesound = magic_unpausesound; magic_api_struct->stopsound = magic_stopsound; magic_api_struct->special_notify = special_notify; magic_api_struct->button_down = magic_button_down; @@ -22403,6 +22409,29 @@ static void magic_playsound(Mix_Chunk * snd, int left_right, int up_down) #endif } +static int magic_playingsound(void) +{ +#ifndef NOSOUND + int is_playing; + is_playing = Mix_Playing(0); + return is_playing; +#endif +} + +static void magic_pausesound(void) +{ +#ifndef NOSOUND + return Mix_Pause(0); +#endif +} + +static void magic_unpausesound(void) +{ +#ifndef NOSOUND + return Mix_Resume(0); +#endif +} + /** * FIXME */