コード例 #1
0
ファイル: bass_player.cpp プロジェクト: jeyboy/playo3
bool BassPlayer::proceedErrorState(int code) {
    updateState(UnknowState);

    if (code == BASS_OK)
        code = BASS_ErrorGetCode();

    qCritical() << "proceedErrorState" << media_url.toString() << code;

    switch(code) {
        case BASS_OK: {
            if (chan)
                return false;
            else { // hotfix for some stalled media
                emit statusChanged(media_title, StalledMedia);
            }
        break;}
        case BASS_ERROR_FILEFORM: { emit statusChanged(media_title, InvalidMedia); break; }
        case BASS_ERROR_FILEOPEN: { emit statusChanged(media_title, NoMedia); break; }
        // BASS_ERROR_TIMEOUT
        default:
            qDebug() << "UNKNOWN ERROR: " << BASS_ErrorGetCode();
            emit statusChanged(media_title, StalledMedia);
    }

    return true;
}
コード例 #2
0
ファイル: widget.cpp プロジェクト: lovelycodex/diplom
/**
 * @brief No incoming parameters. Get data from RCHAN. Creating the stream file. If BASS_StreamCreateFile is failure colled BASS_Free().
 * @param No params
 */
void Widget::stopRecording()
{
    if (BASS_ChannelGetData(rchan, this->fft, BASS_DATA_FFT1024 | BASS_DATA_FFT_COMPLEX) == -1) {
        QDEBUG("Cannot get recbuf from rchan");
        QDEBUG(BASS_ErrorGetCode());
    }

    BASS_ChannelStop(rchan);
    rchan=0;
    ui->pushButton->setText(tr("Record"));
    // complete the WAVE header
    *(DWORD*)(recbuf+4)=reclen-8;
    *(DWORD*)(recbuf+40)=reclen-44;
    // enable "save" button
    ui->pushButton_3->setEnabled(true);
    // setup output device (using default device)
    if (!BASS_Init(-1,44100,0,NULL,NULL)) {
        QDEBUG(BASS_ErrorGetCode());
        QDEBUG("Can't initialize output device");
        return;
    }
    // create a stream from the recording
    if (chan=BASS_StreamCreateFile(TRUE,recbuf,0,reclen,BASS_SAMPLE_FLOAT)) {
        //ui->pushButton_2->setEnabled(true); // enable "play" button
    }
    else
        BASS_Free();
    ui->pushButton->setEnabled(true);
}
コード例 #3
0
void Player::setPaused(bool npaused) {
	if(npaused == paused())
		return;


	if(npaused) {
		if(!BASS_ChannelPause(_output))
			std::cerr << "Bass Error: pausing channel failed1: " << BASS_ErrorGetCode() << "\n";
	} else {
		if(!BASS_ChannelPlay(_output, FALSE))
			std::cerr << "Bass Error: resuming channel playback failed: " << BASS_ErrorGetCode() << "\n";
	}
}
コード例 #4
0
ファイル: widget.cpp プロジェクト: lovelycodex/diplom
/**
 * @brief Starts the record and set default confuration for audio file. If start record is failure free RECBUF is comming.
 */
void Widget::startRecording() {
    WAVEFORMATEX *wf;
    if (recbuf) { // free old recording;
        BASS_StreamFree(chan);
        chan=0;
        free(recbuf);
        recbuf=NULL;
        //ui->pushButton_2->setEnabled(false);
        ui->pushButton_3->setEnabled(false);
        // close output device before recording incase of half-duplex device;
        BASS_Free();
    }
    // allocate initial buffer and make space for WAVE header;
    recbuf=(char*)malloc(BUFSTEP);
    reclen=44;
    // fill the WAVE header;
    memcpy(recbuf,"RIFF\0\0\0\0WAVEfmt \20\0\0\0",20);
    memcpy(recbuf+36,"data\0\0\0\0",8);
    wf=(WAVEFORMATEX*)(recbuf+20);
    wf->wFormatTag=1;
    wf->nChannels=2;
    wf->wBitsPerSample=16;
    wf->nSamplesPerSec=44100;
    wf->nBlockAlign=wf->nChannels*wf->wBitsPerSample/8;
    wf->nAvgBytesPerSec=wf->nSamplesPerSec*wf->nBlockAlign;
    // start recording @ 44100hz 32-bit stereo;
    if (!(rchan=BASS_RecordStart(44100,2,0,&RecordingCallback,0))) {
        QDEBUG(BASS_ErrorGetCode());
        Error("Couldn't start recording");
        free(recbuf);
        recbuf=0;
        return;
    }
    ui->pushButton->setEnabled(false);
}
コード例 #5
0
/* Display error messages */
void print_bass_error(const char *text)
{
  printf("Error(%d): %s\n", BASS_ErrorGetCode(), text);
  BASS_Free();
  exit(1);

} /* print_bass_error */
コード例 #6
0
ファイル: speakers.c プロジェクト: AntonGerasimov/Converter
// display error messages
void Error(const char *es)
{
	GtkWidget *dialog=gtk_message_dialog_new(GTK_WINDOW(win),GTK_DIALOG_DESTROY_WITH_PARENT,
		GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,"%s\n(error code: %d)",es,BASS_ErrorGetCode());
	gtk_dialog_run(GTK_DIALOG(dialog));
	gtk_widget_destroy(dialog);
}
コード例 #7
0
ファイル: sound_bass.cpp プロジェクト: opensludge/opensludge
bool playMOD (int f, int a, int fromTrack) {
	if (soundOK) {

		stopMOD (a);

		setResourceForFatal (f);
		uint32_t length = openFileFromNum (f);
		if (length == 0) return NULL;

		char * memImage;
		memImage = loadEntireFileToMemory (bigDataFile, length);
		if (! memImage) return fatal (ERROR_MUSIC_MEMORY_LOW);

		mod[a] = BASS_MusicLoad (true, memImage, 0, length, BASS_MUSIC_LOOP|BASS_MUSIC_RAMP/*|BASS_MUSIC_PRESCAN needed too if we're going to set the position in bytes*/, 0);
		delete memImage;

		if (! mod[a]) {

		}
		else
		{
			setMusicVolume (a, defVol);

			if (! BASS_ChannelPlay (mod[a], true) )
				debugOut("playMOD: Error %d!\n", BASS_ErrorGetCode());

			BASS_ChannelSetPosition (mod[a], MAKELONG(fromTrack, 0), BASS_POS_MUSIC_ORDER);
			BASS_ChannelFlags(mod[a], BASS_SAMPLE_LOOP|BASS_MUSIC_RAMP, BASS_SAMPLE_LOOP|BASS_MUSIC_RAMP);
		}
		setResourceForFatal (-1);
	}
    return true;
}
コード例 #8
0
bool CClientSound::Play3D ( const SString& strPath, const CVector& vecPosition, bool bLoop )
{
    long lFlags = BASS_STREAM_AUTOFREE | BASS_SAMPLE_3D | BASS_SAMPLE_MONO;
    if ( bLoop )
        lFlags |= BASS_SAMPLE_LOOP;

    // Try to load the sound file
    if (
        ( m_pSound = BASS_StreamCreateFile ( false, strPath, 0, 0, lFlags ) )
     || ( m_pSound = BASS_MusicLoad ( false, strPath, 0, 0, lFlags, 0) )
        )
    {
        m_b3D = true;
        m_strPath = strPath;
        m_vecPosition = vecPosition;
        BASS_3DVECTOR pos ( vecPosition.fX, vecPosition.fY, vecPosition.fZ );
        BASS_ChannelSet3DPosition ( m_pSound, &pos, NULL, NULL );
        BASS_ChannelSet3DAttributes ( m_pSound, BASS_3DMODE_NORMAL, 1.0f, 0.5f, 360, 360, 1.0f );
        BASS_ChannelPlay ( m_pSound, false );
        BASS_ChannelGetAttribute ( m_pSound, BASS_ATTRIB_FREQ, &m_fDefaultFrequency );
        return true;
    }
    g_pCore->GetConsole()->Printf ( "BASS ERROR %d in Play3D  path = %s", BASS_ErrorGetCode(), strPath.c_str() );
    return false;
}
コード例 #9
0
ファイル: CBassAudio.cpp プロジェクト: Bargas/mtasa-blue
float CBassAudio::GetSoundBPM ( void )
{
    if ( m_fBPM == 0.0f && !m_bStream )
    {
        float fData = 0.0f;
        // open the same file as played but for bpm decoding detection
        DWORD bpmChan = BASS_StreamCreateFile ( false, m_strPath, 0, 0, BASS_STREAM_DECODE );
        if ( !bpmChan ) 
        {
            bpmChan = BASS_MusicLoad ( false, m_strPath, 0, 0, BASS_MUSIC_DECODE|BASS_MUSIC_PRESCAN, 0 );
        }
        // detect bpm in background and return progress in GetBPM_ProgressCallback function
        if ( bpmChan ) 
        {
            fData = BASS_FX_BPM_DecodeGet ( bpmChan, 0, GetLength ( ), 0, BASS_FX_FREESOURCE, NULL, NULL );
        }

        if ( BASS_ErrorGetCode ( ) != BASS_OK )
        {
            g_pCore->GetConsole ( )->Printf ( "BASS ERROR %d in BASS_FX_BPM_DecodeGet  path:%s  3d:%d  loop:%d", BASS_ErrorGetCode ( ), *m_strPath, m_b3D, m_bLoop );
        }
        else
        {
            m_fBPM = floor ( fData );
        }
        BASS_FX_BPM_BeatFree ( bpmChan );
    }
    return m_fBPM;
}
コード例 #10
0
ファイル: BassMusic.cpp プロジェクト: 3rdexp/soui
int CBassMusicEngine::ShowError( LPCTSTR lpError )
{
	CString StrError;
	StrError.Format(TEXT("%s 错误码: %d"),lpError,BASS_ErrorGetCode());

	//return AfxMessageBox(StrError);
	return SMessageBox(NULL,StrError,_T("警告"),MB_OK|MB_ICONEXCLAMATION);	
}
コード例 #11
0
ファイル: bass_player.cpp プロジェクト: jeyboy/playo3
void BassPlayer::applyTempoToChannel() {
    quint64 tempo_chan = BASS_FX_TempoCreate(chan, BASS_FX_FREESOURCE);
    if (!tempo_chan) {
        //FIXME: block tempo func
        qCritical() << "e:" << BASS_ErrorGetCode();
    } else
        chan = tempo_chan;
}
コード例 #12
0
ファイル: teffect.cpp プロジェクト: Grocel/GMod_Modules
bool TEffect::ApplyInternal(bass_p pChannel)
{
	if (IsRemoved()) return false;
	bUpdated = true;

	iErrorCode = BASS_OK;

	if (eType == BASS_FX_UNKNOWN)
	{
		iErrorCode = BASS_ERROR_ILLPARAM;
		return false;
	}

	if (pChannel == BASS_NULL)
	{
		iErrorCode = BASS_ERROR_HANDLE;
		return false;
	}

	bass_p pOldChannel = this->pChannel;

	if (pOldChannel != pChannel)
	{
		this->pChannel = pChannel;

		if (pOldChannel != BASS_NULL && pFX != BASS_NULL)
		{
			BASS_ChannelRemoveFX(pOldChannel, pFX);
			pFX = BASS_NULL;
		}
	}
	else
	{
		if (pFX != BASS_NULL && bEnabled)
		{
			return true;
		}
	}

	if (!bEnabled)
	{
		RemoveFX();
		return true;
	}

	pFX = BASS_ChannelSetFX(pChannel, eType, 0);
	iErrorCode = BASS_ErrorGetCode();

	if (iErrorCode != BASS_OK)
	{
		RemoveFX();
		return false;
	}

	UpdateInternal();
	ResetInternal();
	return true;
}
コード例 #13
0
ファイル: sound_bass.cpp プロジェクト: opensludge/opensludge
void setMusicVolume (int a, int v) {
	int ret;
	if (soundOK && mod[a])
	{
		ret = BASS_ChannelSetAttribute (mod[a], BASS_ATTRIB_VOL, (float) v / 255);
		if (! ret) {
			debugOut("setMusicVolume: Error %d\n", BASS_ErrorGetCode());
		}
	}
}
コード例 #14
0
ファイル: Music.cpp プロジェクト: asmCode/rw2014
void Music::SetPosition(float time)
{
	QWORD bytesPos = BASS_ChannelSeconds2Bytes(mp3Strewam, time);
	BOOL result = BASS_ChannelSetPosition(mp3Strewam, bytesPos, BASS_POS_BYTE);

	if (result != TRUE)
	{
		int errorCode = BASS_ErrorGetCode();
		assert(false);
	}
}
コード例 #15
0
ファイル: plugins.c プロジェクト: bagnz0r/ichigo-audio
// display error messages
void Error(const char *es)
{
	short i;
	char mes[200];
	sprintf(mes,"%s\n(error code: %d)",es,BASS_ErrorGetCode());
	CFStringRef ces=CFStringCreateWithCString(0,mes,0);
	DialogRef alert;
	CreateStandardAlert(0,CFSTR("Error"),ces,NULL,&alert);
	RunStandardAlert(alert,NULL,&i);
	CFRelease(ces);
}
コード例 #16
0
ファイル: LoadedSample.cpp プロジェクト: CarlosCasVen/UTad
void LoadedSample::PlaySample ()
{
    if ( m_playing ) BASS_Start();
    else
    {
        m_channel = BASS_SampleGetChannel( m_sample, FALSE );
		BOOL ret = BASS_ChannelPlay(m_channel, FALSE); 
		int err =BASS_ErrorGetCode();

		int x = 0;
    }
}
コード例 #17
0
ファイル: player.cpp プロジェクト: offtza01/netradio
void Player::play(QString stationId) {

    stop();
    if( !playList.contains(stationId))
    {
        return;
    }

    HSTREAM stream = BASS_StreamCreateURL(playList.value(stationId).toStdString().c_str(),0,BASS_STREAM_BLOCK|BASS_STREAM_STATUS|BASS_STREAM_AUTOFREE,MyDownload,0);

    BASS_Start();

    if( stream)
    {
        bool buffering = true;
        while(buffering)
        {
            QWORD progress = BASS_StreamGetFilePosition(stream,BASS_FILEPOS_BUFFER)*100/BASS_StreamGetFilePosition(stream,BASS_FILEPOS_END);
            webView()->page()->mainFrame()->evaluateJavaScript(QString("PlayerHud.updateBufforStatus("+ QString::number(progress) +")"));
            if( progress>=100)
            {
                buffering = false;
                webView()->page()->mainFrame()->evaluateJavaScript("PlayerHud.clearBufforStatus()");
            }

        }
        const char *meta=BASS_ChannelGetTags(stream,BASS_TAG_META);
        if( !meta)
        {
            meta = BASS_ChannelGetTags(stream,BASS_TAG_OGG);
        }
        if( meta)
        {
            qDebug() << meta;
            QRegularExpression rx("StreamTitle='(.+)';StreamUrl");
            QRegularExpressionMatch match = rx.match(QString(meta));
            if (match.hasMatch()) {
                qDebug() << match.captured(1);
                webView()->page()->mainFrame()->evaluateJavaScript("setRadiostationTag('"+ match.captured(1) +"')");
            }
        }
        BASS_ChannelPlay(stream,FALSE);
        playStatus = true;

    }
    else
    {
        qDebug() << BASS_ErrorGetCode();
        return;
    }
    return;
}
コード例 #18
0
ファイル: bass_player.cpp プロジェクト: jeyboy/playo3
bool BassPlayer::newTempoProcessing(const int & new_tempo) {
    if (!chan) return false;

    float tempo = new_tempo;
    if (tempo != 0) // -95%...0...+5000%
        tempo = (new_tempo / (float)tempoMax()) * (tempo < 0 ? 50 : 200); // take only 200 %

    bool res = BASS_ChannelSetAttribute(chan, BASS_ATTRIB_TEMPO, tempo);
    if (!res)
        qCritical() << "err:" << BASS_ErrorGetCode();

    return res;
}
コード例 #19
0
// BASS sound system
void BassSoundEngine::ERRCHECK(DWORD result, bool bQuit)
{
	if (result == FALSE)
    {
		char str[256];
        sprintf(str,"BASS error! (code=%d)\n", BASS_ErrorGetCode());
        if(bQuit){
			MessageBoxW(NULL, Ansi2WChar(str).data(), NULL, MB_OK|MB_ICONEXCLAMATION);
			exit(-1);
		}
		ShowMessage(str,2,0,32);
    }
}
コード例 #20
0
ファイル: bass.cpp プロジェクト: lamogui/libtools
unsigned int BassDecoder::fetch(Signal& left, Signal& right){
  if (_music)
  {
    DWORD readed=0;
    #if defined(LIBTOOLS_WINDOWS) && !defined(BASS_H)
    if (!BASS_ChannelGetData || ! BASS_ErrorGetCode) {
      std::cerr << "Error missing BASS_ChannelGetData or BASS_ErrorGetCode functions" << std::endl;
      return 0;
    }
    #endif
    
    
    readed=BASS_ChannelGetData((DWORD)_music, (void*)_samplesForSignals, _bytesFrame);

    if(readed==-1 && BASS_ErrorGetCode() == BASS_ERROR_ENDED) {
      left.reset();
      right.reset();
      _ended=true;
      return 0;
    }

    if (readed < _bytesFrame)
    {
      for (unsigned int i=readed; i< _bytesFrame ;i++)
        ((char*)_samplesForSignals)[i]=0;
    }
    const unsigned int signal_size=Signal::size;
    if (_infos.chans>=2)
    {
      unsigned int k=0;
		  for (unsigned int i=0; i < signal_size;)
		  {
			  left.samples[i]=_samplesForSignals[k++];
			  right.samples[i++]=_samplesForSignals[k++];
        k+=_infos.chans-2;
		  }
    }
    else if (_infos.chans==1) //mono
    {
      unsigned int k=0;
		  for (unsigned int i=0; i < signal_size;)
		  {
			  left.samples[i]=_samplesForSignals[k];
			  right.samples[i++]=_samplesForSignals[k++];
		  }
    }
    return readed/sizeof(sample);
  }
  return 0;
}
コード例 #21
0
// --[  Method  ]---------------------------------------------------------------
//
//  - Class     : CSoundModule
//  - prototype : Free()
//
//  - Purpose   : Frees all memory allocated by the sound module.
//
// -----------------------------------------------------------------------------
bool CSoundModule::Free()
{
    if(!IsValid())
    {
        return false;
    }

    BASS_MusicFree(m_handle);
    SAFE_DELETE(m_pBuffer);

    CSoundSystem::Instance().EraseSound(this);

    return BASS_ErrorGetCode() == BASS_OK;
}
コード例 #22
0
ファイル: bass_player.cpp プロジェクト: jeyboy/playo3
bool BassPlayer::initOutputDevice(const int & new_device, const int & frequency) {
    bool res = BASS_Init(new_device, frequency, 0, NULL, NULL);

    if (!res) {
        if (BASS_ErrorGetCode() == BASS_ERROR_ALREADY) {
            res = true;
        } else {
            qDebug() << "Init error: " << BASS_ErrorGetCode();
            // throw "Cannot initialize device";
        }
    }

    if (res) {
        opened_devices.insert(new_device, true);

        BASS_SetConfig(BASS_CONFIG_FLOATDSP, TRUE);
    //    BASS_SetConfig(BASS_CONFIG_NET_PREBUF, 15); // 15 percents prebuf

        setOpenTimeOut(Settings::obj().openTimeOut());
    }

    return res;
}
コード例 #23
0
ファイル: xaudplayer.cpp プロジェクト: djrobx/vpinballx
XAudPlayer::XAudPlayer()
{
   m_stream = NULL;

#ifdef DEBUG_NO_SOUND
   return;
#endif

   if (!bass_init)
   {
      int DSidx;
      const HRESULT hr = GetRegInt("Player", "SoundDeviceBG", &DSidx);
      if (hr != S_OK)
          DSidx = -1;

      // now match the Direct Sound device with the BASS device (by name)
      int BASSidx = -1;
      if (DSidx != -1)
      {
          DSAudioDevices DSads;
          if (!FAILED(DirectSoundEnumerate(DSEnumCallBack, &DSads)))
          {
              if ((unsigned int)DSidx >= DSads.size() || DSads[DSidx]->guid != NULL) // primary device has guid NULL, so use BASSidx = -1 in that case
              {
                  BASS_DEVICEINFO info;
                  for (int i = 1; BASS_GetDeviceInfo(i, &info); i++) // 0 = no sound/no device
                      if (info.flags & BASS_DEVICE_ENABLED) // device must be enabled
                      if (strcmp(info.name, DSads[DSidx]->description.c_str()) == 0)
                      {
                          BASSidx = i;
                          break;
                      }
              }

              for (size_t i = 0; i < DSads.size(); i++)
                  delete DSads[i];
          }
      }

      if (!BASS_Init(BASSidx, 44100, 0, g_pvp->m_hwnd, NULL)) // note that sample rate is usually ignored and set depending on the input/file automatically
      {
         char bla[128];
         sprintf_s(bla, "BASS music/sound library initialization error %d", BASS_ErrorGetCode());
         MessageBox(g_pvp->m_hwnd, bla, "Error", MB_ICONERROR);
      }
      bass_init = true;
   }
}
コード例 #24
0
ファイル: bass.cpp プロジェクト: lamogui/libtools
string_t BassDecoder::handleBassChannelPlayError()
{
  #if defined(LIBTOOLS_WINDOWS) && !defined(BASS_H)
  if (!BASS_ErrorGetCode)
    return "BASS not loaded";
  #endif
  switch (BASS_ErrorGetCode())
  {
    case BASS_ERROR_HANDLE:	return "handle is not a valid channel.";
    case BASS_ERROR_START:	return "The output is paused/stopped, use BASS_Start to start it.";
    case BASS_ERROR_DECODE:	return "The channel is not playable; it is a 'decoding channel'.";
    case BASS_ERROR_BUFLOST:	return "Should not happen... check that a valid window handle was used with BASS_Init.";
    case BASS_ERROR_NOHW:	return "No hardware voices are available (HCHANNEL only). This only occurs if the sample was loaded/created with the BASS_SAMPLE_VAM flag and BASS_VAM_HARDWARE is set in the sample's VAM mode, and there are no hardware voices available to play it.";
    default: return "";
  }
}
コード例 #25
0
ファイル: bass_player.cpp プロジェクト: jeyboy/playo3
bool BassPlayer::closeAllDevices() {
    bool ret = true;

    for(QHash<int, bool>::Iterator it = opened_devices.begin(); it != opened_devices.end(); it++) {
        bool op_res = BASS_SetDevice(it.key()) && BASS_Free();

        if (!op_res)
            qCritical() << "DEVICE CLOSE ERROR" << BASS_ErrorGetCode();

        ret &= op_res;
    }

    opened_devices.clear();

    return ret;
}
コード例 #26
0
ファイル: record_player.cpp プロジェクト: DanGrise/HugMe
void Crecord_playerApp::animateObject(cVector3d force)
{
  // do stuff with force: relate force to torque applied about the disc axis

  // integrate torque
  cVector3d planeForce;
  planeForce.set(force.x, force.y, 0);

  // get position of proxy on plane, get vector from center to application point
  cProxyPointForceAlgo* forceAlgo = tool->getProxy();
  m_proxyPos = forceAlgo->getProxyGlobalPosition();
    m_proxyPos.sub(m_recordMesh->getGlobalPos());
  cVector3d radius;
  radius.set(m_proxyPos.x, m_proxyPos.y, 0);

  // do cross product
  cVector3d torqueVec;
  planeForce.crossr(radius, torqueVec);

  // call that the torque applied to the disc and compute new position
  m_torque = torqueVec.z;

  // do the math for how the rotational friction may affect the whole motion
  double time_step = 0.001;
  m_rotVel = m_rotVel + m_torque/m_inertia * time_step;
  m_rotPos = m_rotPos + m_rotVel * time_step;

    // set audio direction and frequency based on rotational velocity
  if (haptics_enabled && (fabs(m_rotVel)) > 0.0)
    {
        if (m_rotVel < 0.0) record_direction = 1;
        else record_direction = -1;
    BASS_ChannelSetAttributes(stream, (int)(info.freq*fabs(m_rotVel)/6.5), -1, -1); 
        if (!(BASS_ChannelPlay(stream,FALSE)))
          _cprintf("Play error %d\n", BASS_ErrorGetCode()); 
    }
    else
    {
        BASS_ChannelStop(stream);
    }

  // rotate object
  m_recordMesh->rotate(m_recordMesh->getRot().getCol2(), m_rotVel * time_step);
  m_recordMesh->computeGlobalPositions();
}
コード例 #27
0
ファイル: bass.cpp プロジェクト: lamogui/libtools
string_t BassDecoder::handleBassStreamCreateError()
{
  #if defined(LIBTOOLS_WINDOWS) && !defined(BASS_H)
  if (!BASS_ErrorGetCode)
    return "BASS not loaded";
  #endif
  switch (BASS_ErrorGetCode())
  {
    case BASS_ERROR_INIT:	return "BASS_Init has not been successfully called.";
    case BASS_ERROR_NOTAVAIL:	return "Only decoding channels (BASS_STREAM_DECODE) are allowed when using the 'no sound' device. The BASS_STREAM_AUTOFREE flag is also unavailable to decoding channels.";
    case BASS_ERROR_FORMAT:	return "The sample format is not supported by the device/drivers. If the stream is more than stereo or the BASS_SAMPLE_FLOAT flag is used, it could be that they are not supported.";
    case BASS_ERROR_SPEAKER:	return "The specified SPEAKER flags are invalid. The device/drivers do not support them, they are attempting to assign a stereo stream to a mono speaker or 3D functionality is enabled.";
    case BASS_ERROR_MEM:	return "There is insufficient memory.";
    case BASS_ERROR_NO3D:	return "Could not initialize 3D support.";
    case BASS_ERROR_UNKNOWN:	return "Some other mystery problem!";
    default: return "";
  }
}
コード例 #28
0
ファイル: bass.cpp プロジェクト: lamogui/libtools
string_t BassDecoder::handleBassInitError()
{
  #if defined(LIBTOOLS_WINDOWS) && !defined(BASS_H)
  if (!BASS_ErrorGetCode)
    return "BASS not loaded";
  #endif
  switch (BASS_ErrorGetCode())
  {
    case BASS_ERROR_DX:	return "DirectX (or ALSA on Linux or OpenSL ES on Android) is not installed.";
    case BASS_ERROR_DEVICE:	return "device is invalid.";
    case BASS_ERROR_ALREADY:	return "The device has already been initialized. BASS_Free must be called before it can be initialized again.";
    case BASS_ERROR_DRIVER:	return "There is no available device driver. The device may already be in use.";
    case BASS_ERROR_FORMAT:	return "The specified format is not supported by the device. Try changing the freq and flags parameters.";
    case BASS_ERROR_MEM:	return "There is insufficient memory.";
    case BASS_ERROR_NO3D:	return "Could not initialize 3D support.";
    case BASS_ERROR_UNKNOWN:	return "Some other mystery problem!";
    default: return "";
  }
}
コード例 #29
0
bool CClientSound::Play ( const SString& strPath, bool bLoop )
{
    long lFlags = BASS_STREAM_AUTOFREE;
    if ( bLoop )
        lFlags = BASS_SAMPLE_LOOP;

    // Try to load the sound file
    if (
        ( m_pSound = BASS_StreamCreateFile ( false, strPath, 0, 0, lFlags ) )
     || ( m_pSound = BASS_MusicLoad ( false, strPath, 0, 0, lFlags, 0) )
        )
    {
        m_strPath = strPath;
        BASS_ChannelPlay ( m_pSound, false );
        BASS_ChannelGetAttribute ( m_pSound, BASS_ATTRIB_FREQ, &m_fDefaultFrequency );
        return true;
    }
    g_pCore->GetConsole()->Printf ( "BASS ERROR %d in Play  path = %s", BASS_ErrorGetCode(), strPath.c_str() );
    return false;
}
コード例 #30
0
ファイル: teffect.cpp プロジェクト: Grocel/GMod_Modules
void TEffect::UpdateInternal()
{
	if (bIsRemoved) return;
	if (pFX == BASS_NULL) return;

	if (!bEnabled)
	{
		RemoveFX();
		return;
	}

	if (!bUpdated) return;

	void* pParamData = this->GetData();
	if (ISNULLPTR(pParamData)) return;

	BASS_FXSetParameters(pFX, pParamData);
	iErrorCode = BASS_ErrorGetCode();

	bUpdated = (iErrorCode == BASS_OK);
}