|
From: Brenda L. <asp...@us...> - 2003-05-13 22:48:56
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm-sound-MacOSX
In directory sc8-pr-cvs1:/tmp/cvs-serv30463/vm-sound-MacOSX
Added Files:
Makefile.inc acinclude.m4 sqUnixSoundDebug.h
sqUnixSoundMacOSX.c
Log Message:
Ian Piumarta's release 3.5-1devel
--- NEW FILE: Makefile.inc ---
PLIBS= -Wl,-framework -Wl,CoreAudio \
-Wl,-framework -Wl,AudioToolbox
--- NEW FILE: acinclude.m4 ---
# -*- sh -*-
AC_MSG_CHECKING([for Mac OS X CoreAudio])
AC_TRY_COMPILE([#include <CoreAudio/CoreAudio.h>],[kAudioHardwareNoError;],[
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
AC_PLUGIN_DISABLE
])
--- NEW FILE: sqUnixSoundDebug.h ---
#if 1
# define startSpy();
# define stopSpy();
#else
#include <pthread.h>
void rect(int h, int c, float l, float r)
{
extern long *dpyPixels;
extern int dpyPitch;
int left= 250, width= 100, height= 2;
long *base= dpyPixels;
int pitch= dpyPitch / sizeof(long);
int x, y;
//printf("rect %d %d %g %g\n", h, c, l, r);
assert(l >= 0.0); assert(r >= 0.0);
assert(l <= 1.0); assert(r <= 1.0);
base+= (int)left;
base+= (int)(h * height * pitch);
for (y= 0; y < height; ++y)
{
for (x= (int)(width * l); x < (int)(width * r); ++x)
((long *)base)[x]= c;
base+= pitch;
}
}
void fill(int h, int c, float l, float r)
{
if (r > 1.0)
{
rect(h, c, l, 1.0);
rect(h, c, 0.0, r - 1.0);
}
else
rect(h, c, l, r);
}
#if (USE_FIFO)
void update(void)
{
if (output)
{
Buffer *b= output->buffer;
static int phase= 0;
float size= b->size;
float out= b->optr / size;
float avail= b->avail / size;
extern long *dpyPixels;
fill(0,BLACK, 0.0, out);
fill(0,GREEN, out, out+avail);
if (out + avail < 1.0)
fill(0,BLACK, out+avail, 1.0);
fill(2,GREEN, 0.0, avail);
fill(2,BLACK, avail, 1.0);
phase= 1 - phase;
feedback(10, phase * WHITE);
memcpy(dpyPixels + 400, output->buffer->data, 400);
}
}
#else
void update(void)
{
}
#endif
static int running= 0;
static pthread_t spyThread;
static void *spy(void *ignored)
{
struct sched_param params;
int policy;
if (pthread_getschedparam(pthread_self(), &policy, ¶ms))
perror("getschedparam");
params.sched_priority+= 9;
if (pthread_setschedparam(pthread_self(), SCHED_RR, ¶ms))
perror("setschedparam");
for (;;)
{
update();
usleep(10000);
}
}
void startSpy(void)
{
if (!pthread_create(&spyThread, 0, spy, 0))
running= 1;
else
perror("pthread_create(spy)");
}
void stopSpy(void)
{
if (running)
{
if (!pthread_cancel(spyThread))
running= 0;
else
perror("pthread_cancel(spy)");
running= 0;
}
}
#endif // (DEBUG)
--- NEW FILE: sqUnixSoundMacOSX.c ---
/* sqUnixSoundMacOSX.c -- sound support for CoreAudio on Mac OS 10
*
* Author: Ian...@in...
*
* Last edited: 2003-02-09 17:52:51 by piumarta on emilia.inria.fr
*
* Copyright (C) 1996-2002 Ian Piumarta and other authors/contributors
* as listed elsewhere in this file.
* All rights reserved.
*
* You are NOT ALLOWED to distribute modified versions of this file
* under its original name. If you want to modify it and then make
* your modifications available publicly, rename the file first.
*
* This file is part of Unix Squeak.
*
* This file is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
[...1808 lines suppressed...]
#endif // TESTING
#include "SqSound.h"
SqSoundDefine(MacOSX);
#include "SqModule.h"
static void sound_parseEnvironment(void) {}
static int sound_parseArgument(int argc, char **argv) { return 0; }
static void sound_printUsage(void) {}
static void sound_printUsageNotes(void) {}
static void *sound_makeInterface(void) { return &sound_MacOSX_itf; }
SqModuleDefine(sound, MacOSX);
|