Region::Region(Palette* p, int i) { spritelist = new SpriteList(); id = i; name = ""; SetTypeAndSid(UNKNOWN, 0, 0); _loop = NULL; _disableNotes = false; palette = p; _lastScheduled = -1; _chording = false; _looping = DEFAULT_LOOPING; NosuchLockInit(&_region_mutex,"region"); // spritelist_rwlock = PTHREAD_RWLOCK_INITIALIZER; cursorlist_rwlock = PTHREAD_RWLOCK_INITIALIZER; // int rc1 = pthread_rwlock_init(&spritelist_rwlock, NULL); int rc = pthread_rwlock_init(&cursorlist_rwlock, NULL); if ( rc ) { NosuchDebug("Failure on pthread_rwlock_init!? rc=%d",rc); } _latestNoteTime = 0; x_min = 0.00f; y_min = 0.00f; x_max = 1.0f; y_max = 1.0f; _channel = -1; #if 0 PaletteHost* ph = p->paletteHost(); _graphicBehaviour = ph->makeGraphicBehaviour(this); _musicBehaviour = ph->makeMusicBehaviour(this); #endif _noteBehaviour = new NoteBehaviourDefault(this); initParams(); }
Region::Region(Palette* p, int i) { spritelist = new VizSpriteList(); DEBUGPRINT1(("Region constructor i=%d spritelist=%ld",i,(long)spritelist)); id = i; name = ""; setTypeAndSid(UNKNOWN, 0, 0); _disableNotes = false; _palette = p; _lastScheduled = -1; _chording = false; NosuchLockInit(&_region_mutex,"region"); _latestNoteTime = 0; x_min = 0.000f; // Used to be 0.001f, not sure why y_min = 0.000f; // Used to be 0.001f, not sure why x_max = 1.000f; // Used to be 0.999f, not sure why y_max = 1.000f; // Used to be 0.999f, not sure why _channel = -1; _regionParams = new AllVizParams(true); // loads defaults // _regionSpecificParams = NULL; PaletteHost* ph = p->paletteHost(); // _graphicBehaviour = ph->makeGraphicBehaviour(this); _graphicBehaviour = new GraphicBehaviour(this); _musicBehaviour = new MusicBehaviour(this); numalive = 0; debugcount = 0; last_tm = 0; leftover_tm = 0; // fire_period = 10; // milliseconds fire_period = 1; // milliseconds onoff = 0; }
Channel::Channel(Palette* p, int i) { NosuchAssert( i >= 0 && i <= 15); // spritelist = new VizSpriteList(); id = i; _midiBehaviour = NULL; _midiBehaviourName = ""; _palette = p; #ifdef LOOPSTUFF _loop = NULL; _looping = false; #endif NosuchLockInit(&_channel_mutex,"channel"); // spritelist_rwlock = PTHREAD_RWLOCK_INITIALIZER; // int rc1 = pthread_rwlock_init(&spritelist_rwlock, NULL); // if ( rc1 ) { // NosuchDebug("Failure on pthread_rwlock_init!? rc=%d",rc1); // } // NosuchDebug(2,"spritelist_rwlock has been initialized"); }
Palette::Palette(PaletteHost* b) { // _highest_nonbutton_region_id = 4; NosuchLockInit(&_palette_mutex,"palette"); musicscale = "newage"; currentConfig = ""; _paletteHost = b; _shifted = false; _soundbank = 0; _recentSpaceCursor = NULL; // Assume 16 MIDI channels for ( int i=0; i<16; i++ ) { Channel* c = new Channel(this,i); _channels.push_back(c); } now = 0; // Don't use Pt_Time(), it may not have been started yet NosuchDebug(1,"Palette constructor, setting now to %d",now); frames = 0; frames_last = now; clearButtonDownAndUsed(); }