Commit ee393311 authored by sletz's avatar sletz
Browse files

New ALSA driver now compile.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4205 0c269be4-1314-0410-8aa9-9f06e86f4224
parent a12d18be
......@@ -393,12 +393,12 @@ int JackAlsaDriver::Write()
return alsa_driver_write((alsa_driver_t *)fDriver, fEngineControl->fBufferSize);
}
void JackAlsaDriver::ReadInputAux()
void JackAlsaDriver::ReadInputAux(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nread)
{
int chn;
for (chn = 0; chn < fCaptureChannels; chn++) {
if (fGraphManager->GetConnectionsNum(fCapturePortList[chn]) > 0) {
buf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fCapturePortList[chn], orig_nframes);
jack_default_audio_sample_t* buf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fCapturePortList[chn], orig_nframes);
alsa_driver_read_from_channel((alsa_driver_t *)fDriver, chn, buf + nread, contiguous);
}
}
......@@ -410,7 +410,7 @@ void JackAlsaDriver::MonitorInputAux()
for (chn = 0; chn < fCaptureChannels; chn++) {
JackPort* port = fGraphManager->GetPort(fCapturePortList[chn]);
if (port->MonitoringInput()) {
driver->input_monitor_mask |= (1 << chn);
((alsa_driver_t *)fDriver)->input_monitor_mask |= (1 << chn);
}
}
}
......@@ -418,10 +418,10 @@ void JackAlsaDriver::MonitorInputAux()
void JackAlsaDriver::ClearOutputAux()
{
int chn;
for (chn = 0; i < fPlaybackChannels; chn++) {
for (chn = 0; chn < fPlaybackChannels; chn++) {
jack_default_audio_sample_t* buf =
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(fPlaybackPortList[chn], fEngineControl->fBufferSize);
memset (buf, 0, sizeof (jack_default_audio_sample_t) * fEngineControl->fBufferSize);
memset(buf, 0, sizeof (jack_default_audio_sample_t) * fEngineControl->fBufferSize);
}
}
......@@ -430,22 +430,19 @@ void JackAlsaDriver::SetTimetAux(jack_time_t time)
fBeginDateUst = time;
}
void JackAlsaDriver::WriteOutputAux()
void JackAlsaDriver::WriteOutputAux(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nwritten)
{
int chn;
jack_default_audio_sample_t* buf;
snd_pcm_sframes_t nwritten;
snd_pcm_sframes_t contiguous;
snd_pcm_uframes_t offset;
for (chn = 0; chn < fPlaybackChannels; chn++) {
// Ouput ports
if (fGraphManager->GetConnectionsNum(fPlaybackPortList[chn]) > 0) {
buf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fPlaybackPortList[chn], orig_nframes);
alsa_driver_write_to_channel(driver, chn, buf + nwritten, contiguous);
alsa_driver_write_to_channel(((alsa_driver_t *)fDriver), chn, buf + nwritten, contiguous);
// Monitor ports
if (fWithMonitorPorts && fGraphManager->GetConnectionsNum(fMonitorPortList[chn]) > 0) {
monbuf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fMonitorPortList[chn], orig_nframes);
jack_default_audio_sample_t* monbuf = (jack_default_audio_sample_t*)fGraphManager->GetBuffer(fMonitorPortList[chn], orig_nframes);
memcpy(monbuf + nwritten, buf + nwritten, contiguous * sizeof(jack_default_audio_sample_t));
}
}
......@@ -755,6 +752,7 @@ dither_opt (char c, DitherAlgorithm* dither)
return 0;
}
/*
SERVER_EXPORT const jack_driver_desc_t* driver_get_descriptor ()
{
jack_driver_desc_t * desc;
......@@ -933,6 +931,7 @@ SERVER_EXPORT const jack_driver_desc_t* driver_get_descriptor ()
desc->params = params;
return desc;
}
*/
static Jack::JackAlsaDriver* g_alsa_driver;
......@@ -1065,7 +1064,7 @@ SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLocke
g_alsa_driver = new Jack::JackAlsaDriver("system", "alsa_pcm", engine, table);
Jack::JackDriverClientInterface* threaded_driver = new Jack::JackThreadedDriver(g_alsa_driver);
// Special open for ALSA driver...
if (alsa_driver->Open(frames_per_interrupt, user_nperiods, srate, hw_monitoring, hw_metering, capture, playback, dither, soft_mode, monitor,
if (g_alsa_driver->Open(frames_per_interrupt, user_nperiods, srate, hw_monitoring, hw_metering, capture, playback, dither, soft_mode, monitor,
user_capture_nchnls, user_playback_nchnls, shorts_first, capture_pcm_name, playback_pcm_name,
systemic_input_latency, systemic_output_latency, midi_driver) == 0) {
return threaded_driver;
......@@ -1077,9 +1076,9 @@ SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLocke
// Code to be used in alsa_driver.c
void ReadInput();
void ReadInput(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nread)
{
g_alsa_driver->ReadInputAux();
g_alsa_driver->ReadInputAux(orig_nframes, contiguous, nread);
}
void MonitorInput()
{
......@@ -1089,9 +1088,9 @@ void ClearOutput()
{
g_alsa_driver->ClearOutputAux();
}
void WriteOutput()
void WriteOutput(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nwritten)
{
g_alsa_driver->WriteOutputAux();
g_alsa_driver->WriteOutputAux(orig_nframes, contiguous, nwritten);
}
void SetTimet(jack_time_t time)
{
......
......@@ -93,10 +93,10 @@ class JackAlsaDriver : public JackAudioDriver
int SetBufferSize(jack_nframes_t buffer_size);
void ReadInputAux();
void MonitorInputtAux();
void ClearOutputtAux();
void WriteOutputtAux();
void ReadInputAux(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nread);
void MonitorInputAux();
void ClearOutputAux();
void WriteOutputAux(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nwritten);
void SetTimetAux(jack_time_t time);
// JACK API emulation for the midi driver
......
......@@ -1117,7 +1117,7 @@ alsa_driver_stop (alsa_driver_t *driver)
memset (buf, 0, sizeof (jack_default_audio_sample_t) * fEngineControl->fBufferSize);
}
*/
ClearOutput()
ClearOutput();
if (driver->playback_handle) {
if ((err = snd_pcm_drop (driver->playback_handle)) < 0) {
......@@ -1639,7 +1639,7 @@ alsa_driver_read (alsa_driver_t *driver, jack_nframes_t nframes)
}
}
*/
ReadInput();
ReadInput(orig_nframes, contiguous, nread);
if ((err = snd_pcm_mmap_commit (driver->capture_handle,
offset, contiguous)) < 0) {
......@@ -1782,7 +1782,7 @@ alsa_driver_write (alsa_driver_t* driver, jack_nframes_t nframes)
}
*/
WriteOutput();
WriteOutput(orig_nframes, contiguous, nwritten);
if (!bitset_empty (driver->channels_not_done)) {
alsa_driver_silence_untouched_channels (driver,
......@@ -2653,6 +2653,7 @@ driver_get_descriptor ()
return desc;
}
/*
jack_driver_t *
driver_initialize (jack_client_t *client, const JSList * params)
{
......@@ -2730,7 +2731,7 @@ driver_initialize (jack_client_t *client, const JSList * params)
case 'n':
user_nperiods = param->value.ui;
if (user_nperiods < 2) /* enforce minimum value */
if (user_nperiods < 2) // enforce minimum value
user_nperiods = 2;
break;
......@@ -2770,7 +2771,7 @@ driver_initialize (jack_client_t *client, const JSList * params)
}
}
/* duplex is the default */
// duplex is the default
if (!capture && !playback) {
capture = TRUE;
playback = TRUE;
......@@ -2793,6 +2794,7 @@ driver_initialize (jack_client_t *client, const JSList * params)
systemic_input_latency,
systemic_output_latency, midi);
}
*/
void
driver_finish (jack_driver_t *driver)
......
......@@ -264,12 +264,22 @@ alsa_driver_read (alsa_driver_t *driver, jack_nframes_t nframes);
int
alsa_driver_write (alsa_driver_t* driver, jack_nframes_t nframes);
#ifdef __cplusplus
extern "C"
{
#endif
// Code implemented in JackAlsaDriver.cpp
void ReadInput();
void MonitorInputt();
void ReadInput(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nread);
void MonitorInput();
void ClearOutput();
void WriteOutput();
void WriteOutput(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nwritten);
void SetTimet(jack_time_t time);
#ifdef __cplusplus
}
#endif
#endif /* __jack_alsa_driver_h__ */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment