git-svn-id: svn+ssh://jackaudio.org/trunk/jack@835 0c269be4-1314-0410-8aa9-9f06e86f4224tags/0.109.0
| @@ -261,12 +261,6 @@ | |||
| settings = { | |||
| }; | |||
| }; | |||
| 4B117C5C05DD0C4100B5DA5A = { | |||
| fileRef = 4B117C5A05DD0C4100B5DA5A; | |||
| isa = PBXBuildFile; | |||
| settings = { | |||
| }; | |||
| }; | |||
| 4B117C5D05DD0C5B00B5DA5A = { | |||
| fileEncoding = 30; | |||
| isa = PBXFileReference; | |||
| @@ -282,12 +276,6 @@ | |||
| settings = { | |||
| }; | |||
| }; | |||
| 4B117C5F05DD0C5B00B5DA5A = { | |||
| fileRef = 4B117C5D05DD0C5B00B5DA5A; | |||
| isa = PBXBuildFile; | |||
| settings = { | |||
| }; | |||
| }; | |||
| 4B117C6305DD0C8000B5DA5A = { | |||
| fileEncoding = 30; | |||
| isa = PBXFileReference; | |||
| @@ -1143,8 +1131,6 @@ | |||
| 4BA1CADB0470D14500053105 = { | |||
| buildActionMask = 2147483647; | |||
| files = ( | |||
| 4B117C5C05DD0C4100B5DA5A, | |||
| 4B117C5F05DD0C5B00B5DA5A, | |||
| 4B117C6505DD0C8000B5DA5A, | |||
| 4B117C6805DD0C8700B5DA5A, | |||
| 4B117C6B05DD0C8D00B5DA5A, | |||
| @@ -1212,7 +1198,7 @@ | |||
| <key>CFBundleExecutable</key> | |||
| <string>Jack</string> | |||
| <key>CFBundleGetInfoString</key> | |||
| <string>Jack Server 0.99.10, @03-04 Paul Davis, Grame</string> | |||
| <string>Jack Server 0.99.27, @03-04 Paul Davis, Grame</string> | |||
| <key>CFBundleIconFile</key> | |||
| <string></string> | |||
| <key>CFBundleIdentifier</key> | |||
| @@ -1228,7 +1214,7 @@ | |||
| <key>CFBundleSignature</key> | |||
| <string>????</string> | |||
| <key>CFBundleVersion</key> | |||
| <string>0.99.10</string> | |||
| <string>0.99.27</string> | |||
| </dict> | |||
| </plist> | |||
| "; | |||
| @@ -326,7 +326,7 @@ bool AudioRender::ConfigureAudioProc(float sampleRate, long bufferSize, | |||
| vBufferSize = (long) bufFrame; | |||
| if ((long) bufFrame != bufferSize) { | |||
| JCALog("I'm trying to set a new buffer size.\n"); | |||
| JCALog("I'm trying to set a new buffer size %ld \n",bufferSize); | |||
| UInt32 theSize = sizeof(UInt32); | |||
| UInt32 newBufferSize = (UInt32) bufferSize; | |||
| err = | |||
| @@ -353,7 +353,7 @@ bool AudioRender::ConfigureAudioProc(float sampleRate, long bufferSize, | |||
| vSampleRate = (float) SR.mSampleRate; | |||
| if ((float) SR.mSampleRate != sampleRate) { | |||
| JCALog("I'm trying to set a new sample rate.\n"); | |||
| JCALog("I'm trying to set a new sample rate %ld\n",sampleRate); | |||
| UInt32 theSize = sizeof(AudioStreamBasicDescription); | |||
| SR.mSampleRate = (Float64) sampleRate; | |||
| err = AudioDeviceSetProperty(vDevice, NULL, 0, false, | |||
| @@ -29,8 +29,9 @@ | |||
| Feb 04, 2004: Johnny Petrantoni: now the driver supports interfaces with multiple interleaved streams (such as the MOTU 828). | |||
| Nov 05, 2004: S.Letz: correct management of -I option for use with JackPilot. | |||
| Nov 15, 2004: S.Letz: Set a default value for deviceID. | |||
| Nov 30, 2004: S.Letz: In coreaudio_driver_write : clear to avoid playing dirty buffers when the client does not produce output anymore. | |||
| Nov 30, 2004: S.Letz: In coreaudio_driver_write : clear to avoid playing dirty buffers when the client does not produce output anymore. | |||
| Dec 05, 2004: S.Letz: XRun detection | |||
| Dec 09, 2004: S.Letz: Dynamic buffer size change | |||
| TODO: | |||
| - fix cpu load behavior. | |||
| @@ -83,7 +84,8 @@ int coreaudio_runCycle(void *driver, long bufferSize) | |||
| coreaudio_driver_t *ca_driver = (coreaudio_driver_t *) driver; | |||
| if (ca_driver->xrun_detected > 0) { /* XRun was detected */ | |||
| jack_time_t current_time = jack_get_microseconds(); | |||
| ca_driver->engine->delay(ca_driver->engine, current_time - (ca_driver->last_wait_ust + ca_driver->period_usecs)); | |||
| ca_driver->engine->delay(ca_driver->engine, current_time - | |||
| (ca_driver->last_wait_ust + ca_driver->period_usecs)); | |||
| ca_driver->last_wait_ust = current_time; | |||
| ca_driver->xrun_detected = 0; | |||
| return 0; | |||
| @@ -113,12 +115,11 @@ coreaudio_driver_attach(coreaudio_driver_t * driver, | |||
| driver->engine->set_buffer_size(engine, driver->frames_per_cycle); | |||
| driver->engine->set_sample_rate(engine, driver->frame_rate); | |||
| port_flags = | |||
| JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal; | |||
| port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal; | |||
| /* | |||
| if (driver->has_hw_monitoring) { | |||
| port_flags |= JackPortCanMonitor; | |||
| port_flags |= JackPortCanMonitor; | |||
| } | |||
| */ | |||
| @@ -328,36 +329,43 @@ static int coreaudio_driver_audio_stop(coreaudio_driver_t * driver) | |||
| return (!stopPandaAudioProcess(driver->stream)) ? -1 : 0; | |||
| } | |||
| #if 0 | |||
| static int | |||
| coreaudio_driver_bufsize(coreaudio_driver_t * driver, | |||
| jack_nframes_t nframes) | |||
| { | |||
| /* This gets called from the engine server thread, so it must | |||
| * be serialized with the driver thread. Stopping the audio | |||
| * be serialized with the driver thread. Stopping the audio | |||
| * also stops that thread. */ | |||
| closePandaAudioInstance(driver->stream); | |||
| driver->frames_per_cycle = nframes; | |||
| driver->stream = | |||
| openPandaAudioInstance((float) driver->frame_rate, | |||
| driver->frames_per_cycle, driver->capturing, | |||
| driver->playing, &driver->driver_name[0]); | |||
| if (!driver->stream) return -1; | |||
| if (!driver->stream) | |||
| return FALSE; | |||
| setHostData(driver->stream, driver); | |||
| setHostData(driver->stream, driver); | |||
| setCycleFun(driver->stream, coreaudio_runCycle); | |||
| setXRunFun(driver->stream, coreaudio_XRun); | |||
| setParameter(driver->stream, 'inte', &driver->isInterleaved); | |||
| setParameter(driver->stream, 'nstr', &driver->numberOfInputStreams); | |||
| setParameter(driver->stream, 'nstO', &driver->numberOfOuputStreams); | |||
| setParameter(driver->stream, 'cstr', driver->channelsPerInputStream); | |||
| setParameter(driver->stream, 'cstO', driver->channelsPerOuputStream); | |||
| driver->incoreaudio = getPandaAudioInputs(driver->stream); | |||
| driver->outcoreaudio = getPandaAudioOutputs(driver->stream); | |||
| driver->engine->set_buffer_size (driver->engine, | |||
| driver->frames_per_cycle); | |||
| return startPandaAudioProcess(driver->stream); | |||
| return startPandaAudioProcess(driver->stream) ? 0 : -1; | |||
| } | |||
| #endif | |||
| /** create a new driver instance | |||
| */ | |||
| @@ -397,7 +405,7 @@ static jack_driver_t *coreaudio_driver_new(char *name, | |||
| driver->write = (JackDriverReadFunction) coreaudio_driver_write; | |||
| driver->null_cycle = | |||
| (JackDriverNullCycleFunction) coreaudio_driver_null_cycle; | |||
| //driver->bufsize = (JackDriverBufSizeFunction) coreaudio_driver_bufsize; | |||
| driver->bufsize = (JackDriverBufSizeFunction) coreaudio_driver_bufsize; | |||
| driver->start = (JackDriverStartFunction) coreaudio_driver_audio_start; | |||
| driver->stop = (JackDriverStopFunction) coreaudio_driver_audio_stop; | |||
| driver->stream = NULL; | |||
| @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) | |||
| rc = jack_set_buffer_size(client, nframes); | |||
| if (rc) | |||
| fprintf(stderr, "jack_set_buffer_size(): %s\n", strerror(rc)); | |||
| jack_client_close(client); | |||
| return rc; | |||
| @@ -406,9 +406,15 @@ jack_resize_port_segment (jack_engine_t *engine, | |||
| if (port_type->buffer_scale_factor < 0) { | |||
| one_buffer = port_type->buffer_size; | |||
| } else { | |||
| // steph | |||
| /* | |||
| one_buffer = sizeof (jack_default_audio_sample_t) | |||
| * port_type->buffer_scale_factor | |||
| * engine->control->buffer_size; | |||
| */ | |||
| one_buffer = sizeof (jack_default_audio_sample_t) | |||
| * port_type->buffer_scale_factor | |||
| * 8192; | |||
| } | |||
| size = nports * one_buffer; | |||
| @@ -441,12 +447,14 @@ jack_resize_port_segment (jack_engine_t *engine, | |||
| } else { | |||
| /* resize existing buffer segment */ | |||
| /* | |||
| if (jack_resize_shm (shm_info, size)) { | |||
| jack_error ("cannot resize port segment to %d bytes," | |||
| " (%s)", size, | |||
| strerror (errno)); | |||
| return; | |||
| } | |||
| */ | |||
| } | |||
| jack_engine_place_port_buffers (engine, ptid, one_buffer, size, nports); | |||
| @@ -798,6 +806,8 @@ jack_calc_cpu_load(jack_engine_t *engine) | |||
| engine->rolling_client_usecs[engine->rolling_client_usecs_index++] = | |||
| cycle_end - engine->control->current_time.usecs; | |||
| //printf("cycle_end - engine->control->current_time.usecs %ld\n", (long) (cycle_end - engine->control->current_time.usecs)); | |||
| if (engine->rolling_client_usecs_index >= JACK_ENGINE_ROLLING_COUNT) { | |||
| engine->rolling_client_usecs_index = 0; | |||
| @@ -452,8 +452,8 @@ _start_server (void) | |||
| good = 1; | |||
| } | |||
| } | |||
| if (!good) { | |||
| #define JACK_LOCATION | |||
| #if defined(USE_CAPABILITIES) | |||
| command = JACK_LOCATION "/jackstart"; | |||
| strncpy(arguments, JACK_LOCATION "/jackstart -T -R -d " | |||
| @@ -1187,7 +1187,6 @@ jack_client_thread (void *arg) | |||
| case BufferSizeChange: | |||
| jack_client_invalidate_port_buffers (client); | |||
| if (control->bufsize) { | |||
| status = control->bufsize | |||
| (control->nframes, | |||
| @@ -347,7 +347,10 @@ jack_destroy_shm (jack_shm_info_t* si) | |||
| void | |||
| jack_release_shm (jack_shm_info_t* si) | |||
| { | |||
| printf("client->jack_release_shm \n"); | |||
| if (si->attached_at != MAP_FAILED) { | |||
| printf("client->jack_release_shm 1 \n"); | |||
| munmap (si->attached_at, jack_shm_registry[si->index].size); | |||
| } | |||
| } | |||
| @@ -417,10 +420,32 @@ jack_attach_shm (jack_shm_info_t* si) | |||
| return 0; | |||
| } | |||
| int | |||
| jack_resize_shm (jack_shm_info_t* si, jack_shmsize_t size) | |||
| { | |||
| /* There is no way to resize a System V shm segment. So, we | |||
| * delete it and allocate a new one. This is tricky, because | |||
| * the old segment will not disappear until all the clients | |||
| * have released it. We can only do what we can from here. | |||
| */ | |||
| jack_release_shm (si); | |||
| jack_destroy_shm (si); | |||
| if (jack_shmalloc ("not used", size, si)) { | |||
| return -1; | |||
| } | |||
| return jack_attach_shm (si); | |||
| } | |||
| /* | |||
| int | |||
| jack_resize_shm (jack_shm_info_t* si, jack_shmsize_t size) | |||
| { | |||
| int shm_fd; | |||
| //steph | |||
| int res; | |||
| jack_shm_registry_t *registry = &jack_shm_registry[si->index]; | |||
| if ((shm_fd = shm_open (registry->id, O_RDWR, 0666)) < 0) { | |||
| @@ -429,13 +454,17 @@ jack_resize_shm (jack_shm_info_t* si, jack_shmsize_t size) | |||
| return -1; | |||
| } | |||
| munmap (si->attached_at, registry->size); | |||
| if (ftruncate (shm_fd, size) < 0) { | |||
| res = munmap (si->attached_at, registry->size); | |||
| printf("munmap %ld\n", res); | |||
| if ((res = ftruncate (shm_fd, size)) < 0) { | |||
| jack_error ("cannot set size of shm segment %s " | |||
| "(%s)", registry->id, strerror (errno)); | |||
| printf("ftruncate %ld\n", res); | |||
| return -1; | |||
| } | |||
| if ((si->attached_at = mmap (0, size, PROT_READ|PROT_WRITE, | |||
| MAP_SHARED, shm_fd, 0)) == MAP_FAILED) { | |||
| @@ -448,6 +477,7 @@ jack_resize_shm (jack_shm_info_t* si, jack_shmsize_t size) | |||
| close (shm_fd); | |||
| return 0; | |||
| } | |||
| */ | |||
| #else /* USE_POSIX_SHM */ | |||