Exemplo n.º 1
0
// This is used when you want to swap the channel group starting
// at s1 with that starting at s2.
// The complication is that the tracks are stored in a single
// linked list.
void TrackList::SwapNodes(TrackNodePointer s1, TrackNodePointer s2)
{
   // if a null pointer is passed in, we want to know about it
   wxASSERT(!isNull(s1));
   wxASSERT(!isNull(s2));

   // Deal with first track in each team
   s1 = ( * FindLeader( s1.first->get() ) )->GetNode();
   s2 = ( * FindLeader( s2.first->get() ) )->GetNode();

   // Safety check...
   if (s1 == s2)
      return;

   // Be sure s1 is the earlier iterator
   if ((*s1.first)->GetIndex() >= (*s2.first)->GetIndex())
      std::swap(s1, s2);

   // For saving the removed tracks
   using Saved = std::vector< ListOfTracks::value_type >;
   Saved saved1, saved2;

   auto doSave = [&] ( Saved &saved, TrackNodePointer &s ) {
      size_t nn = Channels( s.first->get() ).size();
      saved.resize( nn );
      // Save them in backwards order
      while( nn-- )
         saved[nn] = *s.first, s.first = erase(s.first);
   };

   doSave( saved1, s1 );
   // The two ranges are assumed to be disjoint but might abut
   const bool same = (s1 == s2);
   doSave( saved2, s2 );
   if (same)
      // Careful, we invalidated s1 in the second doSave!
      s1 = s2;

   // Reinsert them
   auto doInsert = [&] ( Saved &saved, TrackNodePointer &s ) {
      Track *pTrack;
      for (auto & pointer : saved)
         pTrack = pointer.get(),
         // Insert before s, and reassign s to point at the new node before
         // old s; which is why we saved pointers in backwards order
         pTrack->SetOwner(shared_from_this(),
            s = { insert(s.first, pointer), this } );
   };
   // This does not invalidate s2 even when it equals s1:
   doInsert( saved2, s1 );
   // Even if s2 was same as s1, this correctly inserts the saved1 range
   // after the saved2 range, when done after:
   doInsert( saved1, s2 );

   // Now correct the Index in the tracks, and other things
   RecalcPositions(s1);
   PermutationEvent();
}
Exemplo n.º 2
0
	/**
	 *  @alsymbols
	 *  @alfunref{GetBuffer}
	 *  @aldefref{SIZE}
	 *  @aldefref{FREQUENCY}
	 *  @aldefref{BITS}
	 *  @aldefref{CHANNELS}
	 */
	ALfloat Duration(void) const
	{
		ALfloat s = Size();
		ALfloat f = Frequency();
		ALfloat b = Bits()/8.0f;
		ALfloat c = Channels();
		ALfloat bps = f*b*c;
		return bps>0.0f?ALfloat(s/bps):ALfloat(0);
	}
Exemplo n.º 3
0
MediaPacket::MediaPacket(IN const AVStream& _avStream, IN const AVPacket* _pAvPacket)
{
    // save codec pointer
    pAvCodecPar_ = _avStream.codecpar;
    enum AVMediaType stream = pAvCodecPar_->codec_type;
    if (stream != AVMEDIA_TYPE_AUDIO && stream != AVMEDIA_TYPE_VIDEO) {
        stream = AVMEDIA_TYPE_DATA;
    }
    SetStreamType(stream);
    SetCodec(pAvCodecPar_->codec_id);
    Width(pAvCodecPar_->width);
    Height(pAvCodecPar_->height);
    SampleRate(pAvCodecPar_->sample_rate);
    Channels(pAvCodecPar_->channels);

    // copy packet
    pAvPacket_ = const_cast<AVPacket*>(_pAvPacket);
}
Exemplo n.º 4
0
tbool CTake_Data::Needs_Pict_Files()
{

// peak files
#ifdef _Mac_PowerPC
	std::string sExtencion1		=	".kspk1024_ppc";
	std::string sExtencion2		=	".kspk64_ppc";
#else _Mac_PowerPC
	std::string sExtencion1		=	".kspk1024";
	std::string sExtencion2		=	".kspk64";
#endif // _Mac_PowerPC
	
	
	tbool bOK			= true;
	tuint uiTest;
	
	
	switch(  Channels() ) {
		case 1:
		{	// mono 
			msLeft_Peak_File_Path = gpApplication->Pict_File_Folder() + Disk_Name(1);
			uiTest	=	gpApplication->Is_A_File(msLeft_Peak_File_Path + sExtencion1);
			uiTest	+=  gpApplication->Is_A_File(msLeft_Peak_File_Path + sExtencion2);
			
			bOK = uiTest == 2 ? false: true;
			break;
		}
		case 2:
		{	// stereo
			msLeft_Peak_File_Path = gpApplication->Pict_File_Folder() + Disk_Name(1);
			uiTest	=	gpApplication->Is_A_File(msLeft_Peak_File_Path + sExtencion1);
			uiTest	+=  gpApplication->Is_A_File(msLeft_Peak_File_Path + sExtencion2);
			
			msRight_Peak_File_Path = gpApplication->Pict_File_Folder() + Disk_Name(2);
			uiTest	+=  gpApplication->Is_A_File(msRight_Peak_File_Path + sExtencion1);
			uiTest	+=  gpApplication->Is_A_File(msRight_Peak_File_Path + sExtencion2);
			
			bOK = uiTest == 4 ? false: true;
			break;
		}
		default: break;
	}
	return bOK;
}
Exemplo n.º 5
0
/// For mono track height of track
/// For stereo track combined height of both channels.
int TrackList::GetGroupHeight(const Track * t) const
{
   return Channels(t).sum( &Track::GetHeight );
}
Exemplo n.º 6
0
    cv::gpu::GpuMat templ(templ_host);
    cv::gpu::GpuMat dst;

    cv::gpu::matchTemplate(image, templ, dst, method);

    TEST_CYCLE()
    {
        cv::gpu::matchTemplate(image, templ, dst, method);
    }
};

INSTANTIATE_TEST_CASE_P(ImgProc, MatchTemplate_8U, testing::Combine(
    ALL_DEVICES,
    GPU_TYPICAL_MAT_SIZES,
    testing::Values(TemplateSize(cv::Size(5, 5)), TemplateSize(cv::Size(16, 16)), TemplateSize(cv::Size(30, 30))),
    testing::Values(Channels(1), Channels(3), Channels(4)),
    ALL_TEMPLATE_METHODS));

////////////////////////////////////////////////////////////////////////////////
// MatchTemplate_32F

GPU_PERF_TEST(MatchTemplate_32F, cv::gpu::DeviceInfo, cv::Size, TemplateSize, Channels, TemplateMethod)
{
    cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
    cv::gpu::setDevice(devInfo.deviceID());

    cv::Size size = GET_PARAM(1);
    cv::Size templ_size = GET_PARAM(2);
    int cn = GET_PARAM(3);
    int method = GET_PARAM(4);
Exemplo n.º 7
0
void ofApp::setup() {

    ofBackground(20);
    ofSetFrameRate(30);
    
    initAssets();
    ChladniDB::setup();

    
    midiIn.ignoreTypes(false, false, false);
    midiIn.addListener(this);
    midiIn.setVerbose(true);
//    midiIn.listPorts();
    midiIn.openPort("virtualMIDI Bus 1");	// by name
    
//    panel.setup();
//    panel.add(button.setup("something"));
//    button.setup("something");
    
//    ofSoundStreamListDevices();
//    button.draw();

    PianoKeys::Key::baseOnCol = ofColor(255, 100, 100);

//    ofSetEscapeQuitsApp(false);

    int pianoHeight = 50;
    pianoKeys = PianoKeys(0, 7, 0, 0, ofGetWidth(), pianoHeight);
    channels = Channels(5, 0, pianoHeight);
    
    plateManager = new PlateManager();
//    plateManager->setup(5, 5);
    plateManager->setup(5, 1);
    
    pm = plateManager;
    
    cam.setTranslationKey('t');
    cam.setFarClip(20000);
    resetView();
    PlateManager::drawSpecial = false;

    panel.setup("");
    midiNotesGroup.setup("MIDI notes");
    patternFreqsGroup.setup("Pattern Frequencies");

//    panel.add(xx.set("something", 2, 0, 3));
//
//
//    ofParameterGroup g;
//    g.setName("asdf 2");
//    g.add(xx.set("something 2", 1, 0, 3));
//    panel.add(g);
//    panel.add(label.setup(ofParameter<string>("", "hi there")));
//    toggle.setup(ofParameter<bool>("tog", true));
//    toggle.addListener(this, &ofApp::valChange);
//
//    panel.add(&toggle);
//    panel.setPosition(200, 200);
    
    currentRenderType = NORMAL;
    currentPlate = NULL;
    showPanel = false;
    needsToRedrawPanel = false;
    noSelectionMode = false;
    
    connectMode = false;
    connecting = false;
    connectedPlate = NULL;
    
    noteToFigureManager = new PlateManagerMidi();
    noteToFigureManager->setup(FIGURE_GRID_X, FIGURE_GRID_Y);
    
    
    
    for (int i = 1; i <= MAX_CHANNELS; i++) {
        playingPitches[i] = map<int,int>();
        currentNotesPlaying[i] = 0;
    }
    
//    soundStream.
//    ofSoundStreamSetup(5, 0, 44100, 512, 2);

    soundStream.printDeviceList();
    soundStream.setDeviceID(1);
    
    soundStream.setup(this, 2, 0, 44100, 512, 2);
    
    
//    plateManager->setup(10, 10);
//    initSnake();
//    mode = SNAKE;

//    tempPanel.setup("tempPanel");
//    tempPanel.add(spacing.set("spacing", 10, 0, 100));
//    
//    loadImage();
}
Exemplo n.º 8
0
 explicit WImageC(IplImage* img) : WImage<T>(img) {
     assert(!img || img->nChannels == Channels());
 }
Exemplo n.º 9
0
 inline const T* operator() (int c, int r) const  {
     return reinterpret_cast<T*>(image_->imageData + r*image_->widthStep) +
         c*Channels();
 }
Exemplo n.º 10
0
 // Number of bytes per pixel
 int PixelSize() const {return Channels() * ChannelSize(); }