예제 #1
0
/* Build and write one tick (one PAL frame or 1/50 s in standard vblank
 * timed mods) of audio data to the output device.
 *
 * Apparently ALwritesamps requires the number of samples instead of
 * the number of bytes, which is what I assume i is.  This was a
 * trial-and-error fix, but it appears to work. - 19990706 bdowning
 */
static void bufdump(struct xmp_context *ctx, int i)
{
	if (al_sample_16)
		ALwritesamps(audio_port, xmp_smix_buffer(ctx), i / 2);
	else
		ALwritesamps(audio_port, xmp_smix_buffer(ctx), i);
}
예제 #2
0
/* Build and write one tick (one PAL frame or 1/50 s in standard vblank
 * timed mods) of audio data to the output device.
 */
static void bufdump(struct xmp_context *ctx, int i)
{
	uint8 *b;
	int j = 0;

	/* block until we have enough free space in the buffer */
	while (buf_free() < i)
		snooze(100000);

	b = (uint8 *)xmp_smix_buffer(ctx);

	while (i) {
        	if ((j = write_buffer(b, i)) > 0) {
			i -= j;
			b += j;
		} else
			break;
	}

	if (paused) {
		player->Start(); 
		player->SetHasData(true);
		paused = 0;
	}
}
static void
bufdump (struct xmp_context *ctx, int len)
{
	 void *buf;

	 if ((buf = xmp_smix_buffer (ctx)) != NULL)
		 sio_write (hdl, buf, len);
}
JNIEXPORT jshortArray JNICALL
Java_org_helllabs_android_xmp_Xmp_getBuffer(JNIEnv *env, jobject obj, jint size, jshortArray buffer)
{
	short *b;

	size /= 2;
	b = (short *)xmp_smix_buffer(ctx);
	(*env)->SetShortArrayRegion(env, buffer, 0, size, b);

	return buffer;
}
예제 #5
0
/* Build and write one tick (one PAL frame or 1/50 s in standard vblank
 * timed mods) of audio data to the output device.
 */
static void bufdump(struct xmp_context *ctx, int i)
{
	void *b;
	int frames;

	b = xmp_smix_buffer(ctx);
	frames = snd_pcm_bytes_to_frames(pcm_handle, i);
	if (snd_pcm_writei(pcm_handle, b, frames) < 0) {
		snd_pcm_prepare(pcm_handle);
	}
}
/* Build and write one tick (one PAL frame or 1/50 s in standard vblank
 * timed mods) of audio data to the output device.
 */
static void bufdump(struct xmp_context *ctx, int i)
{
	int j;
	void *b;

	b = xmp_smix_buffer(ctx);
	while (i) {
		if ((j = write(audio_fd, b, i)) > 0) {
			i -= j;
			b = (char *)b + j;
		} else
			break;
	}
}
예제 #7
0
static void bufdump(struct xmp_context *ctx, int i)
{
	int j;
	void *b;

	b = xmp_smix_buffer(ctx);
	do {
		if ((j = write(fd_audio, b, i)) > 0) {
			i -= j;
			b += j;
		} else
			break;
	} while (i);
}
static void bufdump(struct xmp_context *ctx, int len)
{
	memcpy(buffer[nextbuffer], xmp_smix_buffer(ctx), len);

	while ((nextbuffer + 1) % num_buffers == freebuffer)
		Sleep(10);

        header[nextbuffer].dwBufferLength = len;
	waveOutPrepareHeader(hwaveout, &header[nextbuffer], sizeof(WAVEHDR));
        waveOutWrite(hwaveout, &header[nextbuffer], sizeof(WAVEHDR));

        nextbuffer++;
	nextbuffer %= num_buffers;
}
예제 #9
0
static void bufdump(struct xmp_context *ctx, int len)
{
	int buf_cnt = 0;
	unsigned char *buf = xmp_smix_buffer(ctx);

	_D(_D_INFO "bufdump: %d", len);

	while ((info.buf_cnt + (len - buf_cnt)) > info.buf_size) {
		memcpy(info.buf + info.buf_cnt, buf + buf_cnt,
		       (info.buf_size - info.buf_cnt));
		buf_cnt += (info.buf_size - info.buf_cnt);
		info.buf_cnt += (info.buf_size - info.buf_cnt);
		nas_flush();
	}

	memcpy(info.buf + info.buf_cnt, buf + buf_cnt, (len - buf_cnt));
	info.buf_cnt += (len - buf_cnt);
}
예제 #10
0
static void bufdump(struct xmp_context *ctx, int i)
{
	int j, error;
	void *b;

	b = xmp_smix_buffer(ctx);
	do {
		if ((j = pa_simple_write(s, b, i, &error)) > 0) {
			i -= j;
			b += j;
		} else
			break;
	} while (i);

	if (j < 0) {
		fprintf(stderr, "pulseaudio error: %s\n", pa_strerror(error));
	}
}
예제 #11
0
/* Build and write one tick (one PAL frame or 1/50 s in standard vblank
 * timed mods) of audio data to the output device.
 */
static void bufdump(struct xmp_context *ctx, int i)
{
	void *b;

	b = xmp_smix_buffer(ctx);
	/* Note this assumes a fragment size of (frag_size) */
	while (i > 0) {
		size_t f = (frag_size) - (mybuffer_nextfree - mybuffer);
		size_t to_copy = (f < i) ? f : i;

		memcpy(mybuffer_nextfree, b, to_copy);
		b += to_copy;
		mybuffer_nextfree += to_copy;
		f -= to_copy;
		i -= to_copy;
		if (f == 0) {
			snd_pcm_plugin_write(pcm_handle, mybuffer, frag_size);
			mybuffer_nextfree = mybuffer;
		}
	}
}
void xmp_get_buffer(xmp_context ctx, void **buffer, int *size)
{
	*size = xmp_smix_softmixer((struct xmp_context *)ctx);
	*buffer = xmp_smix_buffer((struct xmp_context *)ctx);
}