--- linuxsampler/trunk/src/linuxsampler.cpp 2004/12/21 04:54:37 325 +++ linuxsampler/trunk/src/linuxsampler.cpp 2005/02/26 02:01:14 411 @@ -3,6 +3,7 @@ * LinuxSampler - modular, streaming capable sampler * * * * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * + * Copyright (C) 2005 Christian Schoenebeck * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -71,6 +72,7 @@ dmsg(1,("LinuxSampler %s\n", VERSION)); dmsg(1,("Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck\n")); + dmsg(1,("Copyright (C) 2005 Christian Schoenebeck\n")); if (tune) { @@ -110,7 +112,13 @@ printf("LinuxSampler initialization completed.\n"); - while(true) { + std::list rtEvents; + rtEvents.push_back(LSCPEvent::event_voice_count); + rtEvents.push_back(LSCPEvent::event_stream_count); + rtEvents.push_back(LSCPEvent::event_buffer_fill); + + while(true) + { /*printf("Voices: %3.3d (Max: %3.3d) Streams: %3.3d (Max: %3.3d, Unused: %3.3d)\r", pEngine->ActiveVoiceCount, pEngine->ActiveVoiceCountMax, pEngine->pDiskThread->ActiveStreamCount, pEngine->pDiskThread->ActiveStreamCountMax, Stream::GetUnusedStreams()); @@ -126,6 +134,25 @@ fflush(stdout); } } + + if (LSCPServer::EventSubscribers(rtEvents)) + { + LSCPServer::LockRTNotify(); + std::map channels = pSampler->GetSamplerChannels(); + std::map::iterator iter = channels.begin(); + for (; iter != channels.end(); iter++) { + SamplerChannel* pSamplerChannel = iter->second; + EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); + if (!pEngineChannel) continue; + Engine* pEngine = pEngineChannel->GetEngine(); + if (!pEngine) continue; + LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_voice_count, iter->first, pEngine->VoiceCount())); + LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_stream_count, iter->first, pEngine->DiskStreamCount())); + LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_buffer_fill, iter->first, pEngine->DiskStreamBufferFillPercentage())); + } + LSCPServer::UnlockRTNotify(); + } + } return EXIT_SUCCESS; @@ -193,7 +220,11 @@ }; while (true) { - res = getopt_long_only(argc, argv, "", long_options, &option_index); + /* + Stephane Letz : letz@grame.fr + getopt_long_only does not exist on OSX : replaced by getopt_long for now. + */ + res = getopt_long(argc, argv, "", long_options, &option_index); if(res == -1) break; if (res == 0) { switch(option_index) { @@ -206,7 +237,8 @@ exit(EXIT_SUCCESS); break; case 1: // --version - printf("LinuxSampler %s\n", VERSION); + printf("LinuxSampler %s\n", VERSION); + exit(EXIT_SUCCESS); break; case 2: // --profile profile = true;