All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Juan Quintela <quintela@redhat.com>, qemu-devel@nongnu.org
Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com
Subject: Re: [Qemu-devel] [PATCH 19/26] audio: GUSsample is int16_t
Date: Tue, 25 Apr 2017 22:47:28 -0300	[thread overview]
Message-ID: <08d6f162-7272-3335-85ff-bc123142433f@amsat.org> (raw)
In-Reply-To: <20170425223739.6703-20-quintela@redhat.com>

Hi Juan,

Same here, why not squashing as "Use stdint instead of dead GUSEMU32"?

On 04/25/2017 07:37 PM, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  hw/audio/gus.c          |  2 +-
>  hw/audio/gusemu.h       | 12 +-----------
>  hw/audio/gusemu_hal.c   |  2 +-
>  hw/audio/gusemu_mixer.c |  8 ++++----
>  4 files changed, 7 insertions(+), 17 deletions(-)
>
> diff --git a/hw/audio/gus.c b/hw/audio/gus.c
> index 3d08a65..ec103a4 100644
> --- a/hw/audio/gus.c
> +++ b/hw/audio/gus.c
> @@ -53,7 +53,7 @@ typedef struct GUSState {
>      uint32_t freq;
>      uint32_t port;
>      int pos, left, shift, irqs;
> -    GUSsample *mixbuf;
> +    int16_t *mixbuf;
>      uint8_t himem[1024 * 1024 + 32 + 4096];
>      int samples;
>      SWVoiceOut *voice;
> diff --git a/hw/audio/gusemu.h b/hw/audio/gusemu.h
> index 69dadef..ab591ee 100644
> --- a/hw/audio/gusemu.h
> +++ b/hw/audio/gusemu.h
> @@ -25,16 +25,6 @@
>  #ifndef GUSEMU_H
>  #define GUSEMU_H
>
> -/* data types (need to be adjusted if neither a VC6 nor a C99 compatible compiler is used) */
> -
> -#if defined _WIN32 && defined _MSC_VER /* doesn't support other win32 compilers yet, do it yourself... */
> - typedef unsigned int GUSdword;
> - typedef signed short GUSsample;
> -#else
> - typedef uint32_t GUSdword;
> - typedef int16_t GUSsample;
> -#endif
> -
>  typedef struct _GUSEmuState
>  {
>   uint8_t *himemaddr; /* 1024*1024 bytes used for storing uploaded samples (+32 additional bytes for read padding) */
> @@ -86,7 +76,7 @@ void gus_dma_transferdata(GUSEmuState *state, char *dma_addr, unsigned int count
>  /* If the interrupts are asynchronous, it may be needed to use a separate thread mixing into a temporary */
>  /* audio buffer in order to avoid quality loss caused by large numsamples and elapsed_time values. */
>
> -void gus_mixvoices(GUSEmuState *state, unsigned int playback_freq, unsigned int numsamples, GUSsample *bufferpos);
> +void gus_mixvoices(GUSEmuState *state, unsigned int playback_freq, unsigned int numsamples, int16_t *bufferpos);
>  /* recommended range: 10 < numsamples < 100 */
>  /* lower values may result in increased rounding error, higher values often cause audible timing delays */
>
> diff --git a/hw/audio/gusemu_hal.c b/hw/audio/gusemu_hal.c
> index 3dd7239..1150fc4 100644
> --- a/hw/audio/gusemu_hal.c
> +++ b/hw/audio/gusemu_hal.c
> @@ -32,7 +32,7 @@
>
>  #define GUSregb(position) (*            (gusptr+(position)))
>  #define GUSregw(position) (*(uint16_t *) (gusptr+(position)))
> -#define GUSregd(position) (*(GUSdword *)(gusptr+(position)))
> +#define GUSregd(position) (*(uint16_t *)(gusptr+(position)))
>
>  /* size given in bytes */
>  unsigned int gus_read(GUSEmuState * state, int port, int size)
> diff --git a/hw/audio/gusemu_mixer.c b/hw/audio/gusemu_mixer.c
> index 981a9ae..00b9861 100644
> --- a/hw/audio/gusemu_mixer.c
> +++ b/hw/audio/gusemu_mixer.c
> @@ -28,13 +28,13 @@
>
>  #define GUSregb(position)  (*            (gusptr+(position)))
>  #define GUSregw(position)  (*(uint16_t *) (gusptr+(position)))
> -#define GUSregd(position)  (*(GUSdword *)(gusptr+(position)))
> +#define GUSregd(position)  (*(uint16_t *)(gusptr+(position)))
>
>  #define GUSvoice(position) (*(uint16_t *)(voiceptr+(position)))
>
>  /* samples are always 16bit stereo (4 bytes each, first right then left interleaved) */
>  void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int numsamples,
> -                   GUSsample *bufferpos)
> +                   int16_t *bufferpos)
>  {
>      /* note that byte registers are stored in the upper half of each voice register! */
>      uint8_t        *gusptr;
> @@ -171,8 +171,8 @@ void gus_mixvoices(GUSEmuState * state, unsigned int playback_freq, unsigned int
>                  }
>
>                  /* mix samples into buffer */
> -                *(bufferpos + 2 * sample)     += (GUSsample) ((sample1 * PanningPos) >> 4);        /* right */
> -                *(bufferpos + 2 * sample + 1) += (GUSsample) ((sample1 * (15 - PanningPos)) >> 4); /* left */
> +                *(bufferpos + 2 * sample)     += (int16_t) ((sample1 * PanningPos) >> 4);        /* right */
> +                *(bufferpos + 2 * sample + 1) += (int16_t) ((sample1 * (15 - PanningPos)) >> 4); /* left */
>              }
>              /* write back voice and volume */
>              GUSvoice(wVSRCurrVol)   = Volume32 / 32;
>

  reply	other threads:[~2017-04-26  1:47 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25 22:37 [Qemu-devel] [PATCH 00/26] Audio Cleanup Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 01/26] adlib: Remove support for YMF262 Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 02/26] audio: remove Y8950 configuration Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 03/26] audio: Remove YM3526 support Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 04/26] audio: YM3812 was always defined Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 05/26] audio: Remove UINT8 Juan Quintela
2017-04-26  1:41   ` Philippe Mathieu-Daudé
2017-04-26  7:22     ` Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 06/26] audio: remove UINT16 Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 07/26] audio: remove UINT32 Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 08/26] audio: Remove INT8 Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 09/26] audio: remove INT16 Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 10/26] audio: Remove INT32 Juan Quintela
2017-04-26  1:43   ` Philippe Mathieu-Daudé
2017-04-26  7:23     ` Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 11/26] audio: Unfold OPLSAMPLE Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 12/26] audio: Remove Unused OPL_TYPE_* Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 13/26] audio: Remove type field Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 14/26] audio: Remove unused fields Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 15/26] audio: GUSbyte is uint8_t Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 16/26] audio: remove GUSchar Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 17/26] audio: GUSword is uint16_t Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 18/26] " Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 19/26] audio: GUSsample is int16_t Juan Quintela
2017-04-26  1:47   ` Philippe Mathieu-Daudé [this message]
2017-04-25 22:37 ` [Qemu-devel] [PATCH 20/26] audio: OPLSetIRQHandler is not used anywhere Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 21/26] audio: OPLSetUpdateHandler " Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 22/26] audio: IRQHandler is not used anymore Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 23/26] audio: UpdateHandler " Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 24/26] audio: Remove unused typedefs Juan Quintela
2017-04-25 22:37 ` [Qemu-devel] [PATCH 25/26] audio: un-export OPLResetChip Juan Quintela
2017-04-26  1:48   ` Philippe Mathieu-Daudé
2017-04-25 22:37 ` [Qemu-devel] [PATCH 26/26] audio: Use ARRAY_SIZE from qemu/osdep.h Juan Quintela
2017-04-26  1:48   ` Philippe Mathieu-Daudé
2017-04-25 23:31 ` [Qemu-devel] [PATCH 00/26] Audio Cleanup no-reply
2017-04-26  7:20 ` Juan Quintela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=08d6f162-7272-3335-85ff-bc123142433f@amsat.org \
    --to=f4bug@amsat.org \
    --cc=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.