Пример #1
0
/* Configures the board hardware and chip peripherals for the project's functionality. */
void configHardware(void){
	USB_ConfigureClock();
	PORTR.DIRSET = 1 << 1;
	PORTR.OUTSET = 1 << 1;
	_delay_ms(50);
	PORTR.OUTCLR = 1 << 1;
	DAC_init();
	initADC();
	initChannels();
	USB_Init();
}
Пример #2
0
void GSHLE::startfx(CHANNEL *ch, float pan)
{
   initChannels();

   float vol = (ch->volume * conf.sound.gs_vol) / float(8000*64);
   if (!BASS::ChannelSetAttribute(ch->bass_ch, BASS_ATTRIB_VOL, vol))
       reportError("BASS_ChannelSetAttribute() [vol]");
   if (!BASS::ChannelSetAttribute(ch->bass_ch, BASS_ATTRIB_FREQ, float(ch->freq)))
       reportError("BASS_ChannelSetAttribute() [freq]");
   if (!BASS::ChannelSetAttribute(ch->bass_ch, BASS_ATTRIB_PAN, pan))
       reportError("BASS_ChannelSetAttribute() [pan]");

   if (!BASS::ChannelPlay(ch->bass_ch, FALSE))
       reportError("BASS_ChannelPlay()");
}
Пример #3
0
AudioControl::AudioControl(MediaElement::ElementsDB& elementsDB,
                           const Glib::RefPtr<Gtk::Builder>& refGlade) : elementsDB(elementsDB),
    encoderControl(elementsDB, refGlade),
    audioMode(refGlade, "audioMode") , audioSamplerate(refGlade, "audioSamplerate"),
    audioChannels(refGlade, "audioChannels") {

    initAudioMode(audioMode);
    initSamplerate(audioSamplerate);
    initChannels(audioChannels);
    isEnabledSignals = true;

    audioMode.signal_changed().connect(sigc::mem_fun(*this, &AudioControl::audioModeChanged));
    audioSamplerate.signal_changed().connect(sigc::mem_fun(*this, &AudioControl::audioSamplerateChanged));
    audioChannels.signal_changed().connect(sigc::mem_fun(*this, &AudioControl::audioChannelsChanged));
    encoderControl.signalUserInput().connect(sigc::mem_fun(*this, &AudioControl::sendUserInputSignal));
}
Пример #4
0
void SurfaceT<T>::Obj::setChannelOrder( const SurfaceChannelOrder &aChannelOrder )
{
	mChannelOrder = aChannelOrder;
	initChannels();
}
Пример #5
0
SurfaceT<T>::Obj::Obj( int32_t aWidth, int32_t aHeight, SurfaceChannelOrder aChannelOrder, T *aData, bool aOwnsData, int32_t aRowBytes )
	: mWidth( aWidth ), mHeight( aHeight ), mChannelOrder( aChannelOrder ), mData( aData ), mOwnsData( aOwnsData ), mRowBytes( aRowBytes ), mIsPremultiplied( false )
{
	mDeallocatorFunc = NULL;
	initChannels();
}
Пример #6
0
//*****************************************************************************
//*****************************************************************************
int main(void) {
	//char posArray[40];
  PLL_Init();
	
	initPollingUART0();
	//initPollingUART1();
	UART0_TxPoll("\n\r\n\r\n\r*****Chiposizer V.9****");

	UART0_TxPoll("\n\rInitializing GPIO Ports...");
	initGPIOPorts();	
	
	UART0_TxPoll("\n\rInitializing PWM Modules...");
	initPWM();
	
	UART0_TxPoll("\n\rInitializing Timers...");
	initTimers();
	
	UART0_TxPoll("\n\rInitializing Effects...");
	initPremadeEffects();
	
	UART0_TxPoll("\n\rInitializing Channels...");
	initChannels();
	setCurrentChannel(ch5);

	
	UART0_TxPoll("\n\rEntering Main Loop");
	
	recordLoopNum = 0;
	
	configureUART();

	while(1){
			
		if (checkMsgs(myMsgBuffer)){
			handleLCDinput(myMsgBuffer[2], myMsgBuffer[4], currentCh->note->effects);
		}
		
		if (alertEffect) {
			alertEffect = false;
			updateAllEffects();
		}
		if (alertScan) {
			alertScan = false;
			/*if (recordLoopNum < 1000) {
				recordLoopNum++;
			} else if (!recordLoop) {
				recordLoop = true;
				cur = testList.head;
				UART0_TxPoll("\n\rBegin Record Loop");
			}
			if (!recordLoop) {
				keyNumber = scanMatrix(scanningMatrix);
				keyNumberPtr = malloc(sizeof(int8_t));
				*keyNumberPtr = keyNumber;
				add(&testList, keyNumberPtr);
			} else {
				keyNumber = *((int8_t*) cur->data);
				if (cur == testList.tail) {
					cur = testList.head;
				} else {
					cur = cur->next;
				}
			}*/
			
			keyNumber = scanMatrix(scanningMatrix);
			updateKey(currentCh->note, keyNumber);
			//printMatrix(scanningMatrix);
		}
		updateAllTuningWords();
	}
};
Пример #7
0
TimeSeries::TimeSeries(const char *rootDir, std::string frames_format /* = "" */) throw (iim::IOException) : iim::VirtualVolume(rootDir)
{
    /**/iim::debug(iim::LEV2, iim::strprintf("rootDir = %s, frames_format = \"%s\"", root_dir, frames_format.c_str()).c_str(), __iim__current__function__);

    // check condition #1: valid folder
    if(!iim::isDirectory(root_dir))
        throw iim::IOException(iim::strprintf("in TimeSeries::TimeSeries(): \"%s\" not a valid folder", rootDir).c_str());

    // assume hierarchical format for the individual frames if 'format' is not provided
    if(frames_format.empty() || VirtualVolume::isHierarchical(frames_format))
    {
        // search for valid folders that match the format [CHANNEL_PREFIX][i]
        DIR *cur_dir=0;
        dirent *entry=0;
        std::list<std::string> entries;
        if (!(cur_dir=opendir(root_dir)))
            throw iim::IOException(iim::strprintf("in TimeSeries::TimeSeries(): cannot open folder \"%s\"", root_dir).c_str());
        std::string pattern = iim::TIME_FRAME_PREFIX + "%d";
        while ((entry=readdir(cur_dir)))
        {
            int number = 0;
            if(sscanf(entry->d_name, pattern.c_str(), &number) == 1)
                entries.push_front(entry->d_name);
        }
        closedir(cur_dir);
        entries.sort();

        // check condition #2: at least one time frame has been found
        if(entries.empty())
            throw iim::IOException(iim::strprintf("in TimeSeries::TimeSeries(): no hierarchical time frames found within \"%s\"", rootDir).c_str());

        // import each folder as a separate VirtualVolume
        // WARNING: all metadata files (if needed by that format) are assumed to be present. Otherwise, that format will be skipped.
        for(std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++)
        {
            std::string path = root_dir;
            path += "/";
            path += *it;
            VirtualVolume* volume = 0;
            try{volume = VirtualVolume::instance(path.c_str());}
            catch(iim::IOException &ex){iim::warning(iim::strprintf("Cannot import tiled time frame at \"%s\": %s", path.c_str(), ex.what()).c_str(),__iim__current__function__);}
            catch(...){iim::warning(iim::strprintf("Cannot import tiled time frame at \"%s\"", path.c_str()).c_str(),__iim__current__function__);}
            if(!volume)
                throw iim::IOException(iim::strprintf("in TimeSeries::TimeSeries(): cannot import frame \"%s\" in folder \"%s\": invalid or unsupported format", it->c_str(), root_dir).c_str());
            frames.push_back(volume);
        }
    }
    else
    {
        // search for valid file formats
        DIR *cur_dir=0;
        dirent *entry=0;
        std::list<std::string> entries;
        if (!(cur_dir=opendir(root_dir)))
            throw iim::IOException(iim::strprintf("in TimeSeries::TimeSeries(): cannot open folder \"%s\"", root_dir).c_str());
        while ((entry=readdir(cur_dir)))
        {
            std::string tmp = entry->d_name;
            if(tmp.compare(".") != 0 && tmp.compare("..") != 0 && tmp.find(".") != std::string::npos)
                entries.push_front(entry->d_name);
        }
        closedir(cur_dir);
        entries.sort();

        // try to import each file separately
        for(std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++)
        {
            std::string path = root_dir;
            path += "/";
            path += *it;
            VirtualVolume* volume = 0;
            try{volume = VirtualVolume::instance(path.c_str(), frames_format);}
            catch(iim::IOException &ex){iim::warning(iim::strprintf("Cannot import filed time frame at \"%s\": %s", path.c_str(), ex.what()).c_str(),__iim__current__function__);}
            catch(...){iim::warning(iim::strprintf("Cannot import filed time frame at \"%s\"", path.c_str()).c_str(),__iim__current__function__);}
            if(volume)
                frames.push_back(volume);
        }

        // check condition #2: at least one time frame has been found
        if(frames.empty())
            throw iim::IOException(iim::strprintf("in TimeSeries::TimeSeries(): no filed time frames found within \"%s\"", rootDir).c_str());
    }

    // check condition #2: all frames must have the same attributes
    for(int k=0; k<frames.size()-1; k++)
    {
        if( strcmp(typeid(*frames[k]).name() , typeid(*frames[k+1]).name()) != 0)
            throw iim::IOException(iim::strprintf("in TimeSeries::TimeSeries(): frames have different formats in folder \"%s\"", root_dir).c_str());

        if( frames[k]->getDIM_H() != frames[k+1]->getDIM_H())
            throw iim::IOException(iim::strprintf("in TimeSeries::TimeSeries(): frames have different X size in folder \"%s\"", root_dir).c_str());

        if( frames[k]->getDIM_V() != frames[k+1]->getDIM_V())
            throw iim::IOException(iim::strprintf("in TimeSeries::TimeSeries(): frames have different Y size in folder \"%s\"", root_dir).c_str());

        if( frames[k]->getDIM_D() != frames[k+1]->getDIM_D())
            throw iim::IOException(iim::strprintf("in TimeSeries::TimeSeries(): frames have different Z size in folder \"%s\"", root_dir).c_str());

        if( frames[k]->getDIM_C() != frames[k+1]->getDIM_C())
            throw iim::IOException(iim::strprintf("in TimeSeries::TimeSeries(): frames have different channels in folder \"%s\"", root_dir).c_str());

        if( frames[k]->getBYTESxCHAN() != frames[k+1]->getBYTESxCHAN())
            throw iim::IOException(iim::strprintf("in TimeSeries::TimeSeries(): frames have different bytes per channel in folder \"%s\"", root_dir).c_str());
    }

    // assigning to the attributes of time series the attributes of the first frame
    VXL_V = frames[0]->getVXL_V();
    VXL_H = frames[0]->getVXL_H();
    VXL_D = frames[0]->getVXL_D();
    ORG_V = frames[0]->getORG_V();
    ORG_H = frames[0]->getORG_H();
    ORG_D = frames[0]->getORG_D();
    DIM_V = frames[0]->getDIM_V();
    DIM_H = frames[0]->getDIM_H();
    DIM_D = frames[0]->getDIM_D();

    initChannels();

    t0 = 0;
    t1 = (int)(frames.size()-1);
    DIM_T = (int)(frames.size());
}