Replaced snd_xtoy_bb with cpu_to_xxyy and xxyy_to_cpu.

This commit is contained in:
Jaroslav Kysela 2000-06-18 17:25:10 +00:00
parent 7d01263a06
commit 6070773202
2 changed files with 37 additions and 36 deletions

View file

@ -693,9 +693,9 @@ static int iwffff_size(iwffff_instrument_t *instr)
static void copy_lfo_to_stream(iwffff_xlfo_t *xlfo, iwffff_lfo_t *lfo)
{
xlfo->freq = snd_htoi_16(lfo->freq);
xlfo->depth = snd_htoi_16(lfo->depth);
xlfo->sweep = snd_htoi_16(lfo->sweep);
xlfo->freq = __cpu_to_le16(lfo->freq);
xlfo->depth = __cpu_to_le16(lfo->depth);
xlfo->sweep = __cpu_to_le16(lfo->sweep);
xlfo->shape = lfo->shape;
xlfo->delay = lfo->delay;
@ -720,19 +720,19 @@ static int copy_env_to_stream(iwffff_xenv_t *xenv, iwffff_env_t *env, __u32 styp
ptr += sizeof(*xrec);
size += sizeof(*xrec);
xrec->stype = stype;
xrec->nattack = snd_htoi_16(rec->nattack);
xrec->nrelease = snd_htoi_16(rec->nrelease);
xrec->sustain_offset = snd_htoi_16(rec->sustain_offset);
xrec->sustain_rate = snd_htoi_16(rec->sustain_rate);
xrec->release_rate = snd_htoi_16(rec->release_rate);
xrec->nattack = __cpu_to_le16(rec->nattack);
xrec->nrelease = __cpu_to_le16(rec->nrelease);
xrec->sustain_offset = __cpu_to_le16(rec->sustain_offset);
xrec->sustain_rate = __cpu_to_le16(rec->sustain_rate);
xrec->release_rate = __cpu_to_le16(rec->release_rate);
xrec->hirange = rec->hirange;
point = (iwffff_env_point_t *)(rec + 1);
for (idx = 0; idx < xrec->nattack + xrec->nrelease; idx++) {
xpoint = (iwffff_xenv_point_t *)ptr;
ptr += sizeof(*xpoint);
size += sizeof(*xpoint);
xpoint->offset = snd_htoi_16(point->offset);
xpoint->rate = snd_htoi_16(point->rate);
xpoint->offset = __cpu_to_le16(point->offset);
xpoint->rate = __cpu_to_le16(point->rate);
point++;
}
}
@ -774,9 +774,9 @@ int snd_instr_iwffff_conv_to_stream(snd_instr_iwffff_t *iwffff,
/* build data section */
xinstr = (iwffff_xinstrument_t *)(data + 1);
xinstr->stype = IWFFFF_STRU_INSTR;
xinstr->exclusion = snd_htoi_16(instr->exclusion);
xinstr->layer_type = snd_htoi_16(instr->layer_type);
xinstr->exclusion_group = snd_htoi_16(instr->exclusion_group);
xinstr->exclusion = __cpu_to_le16(instr->exclusion);
xinstr->layer_type = __cpu_to_le16(instr->layer_type);
xinstr->exclusion_group = __cpu_to_le16(instr->exclusion_group);
xinstr->effect1 = instr->effect1;
xinstr->effect1_depth = instr->effect1_depth;
xinstr->effect2 = instr->effect2;
@ -796,7 +796,7 @@ int snd_instr_iwffff_conv_to_stream(snd_instr_iwffff_t *iwffff,
xlayer->attenuation = layer->attenuation;
copy_lfo_to_stream(&xlayer->tremolo, &layer->tremolo);
copy_lfo_to_stream(&xlayer->vibrato, &layer->vibrato);
xlayer->freq_scale = snd_htoi_16(layer->freq_scale);
xlayer->freq_scale = __cpu_to_le16(layer->freq_scale);
xlayer->freq_center = layer->freq_center;
ptr += copy_env_to_stream(&xlayer->penv, &layer->penv, IWFFFF_STRU_ENV_RECP);
ptr += copy_env_to_stream(&xlayer->venv, &layer->venv, IWFFFF_STRU_ENV_RECV);
@ -804,17 +804,17 @@ int snd_instr_iwffff_conv_to_stream(snd_instr_iwffff_t *iwffff,
xwave = (iwffff_xwave_t *)ptr;
ptr += sizeof(*xwave);
xwave->stype = IWFFFF_STRU_WAVE;
xwave->share_id[1] = snd_htoi_32(wave->share_id[1]);
xwave->share_id[2] = snd_htoi_32(wave->share_id[2]);
xwave->share_id[3] = snd_htoi_32(wave->share_id[3]);
xwave->share_id[4] = snd_htoi_32(wave->share_id[4]);
xwave->format = snd_htoi_32(wave->format);
xwave->size = snd_htoi_32(wave->size);
xwave->start = snd_htoi_32(wave->start);
xwave->loop_start = snd_htoi_32(wave->loop_start);
xwave->loop_end = snd_htoi_32(wave->loop_end);
xwave->loop_repeat = snd_htoi_32(wave->loop_repeat);
xwave->sample_ratio = snd_htoi_32(wave->sample_ratio);
xwave->share_id[1] = __cpu_to_le32(wave->share_id[1]);
xwave->share_id[2] = __cpu_to_le32(wave->share_id[2]);
xwave->share_id[3] = __cpu_to_le32(wave->share_id[3]);
xwave->share_id[4] = __cpu_to_le32(wave->share_id[4]);
xwave->format = __cpu_to_le32(wave->format);
xwave->size = __cpu_to_le32(wave->size);
xwave->start = __cpu_to_le32(wave->start);
xwave->loop_start = __cpu_to_le32(wave->loop_start);
xwave->loop_end = __cpu_to_le32(wave->loop_end);
xwave->loop_repeat = __cpu_to_le32(wave->loop_repeat);
xwave->sample_ratio = __cpu_to_le32(wave->sample_ratio);
xwave->attenuation = wave->attenuation;
xwave->low_note = wave->low_note;
xwave->high_note = wave->high_note;
@ -822,7 +822,7 @@ int snd_instr_iwffff_conv_to_stream(snd_instr_iwffff_t *iwffff,
memcpy(ptr, wave->address.ptr, wave->size);
ptr += wave->size;
} else {
xwave->offset = snd_htoi_32(wave->address.memory);
xwave->offset = __cpu_to_le32(wave->address.memory);
}
}
}

View file

@ -26,6 +26,7 @@
#include <sys/stat.h>
#include <stdio.h>
#include "asoundlib.h"
#include <asm/byteorder.h>
#include <linux/ainstr_simple.h>
static long simple_size(simple_instrument_t *instr)
@ -71,16 +72,16 @@ int snd_instr_simple_convert_to_stream(snd_instr_simple_t *simple,
/* build data section */
xinstr = (simple_xinstrument_t *)(data + 1);
xinstr->stype = SIMPLE_STRU_INSTR;
xinstr->share_id[0] = snd_htoi_32(instr->share_id[0]);
xinstr->share_id[1] = snd_htoi_32(instr->share_id[1]);
xinstr->share_id[2] = snd_htoi_32(instr->share_id[2]);
xinstr->share_id[3] = snd_htoi_32(instr->share_id[3]);
xinstr->format = snd_htoi_32(instr->format);
xinstr->size = snd_htoi_32(instr->size);
xinstr->start = snd_htoi_32(instr->start);
xinstr->loop_start = snd_htoi_32(instr->loop_start);
xinstr->loop_end = snd_htoi_32(instr->loop_end);
xinstr->loop_repeat = snd_htoi_16(instr->loop_repeat);
xinstr->share_id[0] = __cpu_to_le32(instr->share_id[0]);
xinstr->share_id[1] = __cpu_to_le32(instr->share_id[1]);
xinstr->share_id[2] = __cpu_to_le32(instr->share_id[2]);
xinstr->share_id[3] = __cpu_to_le32(instr->share_id[3]);
xinstr->format = __cpu_to_le32(instr->format);
xinstr->size = __cpu_to_le32(instr->size);
xinstr->start = __cpu_to_le32(instr->start);
xinstr->loop_start = __cpu_to_le32(instr->loop_start);
xinstr->loop_end = __cpu_to_le32(instr->loop_end);
xinstr->loop_repeat = __cpu_to_le16(instr->loop_repeat);
xinstr->effect1 = instr->effect1;
xinstr->effect1_depth = instr->effect1_depth;
xinstr->effect2 = instr->effect2;